Skip to content

codeql: added setup for NixOS #76

codeql: added setup for NixOS

codeql: added setup for NixOS #76

Workflow file for this run

name: tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
permissions:
contents: read
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:
permissions:
contents: read
runs-on: [ self-hosted, nixos, vod2pod ]
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:
permissions:
contents: read
runs-on: [ self-hosted, nixos, vod2pod ]
needs: [check-secret]
steps:
- uses: actions/checkout@v6
- name: Build
run: nix develop -c cargo build --verbose
shell: bash
- name: Start Redis server
run: |
nix shell nixpkgs#redis -c redis-server --daemonize yes
shell: bash
- name: Run tests with secrets
run: nix develop -c cargo test --verbose
shell: bash
if: needs.check-secret.outputs.has_secrets == 'true'
- name: Run tests without secrets
run: nix develop -c cargo test --verbose -- --skip requires_api_key
shell: bash
if: needs.check-secret.outputs.has_secrets == 'false'