Merge pull request #23 from o1-labs/dw/remove-publish-job #103
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: | |
- main | |
pull_request: | |
env: | |
# https://doc.rust-lang.org/cargo/reference/profiles.html#release | |
RUSTFLAGS: -Coverflow-checks=y -Cdebug-assertions=y | |
# https://doc.rust-lang.org/cargo/reference/profiles.html#incremental | |
CARGO_INCREMENTAL: 1 | |
# https://nexte.st/book/pre-built-binaries.html#using-nextest-in-github-actions | |
CARGO_TERM_COLOR: always | |
jobs: | |
run_checks: | |
strategy: | |
matrix: | |
rust_toolchain_version: [1.67, 1.68, 1.69] | |
# Follow ocamlgen-test.opam requirements | |
# FIXME: currently not available for 5.0.0. | |
# It might be related to boxroot dependency, and we would need to bump | |
# up the ocaml-rs dependency | |
ocaml_version: [4.12, 4.13, 4.14] | |
runs-on: ubuntu-latest | |
name: Run some basic checks and tests | |
steps: | |
# | |
# Setup | |
# | |
- name: Checkout PR | |
uses: actions/checkout@v2 | |
# as action-rs does not seem to be maintained anymore, building from | |
# scratch the environment using rustup | |
- name: Setup Rust toolchain ${{ matrix.rust_toolchain_version }} | |
run: | |
| | |
curl --proto '=https' --tlsv1.2 -sSf -o rustup-init \ | |
https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init | |
chmod +x ./rustup-init | |
./rustup-init -y --default-toolchain "${{ matrix.rust_toolchain_version }}" --profile default | |
rm ./rustup-init | |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
# overwriting default rust-toolchain | |
echo ${{ matrix.rust_toolchain_version }} > rust-toolchain | |
- name: Setup OCaml ${{ matrix.ocaml_version }} | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: ${{ matrix.ocaml_version }} | |
# https://github.com/ocaml/setup-ocaml/issues/211#issuecomment-1058882386 | |
# disable-cache: true | |
- name: Setup OCaml dependencies | |
run: | | |
eval $(opam env) | |
opam install . --deps-only --with-test | |
- name: List OCaml and Rust versions | |
run: | | |
eval $(opam env) | |
echo "OCaml version $(ocamlc --version) (location = $(which ocamlc))" | |
echo "OPAM version $(opam --version) (location = $(which opam))" | |
echo "Rust version $(rustc --version) (location = $(which rustc))" | |
# | |
# Coding guidelines | |
# | |
- name: Enforce Rust formatting | |
run: | | |
eval $(opam env) | |
cargo run fmt -- --check | |
- name: Lint (clippy) | |
run: | | |
eval $(opam env) | |
cargo run clippy --all -- -D warnings | |
- name: Enforce OCaml formatting | |
run: | | |
eval $(opam env) | |
opam install ocamlformat.$(awk -F = '$1 == "version" {print $2}' .ocamlformat) | |
dune build @fmt | |
# | |
# OCaml (tests) | |
# | |
- name: Build and run tests | |
run: | | |
eval $(opam env) | |
dune build | |
dune runtest | |
- name: Check that up-to-date bindings are checked in | |
run: | | |
git diff --exit-code ":(exclude)rust-toolchain" |