forked from teebr/socketsocketcan
-
Notifications
You must be signed in to change notification settings - Fork 3
119 lines (115 loc) · 3.83 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
name: socketsocketcan CI
on: [push, pull_request]
jobs:
armv7l:
name: Build armv7l wheels
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v4
- name: Build ${{ matrix.docker_images }} wheel
id: build
run: |
docker build -f Dockerfile.armv7l -t lauszus/socketsocketcan --build-arg PYTHON_VERSION="${{ matrix.python-version }}" .
docker cp "$(docker create lauszus/socketsocketcan)":/socketsocketcan-wheel .
# Copy over the wheel.
mkdir dist
cp socketsocketcan-wheel/socketsocketcan*.whl dist/
- name: Upload wheel as artifact
uses: actions/upload-artifact@v4
with:
name: socketsocketcan-armv7l-${{ matrix.python-version }}-${{ github.sha }}
path: dist
retention-days: 1
if-no-files-found: error
amd64:
name: Build amd64 wheels
runs-on: ubuntu-20.04
timeout-minutes: 5
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip3 install -U pip setuptools wheel pybind11
- name: Build amd64 ${{ matrix.python-version }} wheel
run: pip3 -v wheel --wheel-dir=socketsocketcan-wheel .
- name: Run amd64 ${{ matrix.python-version }} wheel
run: |
# Make sure the wheel is working.
pip3 install --no-index --find-links=socketsocketcan-wheel socketsocketcan
python3 -c "import socketsocketcan; print(dir(socketsocketcan))"
# Copy over the wheel.
mkdir dist
cp socketsocketcan-wheel/socketsocketcan*.whl dist/
- name: Upload wheel as artifact
uses: actions/upload-artifact@v4
with:
name: socketsocketcan-x86-${{ matrix.python-version }}-${{ github.sha }}
path: dist
retention-days: 1
if-no-files-found: error
sdist:
name: Build sdist
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: pip3 install -U pip setuptools wheel pybind11
- name: Build sdist
run: python3 setup.py sdist --formats=gztar,zip
- name: Upload sdist as artifact
uses: actions/upload-artifact@v4
with:
name: socketsocketcan-sdist-3.10-${{ github.sha }}
path: dist
retention-days: 1
if-no-files-found: error
release:
needs: [armv7l, amd64, sdist]
name: Release
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: actions/download-artifact@v4
with:
pattern: socketsocketcan-*-*-${{ github.sha }}
path: socketsocketcan
merge-multiple: true
- name: Publish to private PyPI server
if: startsWith(github.ref, 'refs/tags/')
run: |
pip3 install -U pip setuptools wheel
pip3 install -U twine
twine upload --repository-url ${{ secrets.PYPI_URL }} -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} socketsocketcan/*
- name: Calculate checksums
run: |
pushd socketsocketcan
sha256sum * > SHA256SUMS
popd
- name: Publish to Github Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: socketsocketcan/*
draft: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}