Nightly build, release and benchmark #228
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly build, release and benchmark | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: "the repository ref to build" | |
required: true | |
default: "main" | |
schedule: | |
- cron: '0 3 * * *' | |
env: | |
STACK_VERSION: 2.11.1 | |
jobs: | |
build-linux: | |
name: Build static Linux binary and release | |
runs-on: ubuntu-latest | |
container: glcr.b-data.ch/ghc/ghc-musl:9.4.5 | |
outputs: | |
tag: ${{ steps.tag.outputs.value }} | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
repository: anoma/juvix | |
ref: ${{ github.event.inputs.ref }} | |
- name: create ~/.local/bin | |
run: mkdir -p "$HOME/.local/bin" | |
shell: bash | |
- name: install stack | |
run: | | |
curl https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/stack-$STACK_VERSION-linux-x86_64-static.tar.gz -OL | |
tar xf stack-$STACK_VERSION-linux-x86_64-static.tar.gz | |
cp stack-$STACK_VERSION-linux-x86_64-static/stack /usr/local/bin | |
- name: add ~/.local/bin to PATH | |
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
shell: bash | |
- name: Stack permissions bug workaround | |
run: "chown -R $(id -un):$(id -gn) ~" | |
- name: Install clang14 | |
run: apk add --update clang14 | |
- name: Runtime build | |
run: make runtime LIBTOOL=llvm14-ar | |
- name: build Juvix | |
run: stack install --allow-different-user --system-ghc --ghc-options='-split-sections' --flag juvix:static | |
- run: echo "HOME=$HOME" >> $GITHUB_ENV | |
shell: bash | |
- name: set current date to date.now output variable | |
id: date | |
run: echo "now=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: set Juvix version to juvix-version.current output variable | |
id: juvix-version | |
run: echo "current=$(juvix --version | head -n 1 | sed -E 's/[^0-9]+(.*)/\1/')" >> $GITHUB_OUTPUT | |
- name: set tag.value to tag for release | |
id: tag | |
run: echo "value=nightly-${{ steps.date.outputs.now }}-${{ steps.juvix-version.outputs.current }}" >> $GITHUB_OUTPUT | |
- name: create release tar | |
run: | | |
cp "${{ env.HOME }}/.local/bin/juvix" /tmp/juvix | |
cd /tmp | |
tar zcf juvix-linux_x86_64.tar.gz juvix | |
- name: create draft nightly release and upload artifacts | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag.outputs.value }} | |
commit: "main" | |
name: "Nightly Build ${{ steps.date.outputs.now }} ${{ steps.juvix-version.outputs.current }}" | |
artifacts: /tmp/juvix-linux* | |
artifactErrorsFailBuild: true | |
allowUpdates: true | |
draft: true | |
build-macos: | |
runs-on: macos-latest | |
name: Build macOS binary | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
repository: anoma/juvix | |
ref: main | |
- name: Set homebrew LLVM CC and LIBTOOL vars (macOS) | |
run: | | |
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> $GITHUB_ENV | |
echo "LIBTOOL=$(brew --prefix llvm@15)/bin/llvm-ar" >> $GITHUB_ENV | |
- name: Make runtime | |
run: | | |
make CC=$CC LIBTOOL=$LIBTOOL runtime | |
- name: Stack setup | |
id: stack | |
uses: freckle/stack-action@v4 | |
with: | |
test: false | |
- name: Install Juvix | |
run: | | |
make CC=$CC LIBTOOL=$LIBTOOL install | |
- run: echo "HOME=$HOME" >> $GITHUB_ENV | |
shell: bash | |
- name: create release tar | |
run: | | |
tar zcf juvix-darwin_x86_64.tar.gz -C "${{ env.HOME }}/.local/bin" juvix | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: macos-binary | |
path: juvix-darwin* | |
if-no-files-found: error | |
publish-release: | |
needs: [build-linux, build-macos] | |
runs-on: ubuntu-latest | |
name: Publish Release | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: macos-binary | |
path: /tmp | |
- name: upload macOS release binary | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{needs.build-linux.outputs.tag}} | |
omitNameDuringUpdate: true | |
artifactErrorsFailBuild: true | |
artifacts: /tmp/juvix-darwin* | |
draft: true | |
allowUpdates: true | |
- name: make nightly release latest | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{needs.build-linux.outputs.tag}} | |
omitNameDuringUpdate: true | |
makeLatest: true | |
allowUpdates: true | |
bench: | |
needs: publish-release | |
name: Run benchmarks | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
repository: anoma/juvix | |
ref: main | |
path: main | |
- name: checkout nightly repo | |
uses: actions/checkout@v3 | |
with: | |
path: nightly-repo | |
- name: Download latest nightly Juvix binary | |
uses: jaxxstorm/[email protected] | |
with: | |
repo: anoma/juvix-nightly-builds | |
cache: enable | |
rename-to: juvix | |
chmod: 0755 | |
- name: Setup OCAML | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: 4.13.x | |
- uses: actions/cache@v3 | |
name: Cache ~/.stack | |
with: | |
path: ~/.stack | |
key: ${{ runner.os }}-${{ matrix.ghc }}-stack-global-${{ hashFiles('main/stack.yaml') }}-${{ hashFiles('main/package.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-9.2.7-stack-global- | |
- uses: actions/cache@v3 | |
name: Cache .stack-work | |
with: | |
path: main/.stack-work | |
key: ${{ runner.os }}-${{ matrix.ghc }}-stack-work-${{ hashFiles('main/stack.yaml') }}-${{ hashFiles('main/package.yaml') }}-${{ hashFiles('main/**/*.hs') }} | |
restore-keys: | | |
${{ runner.os }}-9.2.7-stack-work- | |
- uses: haskell/actions/setup@v2 | |
name: Setup Haskell | |
with: | |
ghc-version: 9.2.7 | |
enable-stack: true | |
stack-version: 'latest' | |
- name: Install gnuplot | |
run: sudo apt install gnuplot | |
- name: Cache LLVM and Clang (Linux) | |
id: cache-llvm | |
uses: actions/cache@v3 | |
with: | |
path: | | |
C:/Program Files/LLVM | |
./llvm | |
key: ${{ runner.os }}-llvm-13 | |
- name: Install LLVM and Clang (Linux) | |
uses: KyleMayes/install-llvm-action@v1 | |
with: | |
version: "13.0" | |
cached: ${{ steps.cache-llvm.outputs.cache-hit }} | |
- name: Download and extract wasi-sysroot | |
run: | | |
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/wasi-sysroot-15.0.tar.gz -OL | |
tar xfv wasi-sysroot-15.0.tar.gz | |
- name: Set WASI_SYSROOT_PATH | |
run: | | |
echo "WASI_SYSROOT_PATH=$GITHUB_WORKSPACE/wasi-sysroot" >> $GITHUB_ENV | |
- name: Setup Wasmer | |
uses: wasmerio/setup-wasmer@v1 | |
- name: Setup Juvix runtime | |
run: | | |
cd main | |
make runtime | |
- name: Run benchmarks | |
run: | | |
eval $(opam env) | |
wasmer --version | |
juvix --version | |
ocamlc --version | |
ocamlopt --version | |
clang --version | |
cd main | |
stack bench --system-ghc | |
- name: Copy benchmark results | |
run: cp -r main/.benchmark-results/. nightly-repo/benchmark-results | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
message: Add benchmark results | |
add: benchmark-results/**/*.svg benchmark-results/**/*.csv | |
cwd: ./nightly-repo |