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

Conversation

konsumlamm
Copy link
Contributor

Running the tests doesn't work currently, but building the library does. I took the build steps from https://www.haskell.org/ghcup/guide/#cross-support. Should the actions also cache stuff? If so, could one just copy the caching from the build job?

Also rename ci.yml to ci.yaml (.yaml is the recommended extension).

Rename `ci.yml` to `ci.yaml`
@Bodigrim
Copy link
Owner

Thanks!

Running the tests doesn't work currently, but building the library does.

What's failing in tests?

Should the actions also cache stuff? If so, could one just copy the caching from the build job?

Caching would be nice. Yes, presumably you can copy it from the main build job, just adjust cache key.

@konsumlamm
Copy link
Contributor Author

Running the tests doesn't work currently, but building the library does.

What's failing in tests?

On the JS backend, the tests fail to run due to ReferenceError: h$getMonotonicNSec is not defined (see https://gitlab.haskell.org/ghc/ghc/-/issues/22374) and on the WASM backend, semirings fails to compile (chessai/semirings#86). See https://github.com/konsumlamm/bitvec/actions/runs/7029803339 for logs.

@Bodigrim
Copy link
Owner

on the WASM backend, semirings fails to compile

Could you please try

cabal test -c 'quickcheck-classes -semirings' -c 'semirings < 0' --enable-tests

? Flipping other flags of quickcheck-classes might be helpful as well.

Use `haskell-actions/setup` instead of `haskell/actions/setup`
@konsumlamm
Copy link
Contributor Author

Now the testsuite compiles successfully, but there's a linker error:

wasm-ld: error: unable to find library -lHSrts-1.0.2_thr

See https://github.com/konsumlamm/bitvec/actions/runs/7053126518/job/19199568767 for the log.

@Bodigrim
Copy link
Owner

@TerrorJack any ideas about wasm-ld error?

@konsumlamm does disabling threaded runtime help? We can make ghc-options: -threaded conditional, only on non-WASM platforms.

@konsumlamm
Copy link
Contributor Author

Still a linker error:

wasm-ld: error: /home/runner/.local/state/cabal/store/ghc-9.8.0.20230927/splitmix-0.1.0.5-ca7fbe7591ee007f80e9a34938251542fa964d5342dbfb81ee20559bbbf44ea3/lib/libHSsplitmix-0.1.0.5-ca7fbe7591ee007f80e9a34938251542fa964d5342dbfb81ee20559bbbf44ea3.a(init.o): undefined symbol: clock
wasm-ld: error: /home/runner/.local/state/cabal/store/ghc-9.8.0.20230927/splitmix-0.1.0.5-ca7fbe7591ee007f80e9a34938251542fa964d5342dbfb81ee20559bbbf44ea3/lib/libHSsplitmix-0.1.0.5-ca7fbe7591ee007f80e9a34938251542fa964d5342dbfb81ee20559bbbf44ea3.a(init.o): undefined symbol: getpid

@TerrorJack
Copy link

the -lHSrts-1.0.2_thr error is indeed because we don't build the threaded rts for wasm at all. as for clock, getpid, yes, it's necessary to use those workarounds for the time being.

@konsumlamm
Copy link
Contributor Author

Ok, now linking works, but running fails:

/home/runner/work/bitvec/bitvec/dist-newstyle/build/wasm32-wasi/ghc-9.8.0.20230927/bitvec-1.1.5.0/t/bitvec-tests/build/bitvec-tests/bitvec-tests.wasm: createProcess: posix_spawnp: invalid argument (Exec format error)

@konsumlamm konsumlamm force-pushed the wasm-js-ci branch 2 times, most recently from 4d00ddc to c97b53f Compare December 1, 2023 19:10
Add `.vscode` to `.gitignore`
@Bodigrim
Copy link
Owner

Bodigrim commented Dec 1, 2023

Ok, now linking works, but running fails:

I suppose we have to run tests manually, via wasm-run/wasmtime.sh. Cf. https://github.com/haskell/zlib/blob/add586898fd38712980731f2f3a13ce8d75650aa/.github/workflows/other.yml#L71-L75

@konsumlamm
Copy link
Contributor Author

Now the tests finally run (and pass) under WASM.

@Bodigrim Bodigrim merged commit db58eab into Bodigrim:master Dec 2, 2023
39 checks passed
@Bodigrim
Copy link
Owner

Bodigrim commented Dec 2, 2023

Awesome, many thanks!

@konsumlamm konsumlamm deleted the wasm-js-ci branch December 2, 2023 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants