Skip to content

Commit cceb318

Browse files
committed
Add CI workflow
This commit adds a GitHub Actions CI workflow to automate the process of building and publishing the Python wheels. Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
1 parent e846950 commit cceb318

File tree

2 files changed

+142
-0
lines changed

2 files changed

+142
-0
lines changed

.github/workflows/ci.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- v*-branch
8+
pull_request:
9+
branches:
10+
- main
11+
- v*-branch
12+
workflow_call:
13+
14+
concurrency:
15+
group: ${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
name: Build (Python ${{ matrix.target.python }}, ${{ matrix.arch }})
21+
runs-on: ${{ matrix.target.builder }}
22+
23+
defaults:
24+
run:
25+
shell: bash
26+
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
target:
31+
# Python 3.6
32+
- python: '3.6'
33+
builder: windows-2019
34+
toolset: '14.25' # Visual Studio 2019
35+
winsdk: '10.0.14393.0' # Windows 10 1607
36+
# Python 3.7
37+
- python: '3.7'
38+
builder: windows-2019
39+
toolset: '14.25' # Visual Studio 2019
40+
winsdk: '10.0.14393.0' # Windows 10 1607
41+
# Python 3.8
42+
- python: '3.8'
43+
builder: windows-2019
44+
toolset: '14.25' # Visual Studio 2019
45+
winsdk: '10.0.14393.0' # Windows 10 1607
46+
# Python 3.9
47+
- python: '3.9'
48+
builder: windows-2019
49+
toolset: '14.25' # Visual Studio 2019
50+
winsdk: '10.0.14393.0' # Windows 10 1607
51+
# Python 3.10
52+
- python: '3.10'
53+
builder: windows-2022
54+
toolset: '14.33' # Visual Studio 2022
55+
winsdk: '10.0.17763.0' # Windows 10 1809
56+
arch:
57+
- x86
58+
- x64
59+
60+
steps:
61+
- name: Set up Python
62+
uses: actions/setup-python@v4
63+
with:
64+
python-version: ${{ matrix.target.python }}
65+
architecture: ${{ matrix.arch }}
66+
67+
- name: Check Python version
68+
run: |
69+
set -x
70+
python --version
71+
pip --version
72+
python -c "import platform; print(platform.architecture())"
73+
74+
- name: Install Python dependencies
75+
run: |
76+
pip install --user setuptools wheel
77+
78+
- name: Set up Visual Studio Build Tools
79+
uses: ilammy/msvc-dev-cmd@v1
80+
with:
81+
arch: ${{ matrix.arch }}
82+
sdk: ${{ matrix.target.winsdk }}
83+
toolset: ${{ matrix.target.toolset }}
84+
85+
- name: Checkout
86+
uses: actions/checkout@v3
87+
with:
88+
submodules: recursive
89+
90+
- name: Build wheel
91+
id: build-wheel
92+
run: |
93+
./build-wheels.bat ${{ matrix.target.python }}${{ matrix.arch == 'x86' && '-32' || '' }}
94+
ls -l dist
95+
files=(dist/*.whl)
96+
filename=$(basename ${files[0]})
97+
echo "filename=${filename}" >> $GITHUB_OUTPUT
98+
99+
- name: Test wheel
100+
run: |
101+
pip install --user dist/${{ steps.build-wheel.outputs.filename }}
102+
103+
- name: Upload build artifact
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: ${{ steps.build-wheel.outputs.filename }}
107+
path: dist/${{ steps.build-wheel.outputs.filename }}

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
ci:
12+
name: CI
13+
uses: ./.github/workflows/ci.yml
14+
15+
release:
16+
name: Release
17+
needs: [ ci ]
18+
runs-on: ubuntu-20.04
19+
20+
steps:
21+
- name: Download build artifacts
22+
uses: actions/download-artifact@v3
23+
with:
24+
path: artifacts
25+
26+
- name: Prepare release assets
27+
run: |
28+
mkdir -p assets
29+
cp artifacts/*/*.whl assets
30+
31+
- name: Upload release assets
32+
uses: softprops/action-gh-release@v1
33+
with:
34+
files: |
35+
assets/*.whl

0 commit comments

Comments
 (0)