Cuemon CI/CD Pipeline #334
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: 🐧 Prepare Linux | |
uses: codebeltnet/jobs-dotnet-restore/.github/workflows/default.yml@v1 | |
with: | |
use-restore-cache: true | |
include-preview: true | |
# prepare_windows: | |
# name: 🪟 Prepare 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 | |
include-preview: true | |
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 }} | |
include-preview: true | |
test_linux: | |
name: call-test-linux | |
needs: [build, prepare_test, prepare_linux] | |
strategy: | |
fail-fast: false | |
matrix: | |
configuration: [Debug, Release] | |
project: ${{ fromJson(needs.prepare_test.outputs.json) }} | |
uses: codebeltnet/jobs-dotnet-test/.github/workflows/default.yml@v2 | |
with: | |
runs-on: ubuntu-24.04 | |
configuration: ${{ matrix.configuration }} | |
projects: ${{ matrix.project }} | |
restore-cache-key: ${{ needs.prepare_linux.outputs.restore-cache-key }} | |
include-preview: true | |
test_windows: | |
name: call-test-windows | |
needs: [build, prepare_test] | |
strategy: | |
fail-fast: false | |
matrix: | |
configuration: [Debug, Release] | |
project: ${{ fromJson(needs.prepare_test.outputs.json) }} | |
uses: codebeltnet/jobs-dotnet-test/.github/workflows/default.yml@v2 | |
with: | |
runs-on: windows-2022 | |
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 | |
include-preview: 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 | |
with: | |
includePreview: true | |
- 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: Restore Cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
${{ github.workspace }} | |
!${{ github.workspace }}/.git | |
~/.nuget/packages | |
key: ${{ needs.prepare_linux.outputs.restore-cache-key }} | |
restore-keys: | | |
dotnet-restore- | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: '*-${{ matrix.configuration }}' | |
merge-multiple: true | |
- name: Test with ${{ matrix.configuration }} build | |
uses: codebeltnet/dotnet-test@v4 | |
with: | |
projects: ${{ matrix.project }} | |
configuration: ${{ matrix.configuration }} | |
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@v2 | |
with: | |
organization: geekle | |
projectKey: Cuemon | |
version: ${{ needs.build.outputs.version }} | |
include-preview: true | |
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: gimlichael/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@v2 | |
with: | |
timeout-minutes: 30 | |
include-preview: true | |
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@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 }} |