Cuemon CI/CD Pipeline #20
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: Cuemon CI/CD Pipeline | |
| on: | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| configuration: | |
| type: choice | |
| description: The build configuration to use in the deploy stage. | |
| required: true | |
| default: Release | |
| options: | |
| - Debug | |
| - Release | |
| permissions: | |
| contents: read | |
| jobs: | |
| prepare_test: | |
| name: 📜 Prepare Test | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| outputs: | |
| json: ${{ steps.test-projects.outputs.result }} | |
| steps: | |
| - name: Checkout | |
| uses: codebeltnet/git-checkout@v1 | |
| - id: test-projects | |
| name: Generate matrix for test projects | |
| uses: codebeltnet/shell-globbing@v2 | |
| with: | |
| pattern: | | |
| test/**/*.csproj | |
| !test/**/Cuemon.Data.SqlClient.Tests.csproj | |
| - name: JSON output | |
| run: echo "${{ steps.test-projects.outputs.result }}" | |
| build: | |
| name: call-build | |
| strategy: | |
| matrix: | |
| configuration: [Debug, Release] | |
| uses: codebeltnet/jobs-dotnet-build/.github/workflows/default.yml@v3 | |
| with: | |
| configuration: ${{ matrix.configuration }} | |
| strong-name-key-filename: cuemon.snk | |
| secrets: | |
| GCP_TOKEN: ${{ secrets.GCP_TOKEN }} | |
| GCP_BUCKETNAME: ${{ secrets.GCP_BUCKETNAME }} | |
| pack: | |
| name: call-pack | |
| needs: [build] | |
| strategy: | |
| matrix: | |
| configuration: [Debug, Release] | |
| uses: codebeltnet/jobs-dotnet-pack/.github/workflows/default.yml@v3 | |
| with: | |
| configuration: ${{ matrix.configuration }} | |
| version: ${{ needs.build.outputs.version }} | |
| test_linux: | |
| name: call-test-linux | |
| needs: [build, prepare_test] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, ubuntu-24.04-arm] | |
| configuration: [Debug, Release] | |
| project: ${{ fromJson(needs.prepare_test.outputs.json) }} | |
| uses: codebeltnet/jobs-dotnet-test/.github/workflows/default.yml@v3 | |
| with: | |
| runs-on: ${{ matrix.os }} | |
| configuration: ${{ matrix.configuration }} | |
| projects: ${{ matrix.project }} | |
| build: true # we need to build due to xUnitv3 | |
| restore: true # we need to restore since we disabled caching | |
| test_windows: | |
| name: call-test-windows | |
| needs: [build, prepare_test] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-2025, windows-11-arm] | |
| configuration: [Debug, Release] | |
| project: ${{ fromJson(needs.prepare_test.outputs.json) }} | |
| uses: codebeltnet/jobs-dotnet-test/.github/workflows/default.yml@v3 | |
| with: | |
| runs-on: ${{ matrix.os }} | |
| configuration: ${{ matrix.configuration }} | |
| projects: ${{ matrix.project }} | |
| test-arguments: -- RunConfiguration.DisableAppDomain=true | |
| build: true # we need to build for .net48 | |
| restore: true # apparently we need to restore for .net48 | |
| integration_test: | |
| name: ⚗️ Integration Test | |
| needs: [build] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| configuration: [Debug, Release] | |
| project: [ test/**/Cuemon.Data.SqlClient.Tests.csproj ] | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: codebeltnet/git-checkout@v1 | |
| - name: Install .NET | |
| uses: codebeltnet/install-dotnet@v3 | |
| - name: Install .NET Tool - Report Generator | |
| uses: codebeltnet/dotnet-tool-install-reportgenerator@v1 | |
| - name: Spin up SQL Server test dependency for ${{ matrix.configuration }} build | |
| uses: codebeltnet/docker-compose@v1 | |
| with: | |
| command: up | |
| options: --wait | |
| env: | |
| SA_PASSWORD: ${{ secrets.SA_PASSWORD }} | |
| - name: Download Build Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: '*-${{ matrix.configuration }}' | |
| merge-multiple: true | |
| - name: Fix Linux test apphost permissions | |
| run: | | |
| echo "Ensuring xUnit v3 test apphosts are executable on Linux..." | |
| echo "Configuration: ${{ matrix.configuration }}" | |
| # Dump a bit of info for debugging | |
| find . -path "*/bin/${{ matrix.configuration }}/net*/*" -maxdepth 1 -type f -name "*Tests*" -print || true | |
| # Actually fix permissions | |
| find . -path "*/bin/${{ matrix.configuration }}/net*/*" -type f -name "*Tests*" -exec chmod +x {} + | |
| echo "Permissions fixed." | |
| shell: bash | |
| - name: Test with ${{ matrix.configuration }} build | |
| uses: codebeltnet/dotnet-test@v4 | |
| with: | |
| projects: ${{ matrix.project }} | |
| configuration: ${{ matrix.configuration }} | |
| build: true # apparently we need to due to xUnitv3 | |
| restore: true # we need to restore since we disabled caching | |
| env: | |
| CONNECTIONSTRINGS__ADVENTUREWORKS: ${{ secrets.DB_ADVENTUREWORKS }} | |
| - name: Take down SQL Server test dependency for ${{ matrix.configuration }} build | |
| uses: codebeltnet/docker-compose@v1 | |
| with: | |
| command: down | |
| sonarcloud: | |
| name: call-sonarcloud | |
| needs: [build, test_linux, test_windows, integration_test] | |
| uses: codebeltnet/jobs-sonarcloud/.github/workflows/default.yml@v3 | |
| with: | |
| organization: geekle | |
| projectKey: Cuemon | |
| version: ${{ needs.build.outputs.version }} | |
| secrets: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| codecov: | |
| name: call-codecov | |
| needs: [build, test_linux, test_windows, integration_test] | |
| uses: codebeltnet/jobs-codecov/.github/workflows/default.yml@v1 | |
| with: | |
| repository: codebeltnet/cuemon | |
| secrets: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| codeql: | |
| name: call-codeql | |
| needs: [build, test_linux, test_windows, integration_test] | |
| uses: codebeltnet/jobs-codeql/.github/workflows/default.yml@v3 | |
| with: | |
| timeout-minutes: 30 | |
| permissions: | |
| security-events: write | |
| deploy: | |
| if: github.event_name != 'pull_request' | |
| name: call-nuget | |
| needs: [build, pack, test_linux, test_windows, integration_test, sonarcloud, codecov, codeql] | |
| uses: codebeltnet/jobs-nuget-push/.github/workflows/default.yml@v2 | |
| with: | |
| version: ${{ needs.build.outputs.version }} | |
| environment: Production | |
| configuration: ${{ inputs.configuration == '' && 'Release' || inputs.configuration }} | |
| permissions: | |
| contents: write | |
| packages: write | |
| secrets: | |
| NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} |