-
Notifications
You must be signed in to change notification settings - Fork 37
143 lines (120 loc) · 3.47 KB
/
fab-build.yml
File metadata and controls
143 lines (120 loc) · 3.47 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
143
name: fab:build
on:
pull_request:
branches:
- main
paths:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'tox.toml'
- 'requirements*.txt'
- '.github/workflows/fab-build.yml'
permissions:
contents: read
jobs:
# Linting Job
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12" # Use any stable Python version for linting
- name: Install Tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Cache Tox environments
uses: actions/cache@v3
with:
path: .tox
key: ${{ runner.os }}-tox-lint-${{ hashFiles('**/tox.toml') }}
restore-keys: |
${{ runner.os }}-tox-lint-
- name: Run Linting
run: tox -e lint
# Type Checking Job
type-check:
name: Type Check Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12" # Use any stable Python version for type checking
- name: Install Tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Cache Tox environments
uses: actions/cache@v3
with:
path: .tox
key: ${{ runner.os }}-tox-type-${{ hashFiles('**/tox.toml') }}
restore-keys: |
${{ runner.os }}-tox-type-
- name: Run Type Checks
run: tox -e type
# Testing Jobs with Matrix Strategy
test:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python-version: "3.10"
tox-env: "py310"
- python-version: "3.11"
tox-env: "py311"
- python-version: "3.12"
tox-env: "py312"
- python-version: "3.13"
tox-env: "py313"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Cache Tox environments
uses: actions/cache@v3
with:
path: .tox
key: ${{ runner.os }}-tox-${{ matrix.tox-env }}-${{ hashFiles('**/tox.toml') }}
restore-keys: |
${{ runner.os }}-tox-${{ matrix.tox-env }}-
${{ runner.os }}-tox-
- name: Run Tests
run: tox -e ${{ matrix.tox-env }}
# Upload the coverage report as an artifact
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-html-report-${{ matrix.python-version }}
path: coverage_html
# Build Job
build:
name: Build Package
runs-on: ubuntu-latest
needs:
- test # Ensure all test jobs complete successfully
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build