Merge pull request #50 from pkel/dependency-fix #712
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: test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
ocaml: | |
name: Test OCaml | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- macos-12 | |
ocaml-compiler: | |
- 4.12.1 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # get complete history, including tags for CPR_VERSION env | |
- name: Setup OCaml ${{ matrix.ocaml-compiler }} | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: ocaml-variants.${{ matrix.ocaml-compiler }}+options,ocaml-option-flambda | |
- name: Install dependencies | |
run: opam install . --deps-only --with-test | |
- name: Build and run tests | |
run: | | |
export CPR_VERSION=github-${{ matrix.os }}-$(git describe --tags --dirty || git describe --all --long --dirty) | |
opam exec -- dune build @fmt | |
opam exec -- dune build | |
opam exec -- dune runtest | |
- name: Build engine DLL | |
run: | | |
opam exec -- dune build --release simulator/gym/cpr_gym_engine.so && | |
cp _build/default/simulator/gym/cpr_gym_engine.so ./ | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cpr_gym_engine-${{ matrix.os }}-ocaml-${{ matrix.ocaml-compiler }} | |
path: cpr_gym_engine.so | |
python: | |
name: Test Python | |
needs: ocaml | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
python-version: | |
- 3.9 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download engine DLL | |
uses: actions/download-artifact@v3 | |
with: | |
name: cpr_gym_engine-ubuntu-20.04-ocaml-4.12.1 | |
path: ./gym/ocaml/ | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade 'pip<24.1' | |
python -m pip install 'wheel<0.39' 'setuptools<67' # gym compatibility, see https://stackoverflow.com/a/77205046 | |
pip install -r requirements.txt | |
- name: Run tests | |
run: | | |
black --check . | |
flake8 | |
pytest --forked |