Unit tests CI #1181
Workflow file for this run
This file contains hidden or 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: Unit tests CI | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| permissions: read-all | |
| jobs: | |
| tests: | |
| name: Execute unit tests | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, windows-latest, macos-15-intel ] # pin macos to latest x64 image | |
| steps: | |
| - name: Checkout code changes | |
| uses: actions/checkout@v6 | |
| - name: Install FFmpeg | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| # bump: ffmpeg-ci /ffmpeg-version: '([\d.]+)'/ docker:mwader/static-ffmpeg|~8.0 | |
| FF_VERSION="8.0.1" | |
| INSTALL_DIR="$HOME/ffmpeg" | |
| mkdir -p "$INSTALL_DIR" | |
| if [[ "${{ runner.os }}" == "Linux" ]]; then | |
| docker pull mwader/static-ffmpeg:$FF_VERSION | |
| CID=$(docker create mwader/static-ffmpeg:$FF_VERSION) | |
| docker cp "$CID:/ffmpeg" "$INSTALL_DIR/ffmpeg" | |
| docker cp "$CID:/ffprobe" "$INSTALL_DIR/ffprobe" | |
| docker rm "$CID" | |
| chmod +x "$INSTALL_DIR/"* | |
| elif [[ "${{ runner.os }}" == "macOS" ]]; then | |
| curl -L https://evermeet.cx/ffmpeg/ffmpeg-$FF_VERSION.zip -o ffmpeg.zip | |
| unzip ffmpeg.zip | |
| mv ffmpeg "$INSTALL_DIR/ffmpeg" | |
| curl -L https://evermeet.cx/ffmpeg/ffprobe-$FF_VERSION.zip -o ffprobe.zip | |
| unzip ffprobe.zip | |
| mv ffprobe "$INSTALL_DIR/ffprobe" | |
| chmod +x "$INSTALL_DIR/"* | |
| elif [[ "${{ runner.os }}" == "Windows" ]]; then | |
| curl -L https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$FF_VERSION-essentials_build.zip -o ffmpeg.zip | |
| unzip ffmpeg.zip | |
| mv ffmpeg-*/bin/* "$INSTALL_DIR/" | |
| fi | |
| echo "$INSTALL_DIR" >> "$GITHUB_PATH" | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 25 | |
| - name: Setup project and upload dependency graph | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| dependency-graph: generate-and-submit | |
| build-scan-publish: true | |
| build-scan-terms-of-use-url: 'https://gradle.com/help/legal-terms-of-use' | |
| build-scan-terms-of-use-agree: 'yes' | |
| - name: Execute tests | |
| shell: bash | |
| run: ./gradlew test | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v6 | |
| if: runner.os == 'Linux' | |
| with: | |
| name: coverage_report | |
| path: .qodana/code-coverage/report.xml | |
| retention-days: 1 | |
| if-no-files-found: error | |
| qodana: | |
| name: Perform Qodana analysis | |
| if: ${{ vars.QODANA_ENABLED == 'true' }} | |
| needs: tests | |
| runs-on: ubuntu-latest | |
| permissions: | |
| checks: write | |
| security-events: write | |
| steps: | |
| - name: Checkout code changes | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| fetch-depth: 0 | |
| - name: Download coverage report | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: coverage_report | |
| path: .qodana/code-coverage | |
| - name: Execute analysis | |
| uses: JetBrains/[email protected] | |
| env: | |
| QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} | |
| with: | |
| args: '--baseline,qodana.baseline.json' | |
| use-caches: false | |
| post-pr-comment: false | |
| pr-mode: false | |
| - name: Upload results to GitHub | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json |