-
Notifications
You must be signed in to change notification settings - Fork 2
89 lines (75 loc) · 2.21 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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
pip install -r requirements.txt
- name: Run tests
run: |
black --check .
flake8
pytest --forked