Codebase list frei0r / lintian-fixes/main .github / workflows / test.yml
lintian-fixes/main

Tree @lintian-fixes/main (Download .tar.gz)

test.yml @lintian-fixes/mainraw · history · blame

name: ๐Ÿงช Test

on:
  push:
    paths-ignore:
      - 'doc/**'
      - '*.md'
    branches:
      - master
      - release/**

  pull_request:
    paths-ignore:
      - 'doc/**'
      - '*.md'
    branches:
      - master
      - release/**

concurrency:
  group: ${{ github.workflow }}-${{ github.ref_name }}
  cancel-in-progress: true

jobs:

  # reuse:
  #   name: ๐Ÿšจ REUSE Compliance
  #   runs-on: ubuntu-latest
  #   steps:
  #     - uses: actions/checkout@v6
  #     - uses: fsfe/reuse-action@v1

  c-lint:
    name: ๐Ÿšจ C lint
    runs-on: ubuntu-latest
    if: "!contains(github.event.pull_request.labels.*.name, 'skip-lint')"
    steps:
      - uses: actions/checkout@v6
      - uses: reviewdog/action-cpplint@master
        env:
          REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-check
          targets: --recursive src
          level: warning
          flags: --linelength=120 # Optional
          filter: "-readability/braces\
            ,-readability/casting\
            ,-readability/todo\
            ,-whitespace/comma\
            ,-whitespace/braces\
            ,-whitespace/comments\
            ,-whitespace/indent\
            ,-whitespace/newline\
            ,-whitespace/operators\
            ,-whitespace/parens\
            ,-whitespace/tab\
            ,-whitespace/end_of_line\
            ,-whitespace/line_length\
            ,-whitespace/blank_line\
            ,-whitespace/semicolon\
            ,-build/include_subdir\
            ,-build/include_order\
            ,-build/header_guard\
            "

  test-suite:
    name: ๐Ÿ”ฌ test
    needs: [c-lint]
    if: "!contains(github.event.pull_request.labels.*.name, 'skip-test')"
    strategy:
      matrix:
        compiler: [clang-14]
      fail-fast: false
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
      - uses: hendrikmuhs/ccache-action@v1.2
      - name: Cache APT packages
        uses: awalsh128/cache-apt-pkgs-action@latest
        with:
          packages: "${{ matrix.compiler }} cmake ninja-build libfreetype-dev libopencv-dev libcairo2-dev libgavl-dev"
      - name: Detect new plugins
        id: detect
        if: github.event_name == 'pull_request'
        run: |
          .github/scripts/detect-new-plugins.sh \
            "${{ github.event.pull_request.base.sha }}" \
            "${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
      - name: Print CI mode
        run: |
          echo "mode=${{ steps.detect.outputs.mode || 'full' }}"
          echo "reason=${{ steps.detect.outputs.reason || 'push event uses the full suite' }}"
      - name: ${{ matrix.compiler }} initialize cmake build
        run: |
          mkdir -p build && cd build
          cmake -G "Ninja" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ..
      - name: ${{ matrix.compiler }} run ninja build
        if: github.event_name != 'pull_request' || steps.detect.outputs.mode != 'targeted'
        run: |
          cd build && ninja
      - name: ${{ matrix.compiler }} build new plugins
        if: github.event_name == 'pull_request' && steps.detect.outputs.mode == 'targeted'
        run: |
          cd build
          cmake --build . --target ${{ steps.detect.outputs.targets }}
      - name: ${{ matrix.compiler }} analyze plugins
        if: github.event_name != 'pull_request' || steps.detect.outputs.mode != 'targeted'
        run: |
          cd test && make frei0r-asan && make check
      - name: ${{ matrix.compiler }} analyze new plugins
        if: github.event_name == 'pull_request' && steps.detect.outputs.mode == 'targeted'
        run: |
          cd test
          make frei0r-asan
          for plugin in ${{ steps.detect.outputs.plugin_paths }}; do
            ./frei0r-run -d -p "../$plugin"
          done