Skip to content

Nightly build, release and benchmark #734

Nightly build, release and benchmark

Nightly build, release and benchmark #734

name: Nightly build, release and benchmark
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
env:
STACK_VERSION: 2.11.1
permissions:
id-token: write
attestations: write
contents: write
jobs:
build-linux:
name: Build static Linux binary and release
runs-on: ubuntu-latest
container: quay.io/benz0li/ghc-musl:9.8.2
outputs:
tag: ${{ steps.tag.outputs.value }}
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: true
repository: anoma/juvix
ref: main
- 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) ~"
# Without this the git command used by githash TemplateHaskell fails with permission error
# https://github.com/anoma/juvix/issues/2294
- name: Git permissions workaround
run: "chown -R $(id -un):$(id -gn) ."
- name: Install cargo
run: apk add --update cargo
- name: Install clang
run: apk add --update clang
- name: Install llvm
run: apk add --update llvm
- name: Install libncursesw
run: apk add --update libncursesw
- name: Runtime build
run: make runtime LIBTOOL=llvm-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: attest release tar
uses: actions/attest-build-provenance@v1
with:
subject-path: '/tmp/juvix-linux*'
- 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-darwin-x86_64:
runs-on: macos-13
name: Build macOS x86_64 binary
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: true
repository: anoma/juvix
ref: main
- name: install stack
run: |
brew install haskell-stack
- 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
- name: attest release tar
uses: actions/attest-build-provenance@v1
with:
subject-path: 'juvix-darwin*'
- uses: actions/upload-artifact@v3
with:
name: darwin-x86_64-binary
path: juvix-darwin*
if-no-files-found: error
build-darwin-aarch64:
runs-on: macos-14
name: Build macOS aarch64 binary
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: true
repository: anoma/juvix
ref: main
- name: install stack
run: |
brew install haskell-stack
- 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-aarch64.tar.gz -C "${{ env.HOME }}/.local/bin" juvix
- name: attest release tar
uses: actions/attest-build-provenance@v1
with:
subject-path: 'juvix-darwin*'
- uses: actions/upload-artifact@v3
with:
name: darwin-aarch64-binary
path: juvix-darwin*
if-no-files-found: error
publish-release:
needs: [build-linux, build-darwin-x86_64, build-darwin-aarch64]
runs-on: ubuntu-latest
name: Publish Release
steps:
- uses: actions/download-artifact@v3
with:
name: darwin-x86_64-binary
path: /tmp
- uses: actions/download-artifact@v3
with:
name: darwin-aarch64-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/action-install-gh-release@v1.9.0
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.8.2-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.8.2-stack-work-
- uses: haskell/actions/setup@v2
name: Setup Haskell
with:
ghc-version: 9.8.2
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