-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (130 loc) · 5.08 KB
/
Copy pathtest-skills.yml
File metadata and controls
149 lines (130 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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!"