Fix CI test artifact permissions #2
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
| # Continuous Integration workflow. | |
| # | |
| # This workflow runs on every push and pull request to main branch: | |
| # 1. Builds the solution using the reusable build workflow | |
| # 2. Runs all tests using the pre-built artifacts | |
| # | |
| # Tests run against all target frameworks (.NET 8, 9, 10) to ensure | |
| # compatibility across supported versions. | |
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| # Cancel in-progress runs when a new run is triggered for the same branch/PR. | |
| # This prevents resource conflicts and saves CI minutes. | |
| # Reference: https://docs.github.com/en/actions/using-jobs/using-concurrency | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Restrict default permissions for security | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Build the solution using the reusable workflow | |
| build: | |
| uses: ./.github/workflows/build.yml | |
| with: | |
| configuration: Debug | |
| upload_artifacts: true | |
| # Run tests using the pre-built artifacts | |
| test: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| 10.0.x | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-output-Debug | |
| - name: Restore dependencies | |
| # Restore is required even with --no-build so the test runner can locate packages | |
| run: dotnet restore VastAI.NET.slnx | |
| - name: Restore xUnit v3 test app permissions | |
| # GitHub artifact downloads do not preserve executable bits. xUnit v3 test projects are | |
| # launched as test executables by the VSTest adapter, so Linux runners need this restored. | |
| run: find tests -path "*/bin/Debug/net10.0/*" -type f -name "*.Tests" -exec chmod +x {} \; | |
| - name: Run tests | |
| run: dotnet test VastAI.NET.slnx --no-build --verbosity normal --logger trx --results-directory ./test-results | |
| - name: Upload test results | |
| # Upload test results even if tests fail for debugging purposes | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: ./test-results | |
| retention-days: 7 |