forked from MicrochipTech/cryptoauthlib
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (130 loc) · 4.32 KB
/
build.yml
File metadata and controls
150 lines (130 loc) · 4.32 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
144
145
146
147
148
149
150
name: Build and deploy wheels to pypi
on:
push:
branches:
- main
tags:
- 20*
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Describe Tag & Branch Name
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/20')
id: build_names
shell: bash
run: |
cd python
echo ${GITHUB_REF#refs/tags/} >VERSION
- name: Configure Environment
shell: bash
run: |
cd python
cp ../release_notes.md .
cp -r ../lib .
cp -r ../third_party .
mkdir app
cp -r ../app/tng app
- name: Build wheels
uses: pypa/cibuildwheel@v2.23.3
with:
package-dir: python
env:
CIBW_SKIP: cp36-* cp37-* pp37-* cp38-* pp38-* *-musllinux* pp*-macosx*"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
CIBW_BEFORE_BUILD_LINUX: "yum update -y && yum install -y libusb-devel"
CIBW_BUILD_VERBOSITY: 3
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: "universal2"
# Skip trying to test arm64 builds on Intel Macs
# Latest MacOS GitHub actions runner is arm64 based
#CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64"
CMAKE_OSX_ARCHITECTURES: "arm64;x86_64"
- uses: actions/upload-artifact@v4
with:
path: wheelhouse/*.whl
name: wheelhouse-${{ matrix.os }}
overwrite: true
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.x'
- name: Describe Tag & Branch Name
id: build_names
run: |
echo TAG_NAME=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT
- name: Check if event is a tag push
id: check_tag
run: |
if [[ "${GITHUB_REF}" != refs/tags/* ]]; then
echo "This event is not a tag push. Skipping sdist build."
echo "skip_build=true" >> $GITHUB_ENV # Set an environment variable to control flow
fi
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel # Install setuptools and wheel
- name: Install USB dependencies
run: sudo apt-get update && sudo apt-get install -y libusb-1.0-0-dev libudev-dev
- name: Build sdist
if: env.skip_build != 'true'
run: |
echo ${{ env.TAG_NAME }}
cd python
echo ${{ env.TAG_NAME }} >VERSION
cp -r ../lib .
cp -r ../third_party .
mkdir app
cp -r ../app/tng app
python setup.py sdist
env:
TAG_NAME: ${{ steps.build_names.outputs.TAG_NAME }}
- uses: actions/upload-artifact@v4
if: env.skip_build != 'true'
with:
path: python/dist/*.tar.gz
name: sdist
overwrite: true
upload_pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/20')
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Download wheel artifacts
uses: actions/download-artifact@v4.1.7
with:
name: wheelhouse-${{ matrix.os }}
path: dist
- name: Download sdist artifact
uses: actions/download-artifact@v4.1.7
with:
name: sdist
path: dist
- name: Production Release
if: startsWith(github.repository, 'MicrochipTech')
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
- name: Test Release
if: ${{ !startsWith(github.repository, 'MicrochipTech') }}
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true