-
Notifications
You must be signed in to change notification settings - Fork 179
81 lines (80 loc) · 2.67 KB
/
ci-lint-test.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
name: "CI: Lint & Test"
on: [push, pull_request]
jobs:
lint:
name: Lint
if: "!(contains(github.event.head_commit.message, '[skip_ci]'))"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
matrix:
python: ["3.10"]
steps:
- name: "[INIT] Checkout repository"
uses: actions/checkout@v4
- name: "[INIT] Install Python ${{ matrix.python }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: "[INIT] Install Poetry"
uses: snok/[email protected]
- name: "[INIT] Restore dependency cache"
id: cache-restore
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.cache/pypoetry
key: ${{ runner.os }}-py${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
- name: "[INIT] Install dependencies"
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: poetry install
- name: "[EXEC] Lint"
uses: chartboost/ruff-action@v1
# - name: Run Pre-Commit Tests 🧪
# uses: pre-commit/[email protected]
test-cover:
name: Test & Cover
if: "!(contains(github.event.head_commit.message, '[skip_ci]'))"
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
# 5 versions / years of coverage
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"]
os: [ubuntu-22.04, macos-12, windows-2022]
steps:
- name: "[INIT] Checkout repository"
uses: actions/checkout@v4
- name: "[INIT] Install Python ${{ matrix.python }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: "[INIT] Install Poetry"
uses: snok/[email protected]
- name: "[INIT] Restore dependency cache"
id: cache-restore
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.cache/pypoetry
key: ${{ runner.os }}-py${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
- name: "[INIT] Install dependencies"
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: pip install poetry && poetry install
- name: "[EXEC] Test build package"
run: poetry build
- name: "[EXEC] Unit test"
run: poetry run pytest
# - name: "[EXEC] Test"
# run: ./utils ci test --coverage
# - name: "[EXEC] Upload coverage to Codecov"
# uses: codecov/[email protected] # TODO: maybe not on every py-ver?
# with:
# fail_ci_if_error: true
# flags: ${{ matrix.os }},py${{ matrix.python }}