-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (56 loc) · 1.88 KB
/
ci.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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest]
steps:
- name: Checkout code 📂
uses: actions/checkout@v4
- name: Setup Rye 🌾
id: setup-rye
uses: eifinger/setup-rye@v3
with:
version: "0.35.0"
enable-cache: true
cache-prefix: ${{ matrix.python-version }}
- name: Pin python-version ${{ matrix.python-version }} 📌
if: steps.setup-rye.outputs.cache-hit != 'true'
run: rye pin ${{ matrix.python-version }}
- name: Set environment variable to ensure CPU-only PyTorch installation 🧠
if: steps.setup-rye.outputs.cache-hit != 'true'
run: echo "TORCH_CUDA_VERSION=" >> $GITHUB_ENV
- name: Install dependencies 🛠️
if: steps.setup-rye.outputs.cache-hit != 'true'
run: |
rye sync --no-lock
- name: Cache pre-commit 📦
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit 🚦
run: |
rye run pre-commit run --all-files --show-diff-on-failure --color always
- name: Run tests 🧪
run: |
rye test
- name: Upload coverage report to Codecov 📈
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests