Update dependency: deps/haskell-backend_release #1450
Workflow file for this run
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: 'Build + Test' | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: ['main'] | |
concurrency: | |
# head_ref is defined for PRs only, so we use run_id (unique) for | |
# the main branch to ensure all commits are built | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
ghc_version: '9.2.8' | |
hlint_version: '3.4.1' | |
fourmolu_version: '0.12.0.0' | |
hpack_version: '0.34.2' | |
jobs: | |
stack: | |
name: 'Stack / Unit Tests' | |
runs-on: [self-hosted, linux, normal] | |
steps: | |
- name: 'Checkout Code' | |
uses: actions/checkout@v3 | |
with: | |
# Check out pull request HEAD instead of merge commit. | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: 'Cache Stack root' | |
uses: actions/cache@v3 | |
with: | |
path: stack-cache | |
key: stack-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('stack.yaml.lock') }} | |
restore-keys: | | |
stack-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }} | |
stack-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }} | |
stack-2-${{ runner.os }}-ghc-${{ env.ghc_version }} | |
- name: 'Set up Docker' | |
uses: ./.github/actions/with-docker | |
with: | |
tag: hs-booster-ci-stack-unit-buster-${{ github.run_id }} | |
os: ubuntu | |
distro: jammy | |
fourmolu: ${{ env.fourmolu_version }} | |
hlint: ${{ env.hlint_version }} | |
hpack: ${{ env.hpack_version }} | |
ghc: ${{ env.ghc_version }} | |
- name: 'Run unit tests' | |
run: docker exec -t hs-booster-ci-stack-unit-buster-${{ github.run_id }} /bin/bash -c 'stack --system-ghc --stack-root $(pwd)/stack-cache test :unit-tests --pedantic' | |
- name: 'Tear down Docker' | |
if: always() | |
run: | | |
docker stop --time=0 hs-booster-ci-stack-unit-buster-${{ github.run_id }} | |
cabal: | |
name: 'Cabal / Unit Tests' | |
runs-on: [self-hosted, linux, normal] | |
steps: | |
- name: 'Checkout Code' | |
uses: actions/checkout@v3 | |
with: | |
# Check out pull request HEAD instead of merge commit. | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: 'Cache Cabal package database and store' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
cabal-cache/packages | |
cabal-cache/store | |
key: cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('cabal.project.freeze') }} | |
restore-keys: | | |
cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('package.yaml') }}- | |
cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}- | |
- name: 'Set up Docker' | |
uses: ./.github/actions/with-docker | |
with: | |
tag: hs-booster-ci-cabal-unit-buster-${{ github.run_id }} | |
os: ubuntu | |
distro: jammy | |
fourmolu: ${{ env.fourmolu_version }} | |
hlint: ${{ env.hlint_version }} | |
hpack: ${{ env.hpack_version }} | |
ghc: ${{ env.ghc_version }} | |
- name: 'Run hpack' | |
run: | | |
docker exec -t hs-booster-ci-cabal-unit-buster-${{ github.run_id }} /bin/bash -c 'hpack' | |
- name: 'Build and run unit tests' | |
run: | | |
docker exec -t hs-booster-ci-cabal-unit-buster-${{ github.run_id }} \ | |
/bin/bash -c 'cabal --store-dir /opt/workspace/cabal-cache/store v2-test unit-tests --enable-tests --test-show-details=direct' | |
- name: 'Configure with profiling' | |
run: | | |
docker exec -t hs-booster-ci-cabal-unit-buster-${{ github.run_id }} \ | |
/bin/bash -c 'cabal --store-dir /opt/workspace/cabal-cache/store v2-configure --enable-profiling -f-threaded' | |
- name: 'Tear down Docker' | |
if: always() | |
run: | | |
docker stop --time=0 hs-booster-ci-cabal-unit-buster-${{ github.run_id }} | |
style: | |
name: 'Formatting and Style' | |
runs-on: [self-hosted, linux, normal] | |
steps: | |
- name: 'Checkout Code' | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
token: ${{ secrets.JENKINS_GITHUB_PAT }} | |
- name: 'Set up Docker' | |
uses: ./.github/actions/with-docker | |
with: | |
tag: hs-booster-ci-formatting-style-buster-${{ github.run_id }} | |
os: ubuntu | |
distro: jammy | |
fourmolu: ${{ env.fourmolu_version }} | |
hlint: ${{ env.hlint_version }} | |
hpack: ${{ env.hpack_version }} | |
ghc: ${{ env.ghc_version }} | |
- name: 'Check formatting' | |
run: docker exec -t hs-booster-ci-formatting-style-buster-${{ github.run_id }} /bin/bash -c './scripts/fourmolu.sh' | |
- name: Update branch | |
env: | |
GITHUB_EVENT_NAME: ${{ github.event_name }} | |
run: | | |
if git status -s -b | grep -q '^##.*(no branch)$'; then | |
echo 2>&1 "Error: Git is in detached HEAD state" | |
exit 1 | |
fi | |
if [ -n "$(git status --porcelain '*.hs')" ]; then | |
git config --global user.name github-actions | |
git config --global user.email github-actions@github.com | |
git add '*.hs' | |
git commit -m "Format with fourmolu" | |
git show --stat | |
git push | |
echo "Reformatted code pushed, aborting this workflow" | tee -a $GITHUB_STEP_SUMMARY | |
exit 1 | |
fi | |
- name: 'Run hlint' | |
run: docker exec -t hs-booster-ci-formatting-style-buster-${{ github.run_id }} /bin/bash -c './scripts/hlint.sh' | |
- name: 'Tear down Docker' | |
if: always() | |
run: | | |
docker stop --time=0 hs-booster-ci-formatting-style-buster-${{ github.run_id }} | |
nix-build: | |
name: 'Nix / All Tests' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runner: [self-hosted, linux, normal] | |
os: Ubuntu-22.04 | |
nix: x86_64-linux | |
- runner: MacM1 | |
os: self-macos-12 | |
nix: aarch64-darwin | |
- runner: macos-12 | |
os: macos-12 | |
nix: x86_64-darwin | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: 'Check out code' | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: 'Install Nix' | |
if: ${{ matrix.os == 'macos-12' }} | |
uses: cachix/install-nix-action@v22 | |
with: | |
install_url: https://releases.nixos.org/nix/nix-2.13.3/install | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
substituters = http://cache.nixos.org https://cache.iog.io | |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= | |
- name: 'Install Cachix' | |
if: ${{ matrix.os == 'macos-12' }} | |
uses: cachix/cachix-action@v12 | |
with: | |
name: k-framework | |
authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}' | |
skipPush: true | |
- name: Build executables | |
env: | |
CACHIX_AUTH_TOKEN: '${{ secrets.CACHIX_PUBLIC_TOKEN }}' | |
NIX_PATH: 'nixpkgs=http://nixos.org/channels/nixos-22.05/nixexprs.tar.xz' | |
GC_DONT_GC: '1' | |
run: | | |
nix --version | |
export JQ=$(nix-build '<nixpkgs>' -A jq --no-link)/bin/jq | |
booster=$(nix build .#hs-backend-booster:exe:kore-rpc-booster --extra-experimental-features 'nix-command flakes' --print-build-logs --json | $JQ -r '.[].outputs | to_entries[].value') | |
drv=$(nix-store --query --deriver ${booster}) | |
nix-store --query --requisites --include-outputs ${drv} | cachix push k-framework | |
nix build .#hs-backend-booster:exe:parsetest --extra-experimental-features 'nix-command flakes' --print-build-logs | |
nix build .#hs-backend-booster:exe:rpc-client --extra-experimental-features 'nix-command flakes' --print-build-logs | |
- name: Run unit tests | |
env: | |
GC_DONT_GC: '1' | |
run: nix run .#hs-backend-booster:test:unit-tests --extra-experimental-features 'nix-command flakes' --print-build-logs | |
- name: Run integration tests | |
if: ${{ matrix.os != 'macos-12' }} ## takes long on public runner, already tested in MacM1 | |
env: | |
GC_DONT_GC: '1' | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
export JQ=$(nix-build '<nixpkgs>' -A jq --no-link)/bin/jq | |
K_VERSION=$(cat deps/k_release) | |
PLUGIN_VERSION=$(cat deps/blockchain-k-plugin_release) | |
export PATH="$(nix build github:runtimeverification/k/v$K_VERSION#k.openssl.procps --no-link --json | $JQ -r '.[].outputs | to_entries[].value')/bin:$PATH" | |
nix run .#hs-backend-booster:test:llvm-integration --extra-experimental-features 'nix-command flakes' --print-build-logs | |
# The runDirectoryTest.sh script expects the following env vars to be set | |
export PLUGIN_DIR=$(nix build github:runtimeverification/blockchain-k-plugin/$PLUGIN_VERSION --no-link --json | $JQ -r '.[].outputs | to_entries[].value') | |
KORE_RPC_BOOSTER=$(nix build .#kore-rpc-booster --no-link --json | $JQ -r '.[].outputs | to_entries[].value')/bin/kore-rpc-booster | |
BOOSTER_DEV=$(nix build .#hs-backend-booster:exe:booster-dev --no-link --json | $JQ -r '.[].outputs | to_entries[].value')/bin/booster-dev | |
KORE_RPC_DEV=$(nix build .#hs-backend-booster:exe:kore-rpc-dev --no-link --json | $JQ -r '.[].outputs | to_entries[].value')/bin/kore-rpc-dev | |
export CLIENT=$(nix build .#hs-backend-booster:exe:rpc-client --no-link --json | $JQ -r '.[].outputs | to_entries[].value')/bin/rpc-client | |
cd test/rpc-integration | |
for dir in $(ls -d test-*); do | |
name=${dir##test-} | |
echo "Running $name..." | |
if [ "$name" = "a-to-f" ] || [ "$name" = "diamond" ]; then | |
SERVER=$BOOSTER_DEV ./runDirectoryTest.sh test-$name --time | |
SERVER=$KORE_RPC_DEV ./runDirectoryTest.sh test-$name --time | |
SERVER=$KORE_RPC_BOOSTER ./runDirectoryTest.sh test-$name --time | |
elif [ "$name" = "vacuous" ]; then | |
SERVER=$KORE_RPC_DEV ./runDirectoryTest.sh test-$name | |
SERVER=$KORE_RPC_BOOSTER ./runDirectoryTest.sh test-$name | |
elif [ "$name" = "substitutions" ]; then | |
SERVER=$KORE_RPC_DEV ./runDirectoryTest.sh test-$name --time | |
SERVER=$KORE_RPC_BOOSTER ./runDirectoryTest.sh test-$name --time | |
elif [ "$name" = "no-evaluator" ]; then | |
SERVER=$BOOSTER_DEV ./runDirectoryTest.sh test-$name --time | |
else | |
SERVER=$KORE_RPC_BOOSTER ./runDirectoryTest.sh test-$name --time | |
fi | |
done | |