-
Notifications
You must be signed in to change notification settings - Fork 208
199 lines (171 loc) · 6.04 KB
/
main.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# This is a basic workflow to help you get started with Actions
name: build
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
- '**'
tags:
- '*.*.*'
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
TWINE_USERNAME: __token__
# Uncomment the relevant lines to switch between deployment to test.pypi.org or pypi.org
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
# TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
jobs:
prepare:
runs-on: ubuntu-22.04
outputs:
is_release_build: ${{ env.RELEASE_BUILD == '1' }}
steps:
- name: Installer list
run: |
tee pylon-installer.txt <<"EOF"
${PYLON_DOWNLOAD_URL_BASE_7_2}pylon_7.2.1.25747_x86_64_setup.tar.gz
${PYLON_DOWNLOAD_URL_BASE_7_2}pylon_7.2.1.25747_aarch64_setup.tar.gz
${PYLON_DOWNLOAD_URL_BASE}pylon_6.2.0.21487_armhf_setup.tar.gz
${PYLON_DOWNLOAD_URL_BASE}pylon-6.2.0.21487.dmg
${PYLON_DOWNLOAD_ARM64_URL_BASE}pylon_7.3.1.0006_Darwin-arm64_SDK.selfsh
EOF
- uses: actions/cache@v3
id: cache
with:
path: pylon-installer
key: pylon-installer-${{ hashFiles('pylon-installer.txt') }}
- name: Fetch installers
if: steps.cache.outputs.cache-hit != 'true'
env:
PYLON_DOWNLOAD_URL_BASE: ${{ secrets.PYLON_DOWNLOAD_URL_BASE }}
PYLON_DOWNLOAD_URL_BASE_6_2: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_6_2 }}
PYLON_DOWNLOAD_URL_BASE_6_3: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_6_3 }}
PYLON_DOWNLOAD_URL_BASE_7_2: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_7_2 }}
PYLON_DOWNLOAD_ARM64_URL_BASE: ${{ secrets.PYLON_DOWNLOAD_ARM64_URL_BASE }}
run: |
mkdir pylon-installer && cd pylon-installer
while read line; do
url=$(eval echo "$line")
echo "download $url"
curl -sSfL -O "$url"
done <../pylon-installer.txt
echo "Download result"
ls -l
md5sum *
- uses: actions/upload-artifact@v3
with:
name: pylon-installer
path: pylon-installer
- name: Check for release build
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "Build release for $GITHUB_REF"
echo "RELEASE_BUILD=1" >> $GITHUB_ENV
build-linux:
needs: prepare
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
a: [cp36m, cp37m, cp38, cp39, cp3_10, cp3_11]
p: [manylinux_2_28_x86_64, manylinux_2_28_aarch64, manylinux_2_28_armv7l]
env:
P: ${{ matrix.p }}
A: ${{ matrix.a }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: pylon-installer
path: pylon-installer
- name: Build with docker
run: |
pwd
ls
ls pylon-installer
docker run --rm --privileged multiarch/qemu-user-static:register --reset
./scripts/build/build-arch.sh --platform-tag $P --abi-tag $A --pylon-dir ./pylon-installer $ARGS
- uses: actions/upload-artifact@v3
with:
name: build-results-${{ matrix.p }}-${{ matrix.a }}
path: dist/*
- name: Upload Release Asset
if: needs.prepare.outputs.is_release_build == 'true'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
- name: Publish package to (Test)PyPI
if: needs.prepare.outputs.is_release_build == 'true' && startsWith( matrix.p, 'manylinux' )
run: |
sudo pip3 install twine
python3 -m twine upload --non-interactive --skip-existing dist/*
build-macos:
needs: prepare
runs-on: macos-11
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.6 - 3.11"
- uses: actions/download-artifact@v3
with:
name: pylon-installer
path: pylon-installer
- name: Setup pylon
run: |
# install x86_64
cd pylon-installer
hdiutil attach pylon-*.dmg
sudo installer -pkg /Volumes/pylon\ *\ Camera\ Software\ Suite/pylon-*.pkg -target /
hdiutil detach /Volumes/pylon\ *\ Camera\ Software\ Suite
# install arm64
chmod a+x pylon_7.3.1.0006_Darwin-arm64_SDK.selfsh
./pylon_7.3.1.0006_Darwin-arm64_SDK.selfsh --accept
mkdir /tmp/pylon_framework
cp -pr pylon/Frameworks/* /tmp/pylon_framework
- name: Build wheels
uses: pypa/[email protected]
env:
PYLON_FRAMEWORK_ARM64: /tmp/pylon_framework
PYLON_FRAMEWORK_X86_64: /Library/Frameworks
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
- name: Upload Release Asset
if: needs.prepare.outputs.is_release_build == 'true'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ./wheelhouse/*.whl
- name: Publish package to (Test)PyPI
if: needs.prepare.outputs.is_release_build == 'true'
run: |
sudo pip3 install twine
python3 -m twine upload --non-interactive --skip-existing wheelhouse/*
cleanup:
if: always()
needs: [
prepare,
build-linux,
build-macos
]
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v2
continue-on-error: true
with:
name: pylon-installer