Skip to content

Merge branch 'main' into copilot/add-testcontainers-dotnet-skill #63

Merge branch 'main' into copilot/add-testcontainers-dotnet-skill

Merge branch 'main' into copilot/add-testcontainers-dotnet-skill #63

Workflow file for this run

name: Test Skills
on:
push:
branches: [ main, copilot/** ]
paths:
- 'plugins/testcontainers/**'
- '.github/workflows/test-skills.yml'
pull_request:
branches: [ main ]
paths:
- 'plugins/testcontainers/**'
- '.github/workflows/test-skills.yml'
jobs:
detect-changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
go: ${{ steps.filter.outputs.go }}
dotnet: ${{ steps.filter.outputs.dotnet }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Check for file changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
go:
- 'plugins/testcontainers/skills/testcontainers-go/**'
- '.github/workflows/test-skills.yml'
dotnet:
- 'plugins/testcontainers/skills/testcontainers-dotnet/**'
- '.github/workflows/test-skills.yml'
test-testcontainers-go:
name: Test testcontainers-go examples
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.go == 'true'
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: plugins/testcontainers/skills/testcontainers-go/examples/go.mod
cache-dependency-path: plugins/testcontainers/skills/testcontainers-go/examples/go.sum
- name: Verify examples compile
working-directory: plugins/testcontainers/skills/testcontainers-go/examples
run: |
echo "Building all Go test files..."
go build -v ./...
echo "✅ All examples compiled successfully!"
- name: Download dependencies
working-directory: plugins/testcontainers/skills/testcontainers-go/examples
run: |
echo "Downloading Go module dependencies..."
go mod download
go mod verify
echo "✅ Dependencies verified!"
- name: Run Go vet
working-directory: plugins/testcontainers/skills/testcontainers-go/examples
run: |
echo "Running go vet..."
go vet ./...
echo "✅ Go vet passed!"
- name: Check formatting
working-directory: plugins/testcontainers/skills/testcontainers-go/examples
run: |
echo "Checking Go formatting..."
if [ -n "$(gofmt -l .)" ]; then
echo "❌ Go files are not formatted. Please run 'gofmt -w .'"
gofmt -l .
exit 1
fi
echo "✅ All files are properly formatted!"
- name: Set up Docker
run: |
echo "Docker is available in GitHub Actions runners by default"
docker --version
- name: Run tests
working-directory: plugins/testcontainers/skills/testcontainers-go/examples
run: |
echo "Running Go tests..."
# Run tests with a timeout since they involve container operations
# Tests will automatically pull required Docker images
go test -v -timeout 10m ./...
echo "✅ All tests passed!"
test-testcontainers-dotnet:
name: Test testcontainers-dotnet examples
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.dotnet == 'true'
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up .NET
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4.1.0
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
working-directory: plugins/testcontainers/skills/testcontainers-dotnet/examples
run: |
echo "Restoring .NET dependencies..."
dotnet restore
echo "✅ Dependencies restored!"
- name: Build examples
working-directory: plugins/testcontainers/skills/testcontainers-dotnet/examples
run: |
echo "Building .NET test project..."
dotnet build --no-restore --configuration Release
echo "✅ Build successful!"
- name: Set up Docker
run: |
echo "Docker is available in GitHub Actions runners by default"
docker --version
- name: Run tests
working-directory: plugins/testcontainers/skills/testcontainers-dotnet/examples
run: |
echo "Running .NET tests..."
# Run tests with verbose output and a timeout since they involve container operations
# Tests will automatically pull required Docker images
dotnet test --no-build --configuration Release --logger "console;verbosity=detailed" --blame-hang-timeout 10m
echo "✅ All tests passed!"