-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (101 loc) · 3.47 KB
/
Copy pathci.yml
File metadata and controls
106 lines (101 loc) · 3.47 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint-and-test:
name: lint + tests (${{ matrix.os }}, py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
include:
- os: macos-latest
python-version: "3.12"
- os: windows-latest
python-version: "3.12"
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install
# decisionrl brings PyTorch; the CPU wheel is a fraction of the default
# one and nothing here trains a network.
shell: bash
run: |
python -m pip install --upgrade pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[dev]"
- name: Ruff
run: ruff check .
- name: Mypy
run: mypy
- name: Tests
run: pytest -q --cov=stadion --cov-report=term-missing
verify-optima:
name: dynamic programs agree with their own policies
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: pip
- name: Install
run: |
python -m pip install --upgrade pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[dev]"
- name: Verify
# Every score in this library is measured against the optimum, so a wrong
# recurrence would move the whole scale without failing anything else.
# This is the one check that can catch it.
run: stadion verify --instances 5 --episodes 4000
reference-controls:
name: classical scores 0 and the optimum scores 1
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: pip
- name: Install
run: |
python -m pip install --upgrade pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[dev]"
- name: Run the reference arms through the ordinary evaluation path
run: |
set -euo pipefail
for task in inventory pricing queueing energy supply-chain joint-pricing; do
for agent in classical optimum; do
stadion run "$task" --agent "$agent" --instances 10 --episodes 8
done
done
ci:
name: CI
runs-on: ubuntu-latest
if: always()
needs: [lint-and-test, verify-optima, reference-controls]
steps:
# One aggregate check to require in branch protection. The matrix jobs
# carry their operating system and Python version in the name, so every
# one of them is a separate context that changes the moment the matrix
# does - and a required check that silently stops matching is a required
# check that stopped requiring anything.
- name: Fail if any job did not succeed
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "One or more jobs failed:"
echo '${{ toJSON(needs) }}'
exit 1
- run: echo "All checks passed."