|
| 1 | +name: test |
| 2 | +run-name: Run tests |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | +jobs: |
| 11 | + tests: |
| 12 | + name: CMake ${{ matrix.cmake }} |
| 13 | + runs-on: ubuntu-latest |
| 14 | + container: ghcr.io/lecrisut/dev-env:main |
| 15 | + continue-on-error: ${{ matrix.experimental || false }} |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + cmake: ["3.20", "latest", "latestrc"] |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + # Note: Proper solution is: https://github.com/actions/runner/issues/2033#issuecomment-1598547465 |
| 25 | + - name: Temporary fix for git permissions |
| 26 | + run: | |
| 27 | + git config --global --add safe.directory "*" |
| 28 | + git config --global user.email "[email protected]" |
| 29 | + git config --global user.name "GitHub Actions Bot" |
| 30 | + - uses: actions/setup-python@v5 |
| 31 | + with: |
| 32 | + python-version: 3.x |
| 33 | + # TODO: This will be migrated to standalone actions |
| 34 | + - name: Setup tmt environment |
| 35 | + run: dnf install -y tmt tmt+report-junit |
| 36 | + - uses: lukka/get-cmake@latest |
| 37 | + with: |
| 38 | + cmakeVersion: ${{ matrix.cmake }} |
| 39 | + - name: Build and test native CMake |
| 40 | + run: | |
| 41 | + # Not running presets because of minimum CMake version being tested |
| 42 | + cmake -B ./build |
| 43 | + ctest --test-dir ./build --output-on-failure |
| 44 | + echo "CMakeExtraUtils_ROOT=$(pwd)/build" >> $GITHUB_ENV |
| 45 | + # TODO: This will be migrated to standalone actions |
| 46 | + - name: Run tmt tests |
| 47 | + run: > |
| 48 | + tmt --root ./test run --all provision -h local report -h junit --file report.xml |
| 49 | + - name: Upload Test Results |
| 50 | + if: always() |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: JUnit-CMake-${{ matrix.cmake }} |
| 54 | + path: report.xml |
| 55 | + report: |
| 56 | + name: Report JUnit |
| 57 | + needs: [ tests ] |
| 58 | + permissions: |
| 59 | + contents: read |
| 60 | + checks: write |
| 61 | + pull-requests: write |
| 62 | + runs-on: ubuntu-latest |
| 63 | + steps: |
| 64 | + - name: Download test results |
| 65 | + uses: actions/download-artifact@v4 |
| 66 | + - name: Publish Test Results |
| 67 | + uses: EnricoMi/publish-unit-test-result-action@v2 |
| 68 | + with: |
| 69 | + files: "*/report.xml" |
| 70 | + large_files: true |
| 71 | + report_individual_runs: true |
| 72 | + report_suite_logs: any |
| 73 | + if: always() |
0 commit comments