Skip to content

feat: Add support for MiniStack #4487

feat: Add support for MiniStack

feat: Add support for MiniStack #4487

Workflow file for this run

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
permissions: read-all
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
# https://stackoverflow.com/q/53510011.
TZ: CET
jobs:
collect-test-projects:
runs-on: ubuntu-24.04
outputs:
test-projects: ${{ steps.set-test-projects.outputs.test-projects }}
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
lfs: true
- id: get-all-changed-files
name: Collect Changed Files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
- id: set-test-projects
name: Collect Test Projects
run: echo "test-projects=$(.github/scripts/Collect-TestProjects.ps1)" >> $env:GITHUB_OUTPUT
shell: pwsh
env:
ALL_CHANGED_FILES: ${{ steps.get-all-changed-files.outputs.all_changed_files }}
ci:
if: ${{ needs.collect-test-projects.outputs.test-projects != '[]' }}
needs: collect-test-projects
strategy:
max-parallel: 6
matrix:
test-projects: ${{ fromJSON(needs.collect-test-projects.outputs.test-projects) }}
runs-on: ${{ matrix.test-projects.runs-on }}
env:
# Lowest API version that GitHub runners support.
DOCKER_API_VERSION: 1.44
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
lfs: true
- name: Cache NuGet Packages
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
key: ${{ matrix.test-projects.runs-on }}-nuget-${{ hashFiles('Directory.Packages.props') }}
path: ~/.nuget/packages
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
# Windows runners often report the Docker service as started before the
# engine accepts connections, causing flaky npipe timeouts.
# Wait until the daemon answers before running anything that talks to it.
- name: Wait for Docker Daemon
run: do { docker info *> $null; Start-Sleep 2 } until ($LASTEXITCODE -Eq 0)
shell: pwsh
timeout-minutes: 10
- name: Restore NuGet Packages
run: ./build.sh --target=Restore-NuGet-Packages
shell: bash
- name: Run Build
run: ./build.sh --target=Build --test-project=${{ matrix.test-projects.name }}
shell: bash
- name: Run Tests
run: ./build.sh --target=Test --test-project=${{ matrix.test-projects.name }}
shell: bash
- name: Upload Test And Coverage Results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: ${{ matrix.test-projects.name }}
path: test-results
cd:
if: ${{ github.repository == 'testcontainers/testcontainers-dotnet' && contains(fromJson('["develop", "main"]'), github.ref_name) }}
needs: ci
environment: production
permissions:
actions: read
pull-requests: read
artifact-metadata: write
attestations: write
contents: write
id-token: write
runs-on: ubuntu-24.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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
lfs: true
fetch-depth: 0
- name: Download Test And Coverage Results
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
key: ubuntu-24.04-nuget-${{ hashFiles('Directory.Packages.props') }}
path: ~/.nuget/packages
- name: Setup Java
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: temurin
java-version: 21
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
- name: Restore NuGet Packages
run: ./build.sh --target=Restore-NuGet-Packages
shell: bash
- name: Run Sonar Analysis
run: ./build.sh --target=Sonar-Begin
shell: bash
- name: Run Build
run: ./build.sh --target=Build
shell: bash
- name: Upload Sonar Results
run: ./build.sh --target=Sonar-End
shell: bash
- name: Publish NuGet Package
run: ./build.sh --target=Publish
shell: bash
- name: Attest
if: ${{ env.PUBLISH_NUGET_PACKAGE == 'true' }}
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-path: artifacts/**/nuget/Testcontainers*.nupkg
# Cake sets the semVer environment variable.
- name: Draft Release
uses: release-drafter/release-drafter@34d80673e067bdc0c24568d3af899c216adcfaa9 # v7.7.0
with:
version: ${{ env.semVer }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}