-
Notifications
You must be signed in to change notification settings - Fork 0
213 lines (183 loc) · 6.46 KB
/
ci.yml
File metadata and controls
213 lines (183 loc) · 6.46 KB
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: Build and Deploy
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
architecture: 'x64'
- name: Install
run: |
pip install -r requirements.txt
pip install flake8
pip install pytest
pip install pytest-cov
- name: Lint
run: 'flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics'
- name: Test
run: |
pytest -m "not ffmpeg" --doctest-modules \
--junitxml=junit/test-results.xml --cov=com \
--cov-report=xml --cov-report=html
- name: Build
run: pyinstaller -F --key="${{ secrets.PYINSTALLER_PASSWORD }}" -y render.spec
# " TODO: add caching for this build. The build can cache so why not use it
- name: Artifact
uses: actions/upload-artifact@v2
with:
name: ubuntu-latest
path: dist
# - name: Not Master
# if: github.ref != 'refs/heads/master'
# run: |
# echo "not running from master"
# exit 1
- name: Get Change
id: changes
run: |
echo "# ${{ github.ref }}" > changes.txt
sed -n \
"$(sed -n '/^## /=' CHANGELOG.md | sed -n '1'p),$(sed -n '/^## /=' CHANGELOG.md | sed -n '2'p)"p \
CHANGELOG.md > tmp_changes.txt
VERSION=$(head -1 tmp_changes.txt | cut -d '[' -f 2 | cut -d ']' -f 1)
if [ "refs/tags/v$VERSION" != "${{ github.ref }}" ]; then
echo $VERSION
echo "${{ github.ref }}"
echo "changelog version mismatch";
exit 1;
fi
cat tmp_changes.txt | head -n -1 >> changes.txt
echo ::set-output name=log::$(cat changes.txt)
- name: Upload change
uses: actions/upload-artifact@v2
with:
name: changes
path: changes.txt
build:
needs: test
strategy:
fail-fast: true
matrix:
os: [macos-latest, windows-latest]
max-parallel: 3
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
- name: Install
run: pip install -r requirements.txt
- name: Build
env:
PACKAGE_DLL: ${{ startsWith(matrix.os, 'windows') }}
run: pyinstaller -F --key="${{ secrets.PYINSTALLER_PASSWORD }}" -y render.spec
# "
- name: Sign Windows
if: startsWith(matrix.os, 'windows')
env:
CSC_LINK: ${{ secrets.CERTIFICATE_WINDOWS_PFX }}
CSC_KEY_PASSWORD: ${{ secrets.WINDOWS_PFX_PASSWORD }}
SIGN_TOOL: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe"
SHA1: ${{ secrets.WINDOWS_PFX_SHA1 }}
TIMESTAMP_SERVER: "http://timestamp.digicert.com"
run: |
touch windows.pfx; `
echo ${{ secrets.CERTIFICATE_WINDOWS_PFX }} > ".\windows.pfx"; `
cat ".\windows.pfx"; `
certutil -f -p "${{ secrets.WINDOWS_PFX_PASSWORD }}" -importpfx ".\windows.pfx"; `
& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\signtool.exe" `
sign /sm /debug /v /sha1 "${{ secrets.WINDOWS_PFX_SHA1 }}" /t "${{ env.TIMESTAMP_SERVER }}" .\dist\render.exe
- name: Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}
path: dist
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Get Changes
uses: actions/download-artifact@v2
with:
name: changes
- name: Get deployment refs
id: get_source
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
# body: ${{ steps.changes.outputs.log }}
body_path: changes.txt
# body: ${{ needs.build.outputs.log }}
# echo ::set-env name=FOO::$(echo -n "hello world")
draft: false
prerelease: false
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
source_tag: ${{ steps.get_source.outputs.SOURCE_TAG }}
upload:
needs: release
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
max-parallel: 3
steps:
- uses: actions/download-artifact@v2
with:
name: ${{ matrix.os }}
- name: chmod
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
run: chmod +x render
- name: Upload Linux Asset
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: render
asset_name: render-linux
asset_content_type: application/x-executable
- name: Upload Mac Asset
if: startsWith(matrix.os, 'macos')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: render
asset_name: render-mac
asset_content_type: application/x-executable
- name: Upload Windows Asset
if: startsWith(matrix.os, 'windows')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: render.exe
asset_name: render-windows
asset_content_type: application/x-executable