diff --git a/.github/workflows/component-common.yml b/.github/workflows/component-common.yml new file mode 100644 index 0000000000..38bae3097b --- /dev/null +++ b/.github/workflows/component-common.yml @@ -0,0 +1,32 @@ +name: Steeltoe.Common + +on: + workflow_dispatch: {} + pull_request: + paths: + - .editorconfig + - stylecop.json + - '*.props' + - '*.ruleset' + - .config/dotnet-tools.json + - .github/workflows/component-shared-workflow.yml + - .github/workflows/component-common.yml + - src/Common/** + - src/Steeltoe.Common.slnf + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linux: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Common + OS: ubuntu + + windows: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Common + OS: windows diff --git a/.github/workflows/component-configuration.yml b/.github/workflows/component-configuration.yml new file mode 100644 index 0000000000..fdb1c3d8ea --- /dev/null +++ b/.github/workflows/component-configuration.yml @@ -0,0 +1,27 @@ +name: Steeltoe.Configuration + +on: + workflow_dispatch: {} + pull_request: + paths: + - .editorconfig + - stylecop.json + - '*.props' + - '*.ruleset' + - .config/dotnet-tools.json + - .github/workflows/component-shared-workflow.yml + - .github/workflows/component-configuration.yml + - src/Configuration/** + - src/Steeltoe.Configuration.slnf + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linux: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Configuration + OS: ubuntu + runConfigServer: true diff --git a/.github/workflows/component-connectors.yml b/.github/workflows/component-connectors.yml new file mode 100644 index 0000000000..31abeaf70c --- /dev/null +++ b/.github/workflows/component-connectors.yml @@ -0,0 +1,26 @@ +name: Steeltoe.Connectors + +on: + workflow_dispatch: {} + pull_request: + paths: + - .editorconfig + - stylecop.json + - '*.props' + - '*.ruleset' + - .config/dotnet-tools.json + - .github/workflows/component-shared-workflow.yml + - .github/workflows/component-connectors.yml + - src/Connectors/** + - src/Steeltoe.Connectors.slnf + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linux: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Connectors + OS: ubuntu diff --git a/.github/workflows/component-discovery.yml b/.github/workflows/component-discovery.yml new file mode 100644 index 0000000000..abde1ad77d --- /dev/null +++ b/.github/workflows/component-discovery.yml @@ -0,0 +1,26 @@ +name: Steeltoe.Discovery + +on: + workflow_dispatch: {} + pull_request: + paths: + - .editorconfig + - stylecop.json + - '*.props' + - '*.ruleset' + - .config/dotnet-tools.json + - .github/workflows/component-shared-workflow.yml + - .github/workflows/component-discovery.yml + - src/Discovery/** + - src/Steeltoe.Discovery.slnf + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linux: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Discovery + OS: ubuntu diff --git a/.github/workflows/component-logging.yml b/.github/workflows/component-logging.yml new file mode 100644 index 0000000000..993be0717c --- /dev/null +++ b/.github/workflows/component-logging.yml @@ -0,0 +1,26 @@ +name: Steeltoe.Logging + +on: + workflow_dispatch: {} + pull_request: + paths: + - .editorconfig + - stylecop.json + - '*.props' + - '*.ruleset' + - .config/dotnet-tools.json + - .github/workflows/component-shared-workflow.yml + - .github/workflows/component-logging.yml + - src/Logging/** + - src/Steeltoe.Logging.slnf + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linux: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Logging + OS: ubuntu diff --git a/.github/workflows/component-management.yml b/.github/workflows/component-management.yml new file mode 100644 index 0000000000..24e4a61602 --- /dev/null +++ b/.github/workflows/component-management.yml @@ -0,0 +1,39 @@ +name: Steeltoe.Management + +on: + workflow_dispatch: {} + pull_request: + paths: + - .editorconfig + - stylecop.json + - '*.props' + - '*.ruleset' + - .config/dotnet-tools.json + - .github/workflows/component-shared-workflow.yml + - .github/workflows/component-management.yml + - src/Management/** + - src/Steeltoe.Management.slnf + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linux: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Management + OS: ubuntu + + macos: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Management + OS: macos + skipFilter: Category!=SkipOnMacOS + + windows: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Management + OS: windows diff --git a/.github/workflows/component-security.yml b/.github/workflows/component-security.yml new file mode 100644 index 0000000000..a9eec204f5 --- /dev/null +++ b/.github/workflows/component-security.yml @@ -0,0 +1,31 @@ +name: Steeltoe.Security + +on: + workflow_dispatch: {} + pull_request: + paths: + - .editorconfig + - stylecop.json + - '*.props' + - '*.ruleset' + - .config/dotnet-tools.json + - .github/workflows/component-shared-workflow.yml + - .github/workflows/component-security.yml + - src/Security/** + - src/Steeltoe.Security.slnf + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linux: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Security + OS: ubuntu + windows: + uses: ./.github/workflows/component-shared-workflow.yml + with: + component: Security + OS: windows diff --git a/.github/workflows/component-shared-workflow.yml b/.github/workflows/component-shared-workflow.yml new file mode 100644 index 0000000000..e22bbd355f --- /dev/null +++ b/.github/workflows/component-shared-workflow.yml @@ -0,0 +1,113 @@ +# .github/workflows/component-shared-workflow.yml + +name: Component Build + +on: + workflow_call: + inputs: + component: + required: true + type: string + OS: + required: true + type: string + skipFilter: + required: false + type: string + runConfigServer: + required: false + type: boolean + default: false + +permissions: + contents: read + pull-requests: write + +jobs: + build: + name: Build ${{ inputs.component }} on ${{ inputs.OS }} + runs-on: ${{ inputs.OS }}-latest + + services: + eurekaServer: + image: ${{ inputs.runConfigServer && 'steeltoe.azurecr.io/eureka-server' || null }} + ports: + - 8761:8761 + configServer: + image: ${{ inputs.runConfigServer && 'steeltoe.azurecr.io/config-server' || null }} + env: + eureka.client.enabled: true + eureka.client.serviceUrl.defaultZone: http://eurekaServer:8761/eureka + eureka.instance.hostname: localhost + eureka.instance.instanceId: localhost:configServer:8888 + ports: + - 8888:8888 + + env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_GENERATE_ASPNET_CERTIFICATE: ${{ inputs.OS == 'macOS' && 'false' || '' }} + SolutionFile: src/Steeltoe.${{ inputs.component }}.slnf + CommonTestArgs: >- + --no-build --configuration Release --blame-crash --blame-hang-timeout 3m + --collect "XPlat Code Coverage" --settings coverlet.runsettings --logger trx --results-directory ${{ github.workspace }} + SkipFilterWithoutMemoryDumps: ${{ inputs.skipFilter && format('--filter "{0}&Category!=MemoryDumps"', inputs.skipFilter) || '--filter "Category!=MemoryDumps"' }} + SkipFilterWithMemoryDumps: ${{ inputs.skipFilter && format('--filter "{0}&Category=MemoryDumps"', inputs.skipFilter) || '--filter "Category=MemoryDumps"' }} + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 8.0.* + 9.0.* + + - name: Install Nerdbank.GitVersioning (macOS only) + if: ${{ inputs.OS == 'macos' }} + run: dotnet tool install --global nbgv + + - name: Set package version + run: nbgv cloud + + - name: Restore dependencies + run: dotnet restore ${{ env.SolutionFile }} --verbosity minimal + + - name: Build solution + run: dotnet build ${{ env.SolutionFile }} --no-restore --configuration Release --verbosity minimal + + - name: Test (net8.0) + run: dotnet test ${{ env.SolutionFile }} --framework net8.0 ${{ env.SkipFilterWithoutMemoryDumps }} ${{ env.CommonTestArgs }} + + - name: Test (net8.0) (memory dumps) + if: ${{ inputs.component == 'Management' }} + run: dotnet test ${{ env.SolutionFile }} --framework net8.0 ${{ env.SkipFilterWithMemoryDumps }} ${{ env.CommonTestArgs }} + + - name: Test (net9.0) + run: dotnet test ${{ env.SolutionFile }} --framework net9.0 ${{ env.SkipFilterWithoutMemoryDumps }} ${{ env.CommonTestArgs }} + + - name: dotnet test net9.0 (memory dumps) + if: ${{ inputs.component == 'Management' }} + run: dotnet test ${{ env.SolutionFile }} --framework net9.0 ${{ env.SkipFilterWithMemoryDumps }} ${{ env.CommonTestArgs }} + + - name: Upload hang dumps (on failure) + if: failure() + uses: actions/upload-artifact@v4 + with: + name: FailedTestOutput-${{ inputs.OS }} + path: '**/*.dmp' + if-no-files-found: ignore + + - name: Report test results + if: always() + uses: dorny/test-reporter@v2 + with: + name: ${{ inputs.OS }} test results + reporter: dotnet-trx + path: '**/*.trx' + fail-on-empty: 'true' + fail-on-error: 'false'