Skip to content

Commit 4898548

Browse files
maint: build executables (#54)
1 parent 6ec2e6f commit 4898548

File tree

1 file changed

+92
-7
lines changed

1 file changed

+92
-7
lines changed

.github/workflows/ci_cd.yml

Lines changed: 92 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: "Run PyAnsys code style checks"
30-
uses: ansys/actions/code-style@v8
30+
uses: ansys/actions/code-style@v9
3131

3232
smoke-tests:
3333
name: Build and Smoke tests
@@ -44,7 +44,7 @@ jobs:
4444
os: macos-latest
4545
steps:
4646
- name: Build wheelhouse and perform smoke test
47-
uses: ansys/actions/build-wheelhouse@v8
47+
uses: ansys/actions/build-wheelhouse@v9
4848
with:
4949
library-name: ${{ env.PACKAGE_NAME }}
5050
operating-system: ${{ matrix.os }}
@@ -92,7 +92,7 @@ jobs:
9292
runs-on: ubuntu-latest
9393
steps:
9494
- name: PyAnsys documentation style checks
95-
uses: ansys/actions/doc-style@v8
95+
uses: ansys/actions/doc-style@v9
9696
with:
9797
token: ${{ secrets.GITHUB_TOKEN }}
9898

@@ -103,7 +103,7 @@ jobs:
103103
steps:
104104

105105
- name: "Run Ansys documentation building action"
106-
uses: ansys/actions/doc-build@v8
106+
uses: ansys/actions/doc-build@v9
107107
with:
108108
add-pdf-html-docs-as-assets: true
109109

@@ -114,7 +114,7 @@ jobs:
114114
needs: [docs-build]
115115
steps:
116116
- name: Deploy the latest documentation
117-
uses: ansys/actions/doc-deploy-dev@v8
117+
uses: ansys/actions/doc-deploy-dev@v9
118118
with:
119119
cname: ${{ env.DOCUMENTATION_CNAME }}
120120
token: ${{ secrets.GITHUB_TOKEN }}
@@ -131,7 +131,7 @@ jobs:
131131
steps:
132132

133133
- name: Testing
134-
uses: ansys/actions/tests-pytest@v8
134+
uses: ansys/actions/tests-pytest@v9
135135
timeout-minutes: 12
136136

137137
- name: Upload coverage results (HTML)
@@ -163,7 +163,7 @@ jobs:
163163
needs: [release]
164164
steps:
165165
- name: Deploy the stable documentation
166-
uses: ansys/actions/doc-deploy-stable@v8
166+
uses: ansys/actions/doc-deploy-stable@v9
167167
with:
168168
cname: ${{ env.DOCUMENTATION_CNAME }}
169169
token: ${{ secrets.GITHUB_TOKEN }}
@@ -229,3 +229,88 @@ jobs:
229229
platforms: linux/amd64,linux/arm64
230230
tags: |
231231
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
232+
233+
binaries:
234+
name : Create binaries
235+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
236+
needs: [release]
237+
runs-on: ${{ matrix.os }}
238+
strategy:
239+
fail-fast: false
240+
matrix:
241+
os: [windows-latest, ubuntu-latest, macos-latest]
242+
steps:
243+
- name: Checkout code
244+
uses: actions/checkout@v4
245+
246+
- name: Set up Python
247+
uses: actions/setup-python@v5
248+
with:
249+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
250+
251+
- name: Install dependencies
252+
run: pip install .[all]
253+
254+
- name: Install PyInstaller
255+
run: pip install pyinstaller
256+
257+
- name: Attempt to build executable
258+
id: first-attempt
259+
run: >
260+
pyinstaller src/allie/flowkit/__main__.py --onefile
261+
--name ${{ github.event.repository.name }}-${{ github.ref_name }}
262+
--copy-metadata ${{ github.event.repository.name }} # keep importlib.metadata working
263+
--hidden-import uvicorn --collect-all uvicorn # bring in the runtime server
264+
--distpath build/dist --workpath build/build --specpath build
265+
continue-on-error: true
266+
267+
- name: Modify spec file and retry build
268+
if: steps.first-attempt.outcome == 'failure'
269+
run: |
270+
echo "import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5)" >> ${{ github.event.repository.name }}-${{ github.ref_name }}.spec
271+
pyinstaller ${{ github.event.repository.name }}-${{ github.ref_name }}.spec
272+
273+
- name: Upload artifact
274+
uses: actions/upload-artifact@v4
275+
with:
276+
name: ${{ matrix.os }}-binaries
277+
path: dist/${{ github.event.repository.name }}-*
278+
279+
sign-windows-binary:
280+
name: Sign Windows binary
281+
needs: [binaries]
282+
runs-on:
283+
group: ansys-network
284+
labels: [self-hosted, Windows, signtool]
285+
steps:
286+
- name: Checkout the SignTool
287+
uses: actions/checkout@v4
288+
with:
289+
repository: ansys-internal/signtool-ansys-apps
290+
token: ${{ secrets.SIGNTOOL_ACCESS_TOKEN }}
291+
292+
- uses: actions/download-artifact@v4
293+
with:
294+
name: windows-latest-binaries
295+
path: signtool/installer
296+
297+
- name: List current structure
298+
run: ls -R
299+
300+
- name: Sign application
301+
working-directory: signtool
302+
run: |
303+
$filename = (get-ChildItem installer -recurse | where {$_.name -like "allie-flowkit-python*"}).Name
304+
$jobname = $filename -replace ".{4}$"
305+
.\Ansys.SignClient.exe sign `
306+
--signUrl https://csign.ansys.com `
307+
-r gh_signtool_account `
308+
-s '${{ secrets.SIGNTOOL_PWD }}' `
309+
-n $jobname `
310+
-i installer/$filename `
311+
-o installer/$filename
312+
313+
- uses: actions/upload-artifact@v4
314+
with:
315+
name: windows-latest-binaries-signed
316+
path: signtool/installer/*.exe

0 commit comments

Comments
 (0)