Skip to content

Test, build and deploy #1779

Test, build and deploy

Test, build and deploy #1779

Workflow file for this run

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('src/config/main.json') }}
- 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