Skip to content

Commit 83538a0

Browse files
authored
feat: add Windows standalone archive install option (#481)
This change adds another Windows standalone "installation" option, in the form of a zip archive that contains all the files needed to run the `phylum-ci.exe` binary...which is also included in the archive. This option is not as convenient as the single file self-extracting executable since it requires an additional unzipping step. It does have the advantage of not getting flagged by antivirus.
1 parent 7462c50 commit 83538a0

File tree

4 files changed

+83
-29
lines changed

4 files changed

+83
-29
lines changed

.github/workflows/preview.yml

+28-12
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,28 @@ jobs:
9696
run: poetry publish --repository testpypi --username __token__ --password ${{ secrets.TESTPYPI_API_TOKEN }}
9797

9898
build_windows:
99-
name: Build Windows standalone binary
99+
name: Build Windows ${{ matrix.name }} binary
100100
if: inputs.CompileWindows
101101
needs: publish_preview
102102
runs-on: windows-latest
103+
strategy:
104+
fail-fast: false
105+
matrix:
106+
include:
107+
- name: standalone
108+
options: --standalone --remove-output
109+
binary: ./build/cli.dist/phylum-ci.exe
110+
artifact: ./phylum-ci.zip
111+
- name: onefile
112+
options: --onefile --onefile-tempdir-spec="{CACHE_DIR}/{PRODUCT}/{VERSION}"
113+
binary: ./build/phylum-ci.exe
114+
artifact: ./build/phylum-ci.exe
103115
steps:
104116
- name: Checkout the repo
105117
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
106118

107-
# Nuitka needs the packaged form and not the editable install Poetry provides
108-
# Ref: https://github.com/Nuitka/Nuitka/issues/2965
119+
# Nuitka needs the packaged form and not the editable install Poetry provides
120+
# Ref: https://github.com/Nuitka/Nuitka/issues/2965
109121
- name: Download build artifacts
110122
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
111123

@@ -132,13 +144,12 @@ jobs:
132144
PREVIEW_VER: ${{ needs.publish_preview.outputs.next_ver }}
133145
run: |
134146
poetry run python -m nuitka `
135-
--onefile `
147+
${{ matrix.options }} `
136148
--output-dir=build `
137149
--output-filename="phylum-ci.exe" `
138150
--include-package=phylum `
139151
--include-package-data=phylum `
140152
--include-distribution-metadata=phylum `
141-
--onefile-tempdir-spec="{CACHE_DIR}/{PRODUCT}/{VERSION}" `
142153
--product-name=phylum-ci `
143154
--product-version=${env:PREVIEW_VER} `
144155
--file-version=${env:GITHUB_RUN_NUMBER} `
@@ -153,27 +164,32 @@ jobs:
153164
--deployment `
154165
src/phylum/ci/cli.py
155166
167+
# Create the archive here because the confirmation step adds files to the source path
168+
- name: Create standalone zip archive
169+
if: matrix.name == 'standalone'
170+
run: Compress-Archive -Path ./build/cli.dist/* -DestinationPath ${{ matrix.artifact }}
171+
156172
- name: Confirm operation of binary
157173
env:
158174
PHYLUM_API_KEY: ${{ secrets.PHYLUM_TOKEN }}
159175
PHYLUM_BYPASS_CI_DETECTION: true
160176
run: |
161-
./build/phylum-ci.exe -h
162-
./build/phylum-ci.exe -vvaf
177+
${{ matrix.binary }} -h
178+
${{ matrix.binary }} -vvaf
163179
164-
- name: Upload standalone binary
180+
- name: Upload ${{ matrix.name }} artifact
165181
if: always()
166182
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
167183
with:
168-
name: phylum-ci.exe
169-
path: ./build/phylum-ci.exe
184+
name: phylum-ci-${{ matrix.name }}
185+
path: ${{ matrix.artifact }}
170186
if-no-files-found: error
171187

172188
- name: Upload compilation report
173189
if: always()
174190
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
175191
with:
176-
name: nuitka-compilation-report.xml
192+
name: nuitka-compilation-report-${{ matrix.name }}
177193
path: ./nuitka-compilation-report.xml
178194
if-no-files-found: warn
179195

@@ -182,6 +198,6 @@ jobs:
182198
if: always()
183199
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
184200
with:
185-
name: nuitka-crash-report.xml
201+
name: nuitka-crash-report-${{ matrix.name }}
186202
path: ./nuitka-crash-report.xml
187203
if-no-files-found: ignore

.github/workflows/release.yml

+38-12
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,27 @@ jobs:
131131
phylum-ci -h
132132
133133
build_windows:
134-
name: Build Windows standalone binary
134+
name: Build Windows ${{ matrix.name }} binary
135135
needs: build_dist
136136
runs-on: windows-latest
137+
strategy:
138+
fail-fast: false
139+
matrix:
140+
include:
141+
- name: standalone
142+
options: --standalone --remove-output
143+
binary: ./build/cli.dist/phylum-ci.exe
144+
artifact: ./phylum-ci.zip
145+
- name: onefile
146+
options: --onefile --onefile-tempdir-spec="{CACHE_DIR}/{PRODUCT}/{VERSION}"
147+
binary: ./build/phylum-ci.exe
148+
artifact: ./build/phylum-ci.exe
137149
steps:
138150
- name: Checkout the repo
139151
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
140152

141-
# Nuitka needs the packaged form and not the editable install Poetry provides
142-
# Ref: https://github.com/Nuitka/Nuitka/issues/2965
153+
# Nuitka needs the packaged form and not the editable install Poetry provides
154+
# Ref: https://github.com/Nuitka/Nuitka/issues/2965
143155
- name: Download build artifacts
144156
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
145157

@@ -166,13 +178,12 @@ jobs:
166178
PHYLUM_REL_VER: ${{ needs.build_dist.outputs.phylum_rel_ver_nuitka }}
167179
run: |
168180
poetry run python -m nuitka `
169-
--onefile `
181+
${{ matrix.options }} `
170182
--output-dir=build `
171183
--output-filename="phylum-ci.exe" `
172184
--include-package=phylum `
173185
--include-package-data=phylum `
174186
--include-distribution-metadata=phylum `
175-
--onefile-tempdir-spec="{CACHE_DIR}/{PRODUCT}/{VERSION}" `
176187
--product-name=phylum-ci `
177188
--product-version=${env:PHYLUM_REL_VER} `
178189
--file-version=${env:GITHUB_RUN_NUMBER} `
@@ -187,27 +198,32 @@ jobs:
187198
--deployment `
188199
src/phylum/ci/cli.py
189200
201+
# Create the archive here because the confirmation step adds files to the source path
202+
- name: Create standalone zip archive
203+
if: matrix.name == 'standalone'
204+
run: Compress-Archive -Path ./build/cli.dist/* -DestinationPath ${{ matrix.artifact }}
205+
190206
- name: Confirm operation of binary
191207
env:
192208
PHYLUM_API_KEY: ${{ secrets.PHYLUM_TOKEN }}
193209
PHYLUM_BYPASS_CI_DETECTION: true
194210
run: |
195-
./build/phylum-ci.exe -h
196-
./build/phylum-ci.exe -vvaf
211+
${{ matrix.binary }} -h
212+
${{ matrix.binary }} -vvaf
197213
198-
- name: Upload standalone binary
214+
- name: Upload ${{ matrix.name }} artifact
199215
if: always()
200216
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
201217
with:
202-
name: build
203-
path: ./build/phylum-ci.exe
218+
name: phylum-ci-${{ matrix.name }}
219+
path: ${{ matrix.artifact }}
204220
if-no-files-found: error
205221

206222
- name: Upload compilation report
207223
if: always()
208224
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
209225
with:
210-
name: nuitka-compilation-report.xml
226+
name: nuitka-compilation-report-${{ matrix.name }}
211227
path: ./nuitka-compilation-report.xml
212228
if-no-files-found: warn
213229

@@ -216,7 +232,7 @@ jobs:
216232
if: always()
217233
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
218234
with:
219-
name: nuitka-crash-report.xml
235+
name: nuitka-crash-report-${{ matrix.name }}
220236
path: ./nuitka-crash-report.xml
221237
if-no-files-found: ignore
222238

@@ -252,8 +268,18 @@ jobs:
252268
git_commit_gpgsign: true
253269
git_tag_gpgsign: true
254270

271+
- name: Download dist artifacts
272+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
273+
with:
274+
name: dist
275+
path: ./dist
276+
255277
- name: Download build artifacts
256278
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
279+
with:
280+
path: ./build
281+
pattern: phylum-ci-*
282+
merge-multiple: true
257283

258284
- name: Install poetry
259285
run: pipx install poetry==${{ env.POETRY_VERSION }}

README.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,25 @@ pipx run --spec phylum phylum-ci <options>
5050
These installation methods require Python 3.9+ to run.
5151
For a self contained environment, consider using the Docker image as described below.
5252

53-
A Windows binary, `phylum-ci.exe`, is offered as a [release artifact][latest_rels] and does not require Python to run.
54-
Simply [download the latest version][latest_artifact] and run it to access the same
55-
[`phylum-ci` script entry point features][anchor_script].
53+
Windows binaries are offered as [release artifacts][latest_rels] for a "standalone" solution that does not require
54+
Python or Docker to run. There are two options for this installation method:
55+
56+
* `phylum-ci.zip`
57+
* [Download the latest archive version][latest_zip] and extract it
58+
* Add the extracted directory to `PATH` or reference the contained `phylum-ci.exe` binary directly
59+
* `phylum-ci.exe`
60+
* [Download the latest executable version][latest_exe] and place this binary on `PATH` or reference it directly
61+
* This is a self-extracting executable that adds a version-specific directory in the local user cache
62+
63+
An advantage to the self-extracting archive is that it is a single file.
64+
A disadvantage is that the file may trigger AV since it uses a packer and is not digitally signed.
65+
66+
Either Windows "installation" method allows access to the same [`phylum-ci` script entry point features][anchor_script].
5667

5768
[pipx]: https://pypa.github.io/pipx/
5869
[latest_rels]: https://github.com/phylum-dev/phylum-ci/releases/latest
59-
[latest_artifact]: https://github.com/phylum-dev/phylum-ci/releases/latest/download/phylum-ci.exe
70+
[latest_zip]: https://github.com/phylum-dev/phylum-ci/releases/latest/download/phylum-ci.zip
71+
[latest_exe]: https://github.com/phylum-dev/phylum-ci/releases/latest/download/phylum-ci.exe
6072
[anchor_script]: #phylum-ci-script-entry-point
6173

6274
### Usage

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ commit_author = "phylum-bot <[email protected]>"
172172
logging_use_named_masks = true
173173

174174
[tool.semantic_release.publish]
175-
dist_glob_patterns = ["dist/*", "build/phylum-ci.exe"]
175+
dist_glob_patterns = ["dist/*", "build/phylum-ci.exe", "build/phylum-ci.zip"]
176176

177177
[tool.semantic_release.changelog.environment]
178178
trim_blocks = true

0 commit comments

Comments
 (0)