-
-
Notifications
You must be signed in to change notification settings - Fork 11
154 lines (123 loc) · 3.91 KB
/
build.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Build CI
on:
pull_request:
types: [opened, reopened]
push:
jobs:
build-wheel:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: actions/checkout@v4
- name: Build wheel
run: pip wheel -w dist --no-deps .
- name: check dist
run: pipx run twine check dist/*
- name: Archive wheel
uses: actions/upload-artifact@v4
with:
name: wheel
path: ${{ github.workspace }}/dist/
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
id: python-setup
with:
python-version: "3.x"
- uses: actions/checkout@v4
- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: '~/.cache/pre-commit'
key: pre-commit-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit and deps
run: pip install pre-commit -r requirements.txt
- name: Setup problem matchers
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1
- name: Pre-commit hooks
run: pre-commit run --all-files
test-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install testing tools
run: pip install -r requirements.txt -r tests/requirements.txt
- name: Collect coverage
run: |
coverage run -m pytest
coverage report
coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.xml
verbose: true # optional (default = false)
build-bundles:
runs-on: ubuntu-latest
steps:
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo repo-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
) >> $GITHUB_OUTPUT
- name: Translate Repo Name For Build Tools package_prefix
id: pkg-name
run: |
echo pkg-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }'
) >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Checkout tools repo
uses: actions/checkout@v4
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install deps
run: |
source actions-ci/install.sh
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --package_folder_prefix ${{ steps.pkg-name.outputs.pkg-name }} --library_location .
- name: Archive bundles
uses: actions/upload-artifact@v4
with:
name: bundles
path: ${{ github.workspace }}/bundles/
build-docs:
runs-on: ubuntu-latest
env:
QT_QPA_PLATFORM: offscreen
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install deps
run: |
pip install -r docs/requirements.txt
pip install -e .
sudo apt-get install libgl1-mesa-dev libxkbcommon-x11-0 graphviz
- name: Build docs
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
- name: Archive docs
uses: actions/upload-artifact@v4
with:
name: docs
path: ${{ github.workspace }}/docs/_build/html