test: Run test projects parallel #2954
Workflow file for this run
This file contains 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: Continuous Integration & Delivery | |
on: | |
push: | |
branches: [ develop, main, bugfix/*, feature/* ] | |
pull_request: | |
branches: [ develop, main ] | |
workflow_dispatch: | |
inputs: | |
publish_nuget_package: | |
description: Publish a new NuGet package? | |
required: false | |
type: boolean | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }} | |
cancel-in-progress: true | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_NOLOGO: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_USE_POLLING_FILE_WATCHER: true | |
NUGET_XMLDOC_MODE: skip | |
TZ: CET # https://stackoverflow.com/q/53510011 | |
jobs: | |
ci: | |
strategy: | |
max-parallel: 6 | |
matrix: | |
test-projects: [ | |
{ name: "Testcontainers", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Platform.Linux", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Platform.Windows", runs-on: "windows-2022" }, | |
{ name: "Testcontainers.Databases", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.ResourceReaper", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.ActiveMq", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.ArangoDb", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Azurite", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.BigQuery", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Bigtable", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.ClickHouse", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.CockroachDb", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Consul", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.CosmosDb", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Couchbase", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.CouchDb", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.DynamoDb", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Elasticsearch", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.EventStoreDb", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.FakeGcsServer", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.FirebirdSql", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Firestore", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.InfluxDb", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.JanusGraph", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.K3s", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Kafka", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Keycloak", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Kusto", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.LocalStack", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.MariaDb", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Milvus", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Minio", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.MongoDb", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.MsSql", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.MySql", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Nats", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Neo4j", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Oracle", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Papercut", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.PostgreSql", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.PubSub", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Pulsar", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.RabbitMq", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.RavenDb", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Redis", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.Redpanda", runs-on: "ubuntu-22.04" }, | |
{ name: "Testcontainers.WebDriver", runs-on: "ubuntu-22.04" } | |
] | |
runs-on: ${{ matrix.test-projects.runs-on }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Cache NuGet Packages | |
uses: actions/cache@v4 | |
with: | |
key: ${{ matrix.test-projects.runs-on }}-nuget-${{ hashFiles('Directory.Packages.props') }} | |
path: ~/.nuget/packages | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
- name: Restore .NET Tools | |
run: dotnet tool restore | |
- name: Restore NuGet Packages | |
run: dotnet cake --target=Restore-NuGet-Packages | |
- name: Run Build | |
run: dotnet cake --target=Build | |
- name: Run Tests | |
run: dotnet cake --target=Test --test-project=${{ matrix.test-projects.name }} | |
- name: Upload Test And Coverage Results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: ${{ matrix.test-projects.name }} | |
path: test-results | |
cd: | |
if: ${{ contains(fromJson('["develop", "main"]'), github.ref_name) }} | |
needs: ci | |
environment: production | |
permissions: | |
contents: write | |
pull-requests: read | |
runs-on: ubuntu-22.04 | |
env: | |
CODE_SIGNING_CERTIFICATE_BASE64: ${{ secrets.CODE_SIGNING_CERTIFICATE_BASE64 }} | |
CODE_SIGNING_CERTIFICATE_PASSWORD: ${{ secrets.CODE_SIGNING_CERTIFICATE_PASSWORD }} | |
FEED_SOURCE: https://api.nuget.org/v3/index.json | |
FEED_API_KEY: ${{ secrets.FEED_API_KEY }} | |
SONARCLOUD_URL: https://sonarcloud.io | |
SONARCLOUD_ORGANIZATION: testcontainers | |
SONARCLOUD_KEY: testcontainers_testcontainers-dotnet | |
SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} | |
PUBLISH_NUGET_PACKAGE: ${{ inputs.publish_nuget_package }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Download Test And Coverage Results | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: Testcontainers* | |
path: test-results | |
- name: Fix Absolute Code Coverage Paths | |
run: Get-ChildItem -Path 'test-results' -Filter *.xml -Recurse | Select-Object -ExpandProperty FullName | % { (Get-Content -LiteralPath $_) -Replace 'fullPath="[A-Za-z0-9:\-\/\\]+(src|tests)', 'fullPath="${{ github.workspace }}/$1' | Set-Content -LiteralPath $_ } | |
shell: pwsh | |
- name: Cache NuGet Packages | |
uses: actions/cache@v4 | |
with: | |
key: ubuntu-22.04-nuget-${{ hashFiles('Directory.Packages.props') }} | |
path: ~/.nuget/packages | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
- name: Restore .NET Tools | |
run: dotnet tool restore | |
- name: Restore NuGet Packages | |
run: dotnet cake --target=Restore-NuGet-Packages | |
- name: Run Sonar Analysis | |
run: dotnet cake --target=Sonar-Begin | |
- name: Run Build | |
run: dotnet cake --target=Build | |
- name: Upload Sonar Results | |
run: dotnet cake --target=Sonar-End | |
- name: Publish NuGet Package | |
run: dotnet cake --target=Publish | |
# Cake sets the semVer environment variable | |
- uses: release-drafter/release-drafter@v6 | |
with: | |
version: ${{ env.semVer }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |