Build ARM instead of i386 on CI to test 32 bit build (and 64 bit ARM … #93
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 | ||
on: | ||
- push | ||
- pull_request | ||
defaults: | ||
run: | ||
shell: bash | ||
jobs: | ||
main: | ||
name: GHC ${{ matrix.ghc }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
ghc: | ||
- "8.6" | ||
- "8.8" | ||
- "8.10" | ||
- "9.0" | ||
- "9.2" | ||
- "9.4" | ||
- "9.6" | ||
- "9.8" | ||
- "9.10" | ||
include: | ||
- os: macOS-latest | ||
ghc: "9.10" | ||
- os: windows-latest | ||
ghc: "9.10" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: haskell-actions/setup@v2 | ||
id: setup-haskell-cabal | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
cabal-version: "latest" | ||
cabal-update: true | ||
- uses: actions/cache@v4 | ||
name: Cache cabal store | ||
with: | ||
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} | ||
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} | ||
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- | ||
- name: Cabal version | ||
run: | | ||
cabal --version | ||
- name: Unpack | ||
run: | | ||
cabal sdist --ignore-project --output-directory .. | ||
cd .. | ||
cabal get atomic-counter-*.tar.gz -d default | ||
cabal get atomic-counter-*.tar.gz -d no-cmm | ||
- name: Build & Test default | ||
run: | | ||
project_file="$(pwd)/cabal.project.ci" | ||
cd ../default/atomic-counter-*/ | ||
cabal build --project-file "$project_file" all | ||
cabal test --project-file "$project_file" --test-show-details=direct all | ||
cabal bench --project-file "$project_file" --benchmark-options='--stdev 100 --timeout 100' all | ||
- name: Haddock | ||
run: | | ||
cd ../default/atomic-counter-*/ | ||
cabal haddock all | ||
- name: Cabal check | ||
run: | | ||
cd ../default/atomic-counter-*/ | ||
cabal check | ||
- name: Build & Test no cmm | ||
run: | | ||
project_file="$(pwd)/cabal.project.ci" | ||
cd ../no-cmm/atomic-counter-*/ | ||
cabal build --project-file "$project_file" --constraint "atomic-counter +no-cmm" all | ||
cabal test --project-file "$project_file" --constraint "atomic-counter +no-cmm" --test-show-details=direct all | ||
cabal bench --project-file "$project_file" --constraint "atomic-counter +no-cmm" --benchmark-options='--stdev 100 --timeout 100' all | ||
# We use github.com/haskell self-hosted runners for ARM testing. | ||
# If they become unavailable in future, put ['armv7', 'aarch64'] | ||
# back to emulation jobs above. | ||
arm: | ||
needs: build | ||
runs-on: [self-hosted, Linux, ARM64] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [arm32v7, arm64v8] | ||
steps: | ||
- name: Cleanup | ||
uses: docker://hasufell/arm64v8-ubuntu-haskell:focal | ||
with: | ||
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +" | ||
- uses: actions/checkout@v4 | ||
- if: matrix.arch == 'arm32v7' | ||
name: Run build (arm32v7 linux) | ||
uses: docker://hasufell/arm32v7-ubuntu-haskell:focal | ||
with: | ||
args: sh -c 'cabal update && (project_file="$(pwd)/cabal.project.ci"; cabal build --project-file "$project_file" all && cabal test --project-file "$project_file" --test-show-details=direct all && cabal bench --project-file "$project_file" --benchmark-options='--stdev 100 --timeout 100' all)' | ||
- if: matrix.arch == 'arm64v8' | ||
name: Run build (arm64v8 linux) | ||
uses: docker://hasufell/arm64v8-ubuntu-haskell:focal | ||
with: | ||
args: sh -c "ghcup install ghc 9.10.1 && cabal update && cabal test -w ~/.ghcup/bin/ghc-9.10.1" | ||
args: sh -c 'ghcup install ghc 9.10.1 && cabal update && (ghc="~/.ghcup/bin/ghc-9.10.1"; project_file="$(pwd)/cabal.project.ci"; cabal build -w "$ghc" --project-file "$project_file" all && cabal test -w "$ghc" --project-file "$project_file" --test-show-details=direct all && cabal bench -w "$ghc" --project-file "$project_file" --benchmark-options="--stdev 100 --timeout 100" all)' | ||