⚗️ test new reusable workflow #284
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] | |
| paths-ignore: | |
| - .codecov/** | |
| - .docfx/** | |
| - .nuget/** | |
| - '**/*.md' | |
| 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_linux: | |
| name: call-restore-linux | |
| uses: codebeltnet/jobs-dotnet-restore/.github/workflows/default.yml@v1 | |
| with: | |
| use-restore-cache: true | |
| prepare_windows: | |
| name: call-restore-windows | |
| uses: codebeltnet/jobs-dotnet-restore/.github/workflows/default.yml@v1 | |
| with: | |
| use-restore-cache: true | |
| runs-on: windows-2022 | |
| 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 | |
| needs: [prepare_linux] | |
| strategy: | |
| matrix: | |
| configuration: [Debug, Release] | |
| uses: codebeltnet/jobs-dotnet-build/.github/workflows/default.yml@v2 | |
| with: | |
| configuration: ${{ matrix.configuration }} | |
| restore-cache-key: ${{ needs.prepare_linux.outputs.restore-cache-key }} | |
| strong-name-key-filename: cuemon.snk | |
| secrets: | |
| GCP_TOKEN: ${{ secrets.GCP_TOKEN }} | |
| GCP_BUCKETNAME: ${{ secrets.GCP_BUCKETNAME }} | |
| pack: | |
| name: call-pack | |
| needs: [prepare_linux, build] | |
| strategy: | |
| matrix: | |
| configuration: [Debug, Release] | |
| uses: codebeltnet/jobs-dotnet-pack/.github/workflows/default.yml@v2 | |
| with: | |
| configuration: ${{ matrix.configuration }} | |
| version: ${{ needs.build.outputs.version }} | |
| restore-cache-key: ${{ needs.prepare_linux.outputs.restore-cache-key }} | |
| test: | |
| name: call-test | |
| needs: [build, prepare_test, prepare_linux, prepare_windows] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, windows-2022] | |
| configuration: [Debug, Release] | |
| project: ${{ fromJson(needs.prepare_test.outputs.json) }} | |
| uses: codebeltnet/jobs-dotnet-test/.github/workflows/default.yml@v2 | |
| with: | |
| runs-on: ${{ matrix.os }} | |
| configuration: ${{ matrix.configuration }} | |
| projects: ${{ matrix.project }} | |
| restore-cache-key: ${{ matrix.os == 'ubuntu-24.04' && needs.prepare_linux.outputs.restore-cache-key || needs.prepare_windows.outputs.restore-cache-key }} | |
| test-arguments: -- RunConfiguration.DisableAppDomain=true | |
| integration_test: | |
| name: ⚗️ Integration Test | |
| needs: [build, prepare_linux] | |
| 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@v2 | |
| - 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: Test with ${{ matrix.configuration }} build | |
| uses: codebeltnet/dotnet-test@v3 | |
| with: | |
| projects: ${{ matrix.project }} | |
| configuration: ${{ matrix.configuration }} | |
| restoreCacheKey: ${{ needs.prepare_linux.outputs.restoreCacheKey }} | |
| 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,integration_test] | |
| uses: codebeltnet/jobs-sonarcloud/.github/workflows/default.yml@v1 | |
| with: | |
| organization: geekle | |
| projectKey: Cuemon | |
| version: ${{ needs.build.outputs.version }} | |
| secrets: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| codecov: | |
| name: call-codecov | |
| needs: [build,test,integration_test] | |
| uses: codebeltnet/jobs-codecov/.github/workflows/default.yml@v1 | |
| with: | |
| repository: gimlichael/Cuemon | |
| secrets: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| codeql: | |
| name: call-codeql | |
| needs: [build,test,integration_test] | |
| uses: codebeltnet/jobs-codeql/.github/workflows/default.yml@v1 | |
| permissions: | |
| security-events: write | |
| deploy: | |
| if: github.event_name != 'pull_request' | |
| name: call-nuget | |
| needs: [build, pack, test, integration_test, sonarcloud, codecov, codeql] | |
| uses: codebeltnet/jobs-nuget-push/.github/workflows/default.yml@v1 | |
| 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 }} |