-
Notifications
You must be signed in to change notification settings - Fork 65
213 lines (207 loc) · 7.66 KB
/
on-push-pyinstaller.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: Pyinstaller (on_push)
on:
push:
paths:
- .github/scripts/cicd/build_pyinstaller.sh
- .github/workflows/on-push-pyinstaller.yml
- runway/*
- poetry.lock
- pyproject.toml
- runway.file.spec
- runway.folder.spec
env:
AWS_DEFAULT_REGION: us-east-1
jobs:
build-pyinstaller-onefile:
name: Pyinstaller "One File" Build
strategy:
matrix:
os: [macos-12, ubuntu-latest, windows-latest]
python-version: [3.9]
runs-on: ${{ matrix.os }}
env:
OS_NAME: ${{ matrix.os }}
# pydantic binary causes a recursion error
# https://github.com/pyinstaller/pyinstaller/issues/4406
PIP_NO_BINARY: pydantic
steps:
- name: Checkout Repo (complete)
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
id: setup-python
with:
python-version: ${{ matrix.python-version }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Remove broken apt repos (ubuntu)
if: startsWith( matrix.os, 'ubuntu' )
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
- name: Install Dependencies (ubuntu)
if: startsWith( matrix.os, 'ubuntu' )
run: sudo apt-get update && sudo apt-get install sed -y
- name: Install Dependencies (windows)
if: matrix.os == 'windows-latest'
run: choco install make sed
- uses: Gr1N/setup-poetry@v8
- uses: actions/[email protected]
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure Cache Is Healthy
if: runner.os != 'Windows' && steps.cache.outputs.cache-hit == 'true'
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
- run: poetry install --extras docs -vv
- name: Run Build
run: make build-pyinstaller-file
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: pyinstaller-onefile-${{ matrix.os }}
path: artifacts
build-pyinstaller-onefolder:
name: Pyinstaller "One Folder" Build
strategy:
matrix:
os: [macos-12, ubuntu-latest, windows-latest]
python-version: [3.9]
runs-on: ${{ matrix.os }}
env:
OS_NAME: ${{ matrix.os }}
# pydantic binary causes a recursion error
# https://github.com/pyinstaller/pyinstaller/issues/4406
PIP_NO_BINARY: pydantic
steps:
- name: Checkout Repo (complete)
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
id: setup-python
with:
python-version: ${{ matrix.python-version }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Remove broken apt repos (ubuntu)
if: startsWith( matrix.os, 'ubuntu' )
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
- name: Install Dependencies (ubuntu)
if: startsWith( matrix.os, 'ubuntu' )
run: sudo apt-get update && sudo apt-get install sed -y
- name: Install Dependencies (windows)
if: matrix.os == 'windows-latest'
run: choco install make sed
- uses: Gr1N/setup-poetry@v8
- uses: actions/[email protected]
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure Cache Is Healthy
if: runner.os != 'Windows' && steps.cache.outputs.cache-hit == 'true'
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
- run: poetry install --extras docs -vv
- name: Run Build
run: make build-pyinstaller-folder
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: pyinstaller-onefolder-${{ matrix.os }}
path: artifacts
build-npm:
name: Build npm 📦
if: github.ref == 'refs/heads/master'
needs:
- build-pyinstaller-onefolder
env:
NODE_VERSION: 12
NPM_PACKAGE_NAME: '@onica/runway'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.9]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo (complete)
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: check_distance
name: Ensure Commit Is Not Tagged
continue-on-error: true
run: bash ./check_distance_from_tag.sh
working-directory: .github/scripts/cicd
- uses: actions/setup-python@v4
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-node@v4
if: steps.check_distance.outcome == 'success'
with:
always-auth: true
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org
scope: '@onica'
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Remove broken apt repos (ubuntu)
if: startsWith( matrix.os, 'ubuntu' )
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
- name: Install Dependencies (ubuntu)
if: steps.check_distance.outcome == 'success'
run: sudo apt-get update && sudo apt-get install sed tree -y
- uses: Gr1N/setup-poetry@v8
- uses: actions/[email protected]
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure Cache Is Healthy
if: runner.os != 'Windows' && steps.cache.outputs.cache-hit == 'true'
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
- run: poetry install --extras docs -vv
- name: Download Artifacts (macOS)
if: steps.check_distance.outcome == 'success'
uses: actions/download-artifact@v3
with:
name: pyinstaller-onefolder-macos-12
path: artifacts
- name: Download Artifacts (ubuntu)
if: steps.check_distance.outcome == 'success'
uses: actions/download-artifact@v3
with:
name: pyinstaller-onefolder-ubuntu-22.04
path: artifacts
- name: Download Artifacts (windows)
if: steps.check_distance.outcome == 'success'
uses: actions/download-artifact@v3
with:
name: pyinstaller-onefolder-windows-latest
path: artifacts
- name: List Artifacts
if: steps.check_distance.outcome == 'success'
run: tree artifacts/
- name: npm Prep
if: steps.check_distance.outcome == 'success'
run: make npm-prep
- name: npm pack
if: steps.check_distance.outcome == 'success'
run: |
npm pack
rm -rf artifacts && mkdir -p artifacts
find . -name 'onica-runway-*.*.*.tgz' -exec mv {} artifacts/ \;
- name: Skipped Publishing
if: steps.check_distance.outcome == 'failure'
run: echo "A pre-production version was not published because the current commit is tagged for release."
- name: Upload Artifacts
if: steps.check_distance.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: npm-pack
path: artifacts