-
-
Notifications
You must be signed in to change notification settings - Fork 203
156 lines (151 loc) · 5.57 KB
/
main.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
156
name: Test, build and deploy
on:
push: {}
pull_request: {}
schedule:
- cron: '0 0 * * *'
env:
CI: true
NODE_VERSION: 18
jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Lint (line terminators)
if: startsWith(matrix.os, 'ubuntu')
run: "! grep 'with CRLF line terminators' <(git ls-files | file -nNf-)"
- name: Lint (unicode bidirectional control characters)
if: startsWith(matrix.os, 'ubuntu')
run: "! git grep -EIn $'[\\u2066\\u2067\\u2068\\u2069\\u202A\\u202B\\u202C\\u202D\\u202E]'"
- name: Lint (file permissions)
if: startsWith(matrix.os, 'ubuntu')
run: "! grep -Ev '^644' <(git ls-files src/ build/tasks/ | xargs stat '--format=%a %n')"
- name: NW.js cache
if: startsWith(github.ref, 'refs/tags/') != true
uses: actions/cache@v4
with:
path: build/cache/
key: nwjs-${{ matrix.os }}-${{ hashFiles('build/tasks/configs/nwjs.js') }}
- name: Install dependencies
shell: bash
run: yarn install --pure-lockfile --no-progress --non-interactive
- name: Test
shell: bash
run: |
if [[ "$(uname)" == "Linux" ]]; then
xvfb-run --auto-servernum yarn run grunt test:coverage
else
yarn run grunt test:coverage
fi
- name: I18n
if: startsWith(matrix.os, 'ubuntu')
run: yarn run grunt webpack:i18n
- name: Build
run: yarn run grunt clean:tmp_prod webpack:prod
- name: Upload coverage data
uses: codecov/codecov-action@v4
with:
name: os:${{ matrix.os }}
file: build/tmp/coverage/coverage.json
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
debug-build:
name: Debug build
if: github.repository == 'streamlink/streamlink-twitch-gui' && github.event_name == 'schedule'
needs:
- test
runs-on: ubuntu-20.04
permissions:
actions: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check previous run
run: ./.github/workflows/check-previous-run.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Prepare env vars
run: |
echo "SOURCE_DATE_EPOCH=$(git show -s --format=%ct "${GITHUB_REF}")" >> $GITHUB_ENV
- name: Install dependencies
run: |
yarn install --pure-lockfile --no-progress --non-interactive
sudo apt-get install pigz
./.github/workflows/install-wine.sh
- name: Build
run: yarn run grunt clean:tmp_debug webpack:debug
- name: Compile & package
run: yarn run grunt clean:dist dist:archive_win64:archive_osx64:archive_linux64:debug
- name: Get file names for artifact upload
id: names
run: |
echo "archive_win64=$(basename dist/streamlink-twitch-gui-*-win64.zip)" >> $GITHUB_OUTPUT
echo "upload_win64=$(basename dist/streamlink-twitch-gui-*-win64.zip | sed 's/\.zip$//')" >> $GITHUB_OUTPUT
echo "archive_osx64=$(basename dist/streamlink-twitch-gui-*-macOS.tar.gz)" >> $GITHUB_OUTPUT
echo "upload_osx64=$(basename dist/streamlink-twitch-gui-*-macOS.tar.gz | sed 's/\.tar\.gz$//')" >> $GITHUB_OUTPUT
echo "archive_linux64=$(basename dist/streamlink-twitch-gui-*-linux64.tar.gz)" >> $GITHUB_OUTPUT
echo "upload_linux64=$(basename dist/streamlink-twitch-gui-*-linux64.tar.gz | sed 's/\.tar\.gz$//')" >> $GITHUB_OUTPUT
- name: Upload artifact (win64)
uses: actions/upload-artifact@v4
with:
name: ${{ steps.names.outputs.archive_win64 }}
path: dist/${{ steps.names.outputs.archive_win64 }}
- name: Upload artifact (osx64)
uses: actions/upload-artifact@v4
with:
name: ${{ steps.names.outputs.archive_osx64 }}
path: dist/${{ steps.names.outputs.archive_osx64 }}
- name: Upload artifact (linux64)
uses: actions/upload-artifact@v4
with:
name: ${{ steps.names.outputs.archive_linux64 }}
path: dist/${{ steps.names.outputs.archive_linux64 }}
release:
name: New release
if: github.repository == 'streamlink/streamlink-twitch-gui' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs:
- test
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Prepare env vars
run: |
echo "SOURCE_DATE_EPOCH=$(git show -s --format=%ct "${GITHUB_REF}")" >> $GITHUB_ENV
- name: Install dependencies
run: |
yarn install --pure-lockfile --no-progress --non-interactive
sudo apt-get install pigz nsis appstream{,-util}
./.github/workflows/install-wine.sh
- name: Build
run: yarn run grunt clean:tmp_prod webpack:prod
- name: Compile & package
run: yarn run grunt clean:dist dist:all
- name: Deploy
env:
RELEASES_API_KEY: ${{ secrets.GITHUB_TOKEN }}
run: yarn run grunt deploy:github