-
Notifications
You must be signed in to change notification settings - Fork 4
140 lines (124 loc) · 5.39 KB
/
ci_test-full.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
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
name: Test full
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the main branch
push:
branches: [main, "release/*"]
paths:
- "setup.*" # setup.py/cfg
- "requirements.txt"
- "pyproject.toml"
- ".codecov.yml"
- "tests/**"
- "src/**"
- "requirements/**"
- ".github/workflows/ci_test-full.yml"
- ".actions/**"
pull_request:
branches: [main, "release/*"]
types: [opened, reopened, ready_for_review, synchronize]
paths:
- "setup.*" # setup.py/cfg
- "requirements.txt"
- "pyproject.toml"
- ".codecov.yml"
- "tests/**"
- "src/**"
- "requirements/**"
- ".github/workflows/ci_test-full.yml"
- ".actions/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }}
jobs:
cpu:
runs-on: ${{ matrix.os }}
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022, macOS-14]
python-version: ["3.9", "3.12"] # minimum, maximum
# tests will include oldest and newest tested patch versions of pytorch
requires: ["oldest", "latest"]
release: ["latest"]
exclude: # note that occasionally, the oldest PyTorch version does not support the latest python version
- {os: ubuntu-22.04, python-version: "3.12", requires: "oldest"}
- {os: windows-2022, python-version: "3.12", requires: "oldest"}
- {os: macOS-14, python-version: "3.12", requires: "oldest"}
- {os: macOS-14, python-version: "3.9", requires: "oldest"} # exclude until 2.6 due to tokenizers build error
# include:
# # adding when using a release candidate
# # - {os: ubuntu-22.04, python-version: "3.12", requires: "latest", release: "pre"}
timeout-minutes: 90
env:
# TODO: Remove this and enable running MPS tests the macos runners support it:
# https://github.com/actions/runner-images/issues/9918#issuecomment-2149336099
DISABLE_MPS: ${{ (matrix.os == 'macOS-14' && '1') || '0' }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Reset caching
run: python -c "import time; days = time.time() / 60 / 60 / 24; print(f'TIME_PERIOD=d{int(days / 2) * 2}')" >> $GITHUB_ENV
- name: basic setup
run: |
pip --version
pip install --requirement requirements/cli.txt --upgrade
- name: Set min. dependencies
if: matrix.requires == 'oldest'
run: |
python .actions/assistant.py replace_oldest_ver
# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
# sadly, this env var is not properly abstracted over OS platforms so we set it twice, the second time for windows
- name: Get pip cache dir windows
id: pip-cache
run: |
echo "PIP_CACHE_DIR=$(pip cache dir)" >> $GITHUB_OUTPUT
echo "PIP_CACHE_DIR=$(pip cache dir)" >> $env:GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.PIP_CACHE_DIR }}
key: ${{ runner.os }}-pip-td${{ env.TIME_PERIOD }}-py${{ matrix.python-version }}-${{ matrix.release }}-${{ matrix.requires }}-${{ hashFiles('requirements/base.txt') }}-${{ hashFiles('requirements/extra.txt') }}
restore-keys: |
${{ runner.os }}-pip-td${{ env.TIME_PERIOD }}-py${{ matrix.python-version }}-${{ matrix.release }}-${{ matrix.requires }}-
- name: Install extra dependencies
run: |
pip install --requirement requirements/base.txt --upgrade
pip install --requirement requirements/examples.txt --upgrade
pip install --requirement requirements/test.txt --upgrade
pip list
shell: bash
- name: Cache datasets
uses: actions/cache@v4
with:
path: Datasets
key: pl-dataset
- name: Tests
run: |
# NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003
coverage run --source src/finetuning_scheduler -m pytest src/finetuning_scheduler tests -v --durations=50 --junitxml=junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml
- name: Upload pytest results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml
if: failure()
- name: Statistics
if: success()
run: |
coverage report
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: coverage.xml
flags: cpu,pytest,python${{ matrix.python-version }}
name: CPU-coverage
fail_ci_if_error: false
verbose: true # optional (default = false)