Repository navigation
142 lines (128 loc) · 4.17 KB
/
Copy pathunit-tests.yml
File metadata and controls
142 lines (128 loc) · 4.17 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Unit Tests
on:
pull_request:
branches:
- dev
- main
push:
branches:
- dev
- main
workflow_dispatch:
permissions:
contents: read
env:
MPLBACKEND: Agg
OMP_NUM_THREADS: "1"
MKL_NUM_THREADS: "1"
OPENBLAS_NUM_THREADS: "1"
jobs:
plan:
permissions:
contents: read
actions: read
pull-requests: read
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
cpu: ${{ steps.plan.outputs.cpu }}
plan: ${{ steps.plan.outputs.plan }}
matrix: ${{ steps.plan.outputs.matrix }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: "3.13"
- id: plan
name: Select checks and verify prior evidence
env:
GH_TOKEN: ${{ github.token }}
run: python tests/ci.py plan --kind unit
- name: Retain selection evidence
if: always()
uses: actions/upload-artifact@v7
with:
name: unit-plan-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/rpipe-ci/plan.json
if-no-files-found: error
retention-days: 7
unit:
needs: plan
if: needs.plan.outputs.cpu == 'true'
name: CPU tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Prepare evidence directory
shell: bash
run: |
mkdir -p "$RUNNER_TEMP/rpipe-test-evidence"
echo "RPIPE_TEST_RESULTS_ROOT=$RUNNER_TEMP/rpipe-test-evidence" >> "$GITHUB_ENV"
- name: Install package and pytest
shell: bash
run: >-
python -m pip install -e ".[dev,tensorboard]" "huggingface_hub==1.33.0" "datasets==5.0.0" "httpx==0.28.1" requests aiohttp Pillow
2>&1 | tee "$RPIPE_TEST_RESULTS_ROOT/install.log"
- name: Run selected offline CPU checks in one batch
shell: bash
env:
PLAN_JSON: ${{ needs.plan.outputs.plan }}
run: >-
python tests/ci.py run --kind unit
2>&1 | tee "$RPIPE_TEST_RESULTS_ROOT/offline.log"
- name: Read back optional TensorBoard events (CPU, offline)
shell: bash
run: >-
python tests/run.py --all --plan-id tensorboard-roundtrip --cost-class c1 --
tests/rpipe/flow/test_exports_curves.py::test_tensorboard_real_event_roundtrip
--basetemp "${{ runner.temp }}/pytest-tensorboard"
2>&1 | tee "$RPIPE_TEST_RESULTS_ROOT/tensorboard.log"
- name: Upload CPU test evidence
if: always()
timeout-minutes: 5
uses: actions/upload-artifact@v7
with:
name: cpu-evidence-${{ matrix.os }}-py${{ matrix.python-version }}-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}
path: ${{ runner.temp }}/rpipe-test-evidence/
if-no-files-found: error
retention-days: 7
unit-gate:
name: Unit tests
needs: [plan, unit]
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
- uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Require selected checks and bind success to the tested tree
env:
PLAN_JSON: ${{ needs.plan.outputs.plan }}
PLAN_RESULT: ${{ needs.plan.result }}
JOB_RESULT: ${{ needs.unit.result }}
run: python tests/ci.py gate --kind unit
- name: Retain successful validation receipt
uses: actions/upload-artifact@v7
with:
name: rpipe-unit-proof-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/rpipe-ci/receipt.json
if-no-files-found: error
retention-days: 7