[CI] Build on JS and WASM backends #7
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: ci | |
on: | |
push: | |
branches: | |
- master | |
pull_request: {} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
ghc: ['9.6', '9.4', '9.2', '9.0', '8.10', '8.8.4', '8.8.2', '8.8.1', '8.6', '8.4'] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: haskell-actions/setup@v2 | |
id: setup-haskell-cabal | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: 'latest' | |
- uses: actions/cache@v3 | |
name: Cache cabal stuff | |
with: | |
path: | | |
${{ steps.setup-haskell-cabal.outputs.cabal-store }} | |
dist-newstyle | |
key: ${{ runner.os }}-${{ matrix.ghc }} | |
- name: Build | |
run: | | |
cabal test --enable-tests --test-show-details=direct | |
cabal bench --benchmark-option=-l | |
cabal sdist | |
cabal check | |
- name: Build without SIMD | |
run: | | |
cabal test -f-simd --enable-tests --test-show-details=direct | |
- name: Haddock | |
if: ${{ matrix.ghc != '8.0' && matrix.ghc != '8.2' && matrix.ghc != '8.4' }} | |
run: cabal haddock | |
i386: | |
needs: build | |
runs-on: ubuntu-latest | |
container: | |
image: i386/ubuntu:bionic | |
steps: | |
- name: Install | |
run: | | |
apt-get update -y | |
apt-get install -y autoconf build-essential zlib1g-dev libgmp-dev curl libncurses5 libtinfo5 libncurses5-dev libtinfo-dev | |
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 sh | |
- uses: actions/checkout@v1 | |
- name: Test | |
run: | | |
source ~/.ghcup/env | |
cabal --version | |
cabal update | |
cabal test --enable-tests --test-show-details=direct | |
cabal test -f-simd --enable-tests --test-show-details=direct | |
emulated: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
arch: ['s390x', 'ppc64le', 'armv7', 'aarch64'] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: uraimo/run-on-arch-action@v2 | |
timeout-minutes: 60 | |
with: | |
arch: ${{ matrix.arch }} | |
distro: ubuntu22.04 | |
githubToken: ${{ github.token }} | |
install: | | |
apt-get update -y | |
apt-get install -y ghc libghc-vector-dev libghc-tasty-quickcheck-dev libghc-tasty-hunit-dev | |
run: | | |
ghc --version | |
echo "#define BOUNDS_CHECK(f) (\_ _ _ -> id)" > src/vector.h | |
echo "#define UNSAFE_CHECK(f) (\_ _ _ -> id)" >> src/vector.h | |
ghc --make -Isrc:test -isrc:test -o Tests test/Main.hs +RTS -s | |
./Tests +RTS -s | |
ghc --make -Isrc:test -isrc:test -DUseSIMD -o Tests cbits/bitvec_simd.c test/Main.hs +RTS -s | |
./Tests +RTS -s | |
js: | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
version: javascript-unknown-ghcjs-9.6.2 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
name: Cache cabal stuff | |
with: | |
path: | | |
~/.cabal/store | |
dist-newstyle | |
key: ${{ env.version }} | |
- name: Setup | |
run: | | |
ghcup config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/develop/ghcup-cross-0.0.8.yaml | |
cabal update | |
- name: Install JS toolchain | |
run: | | |
git clone https://github.com/emscripten-core/emsdk.git | |
cd emsdk | |
./emsdk install latest | |
./emsdk activate latest | |
source ./emsdk_env.sh | |
cd .. | |
emconfigure ghcup install ghc --set ${{ env.version }} | |
- name: Build | |
run: | | |
cabal --with-compiler=javascript-unknown-ghcjs-ghc --with-hc-pkg=javascript-unknown-ghcjs-ghc-pkg build | |
wasm: | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
version: wasm32-wasi-9.8.0.20230927 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
name: Cache cabal stuff | |
with: | |
path: | | |
~/.cabal/store | |
dist-newstyle | |
key: ${{ env.version }} | |
- name: Setup | |
run: | | |
ghcup config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/develop/ghcup-cross-0.0.8.yaml | |
cabal update | |
- name: Install WASM toolchain | |
run: | | |
git clone https://gitlab.haskell.org/ghc/ghc-wasm-meta.git | |
cd ghc-wasm-meta/ | |
export SKIP_GHC=yes | |
./setup.sh | |
source ~/.ghc-wasm/env | |
~/.ghc-wasm/add_to_github_path.sh | |
cd .. | |
ghcup install ghc --set ${{ env.version }} -- --host=x86_64-linux --with-intree-gmp --with-system-libffi | |
- name: Build | |
run: | | |
mv cabal.project.wasi cabal.project.local | |
cabal --with-compiler=wasm32-wasi-ghc --with-hc-pkg=wasm32-wasi-ghc-pkg build --enable-tests | |
cabal --with-compiler=wasm32-wasi-ghc --with-hc-pkg=wasm32-wasi-ghc-pkg list-bin test:bitvec-tests --enable-tests | |
wasmtime $(cabal --with-compiler=wasm32-wasi-ghc --with-hc-pkg=wasm32-wasi-ghc-pkg list-bin test:bitvec-tests --enable-tests) | |
bounds-checking: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: haskell-actions/setup@v2 | |
id: setup-haskell-cabal | |
with: | |
ghc-version: 'latest' | |
- name: Update cabal package database | |
run: cabal update | |
- uses: actions/cache@v2 | |
name: Cache cabal stuff | |
with: | |
path: | | |
${{ steps.setup-haskell-cabal.outputs.cabal-store }} | |
dist-newstyle | |
key: ${{ runner.os }}-latest | |
- name: Test | |
run: | | |
echo "constraints:vector +unsafechecks +internalchecks" >> cabal.project | |
# Some tests are filtered out because of | |
# https://gitlab.haskell.org/ghc/ghc/-/issues/23132 | |
cabal run tests --enable-tests --test-show-details=direct --ghc-options='-fcheck-prim-bounds -fno-ignore-asserts' -- -p '$NF!~/cloneFromWords8/&&$NF!~/cloneToByteString/' | |
cabal run tests -f-simd --enable-tests --test-show-details=direct --ghc-options='-fcheck-prim-bounds -fno-ignore-asserts' -- -p '$NF!~/cloneFromWords8/&&$NF!~/cloneToByteString/' |