diff --git a/.cirrus.yaml b/.cirrus.yaml new file mode 100644 index 0000000..a430812 --- /dev/null +++ b/.cirrus.yaml @@ -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 diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index b984c60..0000000 --- a/.cirrus.yml +++ /dev/null @@ -1,11 +0,0 @@ -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 -c 'quickcheck-classes -semigroupoids -aeson -semirings' --enable-tests - - cabal test -f-simd --test-show-details=direct -c 'quickcheck-classes -semigroupoids -aeson -semirings' --enable-tests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yaml similarity index 54% rename from .github/workflows/ci.yml rename to .github/workflows/ci.yaml index 0ba092e..dd32e22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yaml @@ -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 }} @@ -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 @@ -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' @@ -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/' diff --git a/.gitignore b/.gitignore index 80e2db4..334f427 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,9 @@ dist-newstyle cabal.sandbox.config .cabal-sandbox + +######## +# IDEs # +######## + +.vscode diff --git a/bitvec.cabal b/bitvec.cabal index 858596d..43e9191 100644 --- a/bitvec.cabal +++ b/bitvec.cabal @@ -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) diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000..868d232 --- /dev/null +++ b/cabal.project @@ -0,0 +1,4 @@ +packages: . + +package quickcheck-classes + flags: -aeson -semigroupoids -semirings diff --git a/cabal.project.wasi b/cabal.project.wasi new file mode 100644 index 0000000..386cf71 --- /dev/null +++ b/cabal.project.wasi @@ -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