Merge pull request #181 from madiele/dependabot/cargo/rust-dependenci… #523
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |