Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Build on JS and WASM backends #84

Merged
merged 4 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .cirrus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
freebsd_instance:
image_family: freebsd-13-1

task:
install_script: pkg install -y ghc hs-cabal-install git
script:
- ghc --version
- cabal --version
- cabal update
- cabal test --test-show-details=direct --enable-tests
- cabal test -f-simd --test-show-details=direct --enable-tests
11 changes: 0 additions & 11 deletions .cirrus.yml

This file was deleted.

86 changes: 72 additions & 14 deletions .github/workflows/ci.yml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
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
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
Expand All @@ -31,20 +31,15 @@ jobs:
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-
- name: Build
run: |
echo packages:. > cabal.project
echo tests:True >> cabal.project
echo "constraints:quickcheck-classes -semigroupoids -aeson -semirings" >> cabal.project
cabal test --test-show-details=direct
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 --test-show-details=direct
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
Expand Down Expand Up @@ -96,12 +91,78 @@ jobs:
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
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: 'latest'
Expand All @@ -116,11 +177,8 @@ jobs:
key: ${{ runner.os }}-latest
- name: Test
run: |
echo packages:. > cabal.project
echo tests:True >> cabal.project
echo "constraints:quickcheck-classes -semigroupoids -aeson -semirings" >> cabal.project
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 --test-show-details=direct --ghc-options='-fcheck-prim-bounds -fno-ignore-asserts' -- -p '$NF!~/cloneFromWords8/&&$NF!~/cloneToByteString/'
cabal run tests -f-simd --test-show-details=direct --ghc-options='-fcheck-prim-bounds -fno-ignore-asserts' -- -p '$NF!~/cloneFromWords8/&&$NF!~/cloneToByteString/'
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/'
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ dist-newstyle

cabal.sandbox.config
.cabal-sandbox

########
# IDEs #
########

.vscode
4 changes: 3 additions & 1 deletion bitvec.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ test-suite bitvec-tests
Tests.SetOps
Tests.SetOpsTS
Tests.Vector
ghc-options: -Wall -threaded -rtsopts -Wcompat
ghc-options: -Wall -Wcompat
if !arch(wasm32)
ghc-options: -threaded -rtsopts
include-dirs: test

if impl(ghc <9.0)
Expand Down
4 changes: 4 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages: .

package quickcheck-classes
flags: -aeson -semigroupoids -semirings
5 changes: 5 additions & 0 deletions cabal.project.wasi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- https://github.com/haskellari/splitmix/pull/73
source-repository-package
type: git
location: https://github.com/amesgen/splitmix.git
tag: 83b906c4bcdc2720546f1779a16eb65e8e12ecba
Loading