Skip to content

Commit 8b40f9d

Browse files
Merge pull request #358 from fireeye/williballenthin-patch-1
ci: build via gh actions
2 parents ddc7547 + ec3dd93 commit 8b40f9d

File tree

2 files changed

+88
-2
lines changed

2 files changed

+88
-2
lines changed

floss.spec renamed to .github/pyinstaller/floss.spec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
block_cipher = None
44

55
a = Analysis(
6-
['floss/main.py'],
6+
# when invoking pyinstaller from the project root,
7+
# this gets invoked from the directory of the spec file,
8+
# i.e. ./.github/pyinstaller
9+
['../../floss/main.py'],
710
pathex=['floss'],
811
binaries=None,
912
datas=None,
@@ -156,7 +159,10 @@ exe = EXE(pyz,
156159
a.binaries,
157160
exclude_binaries=False,
158161
name='floss',
159-
icon='resources/icon.ico',
162+
# when invoking pyinstaller from the project root,
163+
# this gets invoked from the directory of the spec file,
164+
# i.e. ./.github/pyinstaller
165+
icon='../../resources/icon.ico',
160166
debug=False,
161167
strip=None,
162168
upx=True,

.github/workflows/build.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: build
2+
3+
on:
4+
release:
5+
types: [edited, published]
6+
7+
jobs:
8+
build:
9+
name: PyInstaller for ${{ matrix.os }}
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
include:
14+
- os: ubuntu-16.04
15+
# use old linux so that the shared library versioning is more portable
16+
artifact_name: floss
17+
asset_name: linux
18+
- os: windows-latest
19+
artifact_name: floss.exe
20+
asset_name: windows
21+
- os: macos-latest
22+
artifact_name: floss
23+
asset_name: macos
24+
steps:
25+
- name: Checkout floss
26+
uses: actions/checkout@v2
27+
with:
28+
submodules: true
29+
- name: Set up Python 2.7
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: 2.7
33+
- if: matrix.os == 'windows-latest'
34+
run: |
35+
choco install vcredist2008
36+
choco install --ignore-dependencies vcpython27
37+
- name: Install PyInstaller
38+
# pyinstaller 4 doesn't support Python 2.7
39+
run: pip install 'pyinstaller==3.*'
40+
- name: Install floss
41+
run: pip install -e .
42+
- name: Build standalone executable
43+
run: pyinstaller .github/pyinstaller/floss.spec
44+
- name: Does it run?
45+
run: dist/floss --help
46+
- uses: actions/upload-artifact@v2
47+
with:
48+
name: ${{ matrix.asset_name }}
49+
path: dist/${{ matrix.artifact_name }}
50+
51+
zip:
52+
name: zip ${{ matrix.asset_name }}
53+
runs-on: ubuntu-latest
54+
needs: build
55+
strategy:
56+
matrix:
57+
include:
58+
- asset_name: linux
59+
artifact_name: floss
60+
- asset_name: windows
61+
artifact_name: floss.exe
62+
- asset_name: macos
63+
artifact_name: floss
64+
steps:
65+
- name: Download ${{ matrix.asset_name }}
66+
uses: actions/download-artifact@v2
67+
with:
68+
name: ${{ matrix.asset_name }}
69+
- name: Set executable flag
70+
run: chmod +x ${{ matrix.artifact_name }}
71+
- name: Set zip name
72+
run: echo "zip_name=floss-${GITHUB_REF#refs/tags/}-${{ matrix.asset_name }}.zip" >> $GITHUB_ENV
73+
- name: Zip ${{ matrix.artifact_name }} into ${{ env.zip_name }}
74+
run: zip ${{ env.zip_name }} ${{ matrix.artifact_name }}
75+
- name: Upload ${{ env.zip_name }} to GH Release
76+
uses: svenstaro/upload-release-action@v2
77+
with:
78+
repo_token: ${{ secrets.GITHUB_TOKEN}}
79+
file: ${{ env.zip_name }}
80+
tag: ${{ github.ref }}

0 commit comments

Comments
 (0)