-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (88 loc) · 3.23 KB
/
Copy pathtest-skills.yml
File metadata and controls
100 lines (88 loc) · 3.23 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
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 }}
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'
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!"