-
-
Notifications
You must be signed in to change notification settings - Fork 5
54 lines (49 loc) · 1.48 KB
/
rust.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
name: tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
YT_API_KEY: ${{ secrets.YT_API_KEY }}
TWITCH_SECRET: ${{ secrets.TWITCH_SECRET }}
TWITCH_CLIENT_ID: ${{ secrets.TWITCH_CLIENT_ID }}
jobs:
check-secret:
runs-on: ubuntu-latest
outputs:
has_secrets: ${{ steps.my-key-check.outputs.defined }}
steps:
- name: Check for Secret availability
id: my-key-check
shell: bash
run: |
if [ "${{ secrets.TWITCH_CLIENT_ID }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
build:
runs-on: ubuntu-latest
needs: [check-secret]
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --verbose
- name: update apt
run: sudo apt-get update
- name: Install ffmpeg and redis
run: sudo apt-get install redis-server ffmpeg
- name: Install yt-dlp
run: python3 -m pip install -U yt-dlp
- name: Start Redis server
run: redis-server --daemonize yes
- name: Run tests with secrets
run: cargo test --verbose
if: needs.check-secret.outputs.has_secrets == 'true'
- name: Run tests without secrets
run: cargo test --verbose -- --skip requires_api_key
if: needs.check-secret.outputs.has_secrets == 'false'