File tree Expand file tree Collapse file tree 6 files changed +139
-50
lines changed
Expand file tree Collapse file tree 6 files changed +139
-50
lines changed Original file line number Diff line number Diff line change 1+ name : _chapter-tests
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ chapter :
7+ required : true
8+ type : string
9+ py-versions :
10+ required : false
11+ type : string
12+ default : ' ["3.10","3.11","3.12"]'
13+
14+ jobs :
15+ test :
16+ runs-on : ubuntu-latest
17+ strategy :
18+ fail-fast : false
19+ matrix :
20+ python-version : ${{ fromJson(inputs.py-versions) }}
21+
22+ env :
23+ PYTHONPATH : ${{ github.workspace }}
24+
25+ steps :
26+ - name : Check out repository
27+ uses : actions/checkout@v4
28+
29+ - name : Set up Python
30+ uses : actions/setup-python@v5
31+ with :
32+ python-version : ${{ matrix.python-version }}
33+
34+ - name : Cache pip
35+ uses : actions/cache@v4
36+ with :
37+ path : ~/.cache/pip
38+ key : ${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }}
39+ restore-keys : |
40+ ${{ runner.os }}-py${{ matrix.python-version }}-
41+
42+ - name : Install dependencies
43+ shell : bash
44+ run : |
45+ python -m pip install --upgrade pip
46+ if [ -f "${{ inputs.chapter }}/requirements.txt" ]; then
47+ python -m pip install -r "${{ inputs.chapter }}/requirements.txt"
48+ fi
49+ if [ -f "${{ inputs.chapter }}/requirements_ch3.txt" ]; then
50+ python -m pip install -r "${{ inputs.chapter }}/requirements_ch3.txt"
51+ fi
52+ python -m pip install pytest
53+
54+ - name : Run tests
55+ run : python -m pytest -q ${{ inputs.chapter }}/tests
Original file line number Diff line number Diff line change 1+ name : ch2 tests
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ paths :
7+ - " ch2_rl_formulation/**"
8+ - " .github/workflows/ch2.yml"
9+ - " .github/workflows/_chapter-tests.yml"
10+ pull_request :
11+ branches : [ "main" ]
12+ paths :
13+ - " ch2_rl_formulation/**"
14+ - " .github/workflows/ch2.yml"
15+ - " .github/workflows/_chapter-tests.yml"
16+
17+ jobs :
18+ call :
19+ uses : ./.github/workflows/_chapter-tests.yml
20+ with :
21+ chapter : ch2_rl_formulation
Original file line number Diff line number Diff line change 1+ name : ch3 tests
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ paths :
7+ - " ch3_multi_armed_bandits/**"
8+ - " .github/workflows/ch3.yml"
9+ - " .github/workflows/_chapter-tests.yml"
10+ pull_request :
11+ branches : [ "main" ]
12+ paths :
13+ - " ch3_multi_armed_bandits/**"
14+ - " .github/workflows/ch3.yml"
15+ - " .github/workflows/_chapter-tests.yml"
16+
17+ jobs :
18+ call :
19+ uses : ./.github/workflows/_chapter-tests.yml
20+ with :
21+ chapter : ch3_multi_armed_bandits
Original file line number Diff line number Diff line change 1+ name : ch4 tests
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ paths :
7+ - " ch4_dynamic_programming/**"
8+ - " .github/workflows/ch4.yml"
9+ - " .github/workflows/_chapter-tests.yml"
10+ pull_request :
11+ branches : [ "main" ]
12+ paths :
13+ - " ch4_dynamic_programming/**"
14+ - " .github/workflows/ch4.yml"
15+ - " .github/workflows/_chapter-tests.yml"
16+
17+ jobs :
18+ call :
19+ uses : ./.github/workflows/_chapter-tests.yml
20+ with :
21+ chapter : ch4_dynamic_programming
Original file line number Diff line number Diff line change 1+ name : ch5 tests
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ paths :
7+ - " ch5_monte_carlo/**"
8+ - " .github/workflows/ch5.yml"
9+ - " .github/workflows/_chapter-tests.yml"
10+ pull_request :
11+ branches : [ "main" ]
12+ paths :
13+ - " ch5_monte_carlo/**"
14+ - " .github/workflows/ch5.yml"
15+ - " .github/workflows/_chapter-tests.yml"
16+
17+ jobs :
18+ call :
19+ uses : ./.github/workflows/_chapter-tests.yml
20+ with :
21+ chapter : ch5_monte_carlo
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments