This repository has been archived by the owner on Nov 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
155 lines (126 loc) · 3.81 KB
/
test-build-release.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
name: Test, build and release
on: [push]
jobs:
# test with pytest
test:
name: pytest
runs-on: ubuntu-latest
container:
image: eccentricorange/npbc:test
steps:
- uses: actions/checkout@v2
- run: pytest
env:
LD_LIBRARY_PATH: /usr/local/lib
NPBC_DATABASE_DIR: data
# build executable for linux
build-linux:
name: build for linux
runs-on: ubuntu-latest
needs: test
# run only if we're on a tag beginning with 'v' ('v1.2.5', for example)
if: startsWith(github.ref, 'refs/tags/v')
steps:
# setup
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: |
pip install pyinstaller
mkdir bin
mkdir build
# build
- run: |
pyinstaller --distpath bin --clean --onefile --name npbc_updater-linux-x64 npbc_updater.py
pip install -r requirements.txt
pyinstaller --distpath bin --clean --add-data "data/schema.sql:." --onefile --name npbc_cli-linux-x64 npbc_cli.py
# upload artifacts
- uses: actions/upload-artifact@v2
with:
path: bin
name: npbc_cli-linux-x64
- uses: actions/upload-artifact@v2
with:
path: bin
name: npbc_updater-linux-x64
# build executable for windows
build-windows:
name: build for windows
runs-on: windows-latest
needs: test
# run only if we're on a tag beginning with 'v' ('v1.2.5', for example)
if: startsWith(github.ref, 'refs/tags/v')
steps:
# setup
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: |
pip install pyinstaller
mkdir bin
mkdir build
# build
- run: |
pyinstaller --distpath bin --clean --onefile --name npbc_updater-windows-x64 npbc_updater.py
pip install -r requirements.txt
pyinstaller --distpath bin --clean --add-data "data/schema.sql;." --onefile --name npbc_cli-windows-x64 npbc_cli.py
# upload artifacts
- uses: actions/upload-artifact@v2
with:
path: bin
name: npbc_cli-windows-x64
- uses: actions/upload-artifact@v2
with:
path: bin
name: npbc_updater-windows-x64
# build executable for macos
build-macos:
name: build for macos
runs-on: macos-latest
needs: test
# run only if we're on a tag beginning with 'v' ('v1.2.5', for example)
if: startsWith(github.ref, 'refs/tags/v')
steps:
# setup
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: |
pip install pyinstaller
mkdir bin
mkdir build
# build
- run: |
pyinstaller --distpath bin --clean --onefile --name npbc_updater-macos-x64 npbc_updater.py
pip install -r requirements.txt
pyinstaller --distpath bin --clean --add-data "data/schema.sql:." --onefile --name npbc_cli-macos-x64 npbc_cli.py
# upload artifacts
- uses: actions/upload-artifact@v2
with:
path: bin
name: npbc_cli-macos-x64
- uses: actions/upload-artifact@v2
with:
path: bin
name: npbc_updater-macos-x64
# create release from tag
release:
# ensure that build is complete for all platforms
needs:
- build-linux
- build-macos
- build-windows
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# download the artifacts
- run: mkdir bin
- uses: actions/download-artifact@v2
with:
path: bin
# do the release
- uses: ncipollo/release-action@v1
with:
artifacts: "bin/npbc*/*"
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
artifactErrorsFailBuild: false
prerelease: false