Skip to content

Commit 0cbf9de

Browse files
committed
disable windows + ci/cd optimizations
1 parent e7d2a09 commit 0cbf9de

1 file changed

Lines changed: 48 additions & 168 deletions

File tree

Lines changed: 48 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -1,178 +1,87 @@
11
name: Integration Tests
2-
32
on:
43
push:
54
pull_request:
65
workflow_dispatch:
7-
86
jobs:
97
integration-tests:
10-
name: Integration Tests - ${{ matrix.os }}
11-
runs-on: ${{ matrix.os }}
12-
strategy:
13-
fail-fast: false
14-
matrix:
15-
os: [ubuntu-latest, windows-latest]
16-
8+
name: Integration Tests
9+
runs-on: ubuntu-latest
1710
steps:
1811
- name: Checkout code
1912
uses: actions/checkout@v4
20-
2113
- name: Set up Go
2214
uses: actions/setup-go@v5
2315
with:
2416
go-version: '1.21'
17+
cache: true
2518
cache-dependency-path: integration-test/go.sum
26-
27-
- name: Set up Docker (Linux)
28-
if: runner.os == 'Linux'
19+
- name: Cache Go modules
20+
uses: actions/cache@v3
21+
with:
22+
path: |
23+
~/.cache/go-build
24+
~/go/pkg/mod
25+
key: ${{ runner.os }}-go-${{ hashFiles('integration-test/go.sum') }}
26+
restore-keys: |
27+
${{ runner.os }}-go-
28+
- name: Set up Docker
2929
uses: docker/setup-buildx-action@v3
30-
31-
- name: Set up Docker (Windows)
32-
if: runner.os == 'Windows'
33-
run: |
34-
Write-Host "Checking Docker version..."
35-
docker version
36-
37-
Write-Host "Checking Docker daemon info..."
38-
docker info
39-
40-
$osType = docker info --format '{{.OSType}}'
41-
Write-Host "Current OSType: $osType"
42-
43-
if ($osType -ne "linux") {
44-
Write-Host "Docker is in Windows mode, switching to Linux mode..."
45-
46-
# Stop Docker service
47-
Stop-Service -Name docker -Force -ErrorAction SilentlyContinue
48-
49-
# Wait for service to stop
50-
Start-Sleep -Seconds 5
51-
52-
# Start Docker service
53-
Start-Service -Name docker
54-
55-
# Wait for Docker to be ready
56-
$maxAttempts = 30
57-
$attempt = 0
58-
while ($attempt -lt $maxAttempts) {
59-
try {
60-
docker info | Out-Null
61-
Write-Host "Docker is ready"
62-
break
63-
} catch {
64-
$attempt++
65-
Write-Host "Waiting for Docker to be ready... (attempt $attempt/$maxAttempts)"
66-
Start-Sleep -Seconds 2
67-
}
68-
}
69-
70-
$osType = docker info --format '{{.OSType}}'
71-
Write-Host "OSType after restart: $osType"
72-
} else {
73-
Write-Host "Docker is already in Linux mode"
74-
}
75-
76-
Write-Host "Testing Linux container pull..."
77-
docker pull alpine:latest
78-
shell: powershell
79-
80-
- name: Install Kind (Linux)
81-
if: runner.os == 'Linux'
30+
with:
31+
driver-opts: network=host
32+
- name: Cache Docker layers
33+
uses: actions/cache@v3
34+
with:
35+
path: /tmp/.buildx-cache
36+
key: ${{ runner.os }}-buildx-${{ github.sha }}
37+
restore-keys: |
38+
${{ runner.os }}-buildx-
39+
- name: Install Kind
8240
run: |
8341
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
8442
chmod +x ./kind
8543
sudo mv ./kind /usr/local/bin/kind
86-
87-
- name: Install Kind (Windows)
88-
if: runner.os == 'Windows'
89-
run: |
90-
curl.exe -Lo kind-windows-amd64.exe https://kind.sigs.k8s.io/dl/v0.20.0/kind-windows-amd64
91-
Move-Item .\kind-windows-amd64.exe C:\Windows\System32\kind.exe
92-
shell: powershell
93-
94-
- name: Install kubectl (Linux)
95-
if: runner.os == 'Linux'
44+
- name: Install kubectl
9645
run: |
9746
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
9847
chmod +x kubectl
9948
sudo mv kubectl /usr/local/bin/
100-
101-
- name: Install kubectl (Windows)
102-
if: runner.os == 'Windows'
103-
run: |
104-
curl.exe -LO "https://dl.k8s.io/release/v1.28.0/bin/windows/amd64/kubectl.exe"
105-
Move-Item .\kubectl.exe C:\Windows\System32\kubectl.exe
106-
shell: powershell
107-
108-
- name: Install Helm (Linux)
109-
if: runner.os == 'Linux'
49+
- name: Install Helm
11050
run: |
11151
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
112-
113-
- name: Install Helm (Windows)
114-
if: runner.os == 'Windows'
115-
run: |
116-
choco install kubernetes-helm -y
117-
shell: powershell
118-
11952
- name: Verify installations
12053
run: |
12154
docker version
12255
kind version
12356
kubectl version --client
12457
helm version
125-
126-
- name: Build Docker images (Linux)
127-
if: runner.os == 'Linux'
58+
- name: Build Docker images
12859
run: |
60+
export DOCKER_BUILDKIT=1
61+
export BUILDKIT_PROGRESS=plain
12962
make containers-build
13063
timeout-minutes: 30
131-
132-
- name: Build Docker images (Windows)
133-
if: runner.os == 'Windows'
134-
run: |
135-
Get-ChildItem -Path containers -Directory | ForEach-Object {
136-
$name = $_.Name
137-
Write-Host "Building $name..."
138-
docker build --platform linux/amd64 "containers/$name" -t "${name}:latest"
139-
if ($LASTEXITCODE -ne 0) {
140-
Write-Host "Failed to build $name"
141-
exit $LASTEXITCODE
142-
}
143-
Write-Host "Successfully built $name"
144-
}
145-
shell: powershell
146-
timeout-minutes: 30
147-
64+
env:
65+
DOCKER_BUILDKIT: 1
14866
- name: Create Kind cluster
14967
run: |
15068
kind create cluster --name aggregator --config k8s/kind-config.yaml --wait 120s
15169
timeout-minutes: 10
152-
153-
- name: Load images into Kind (Linux)
154-
if: runner.os == 'Linux'
155-
run: |
156-
for dir in containers/*; do
157-
if [ -d "$dir" ]; then
158-
name=$(basename "$dir")
159-
echo "Loading $name into kind..."
160-
kind load docker-image "$name:latest" --name aggregator
70+
- name: Load images into Kind
71+
run: |
72+
echo "Loading images in parallel..."
73+
find containers -maxdepth 1 -mindepth 1 -type d | \
74+
xargs -I {} -P 4 sh -c '
75+
name=$(basename {})
76+
echo "📥 Loading $name..."
77+
if kind load docker-image "$name:latest" --name aggregator; then
78+
echo "✅ Loaded $name"
79+
else
80+
echo "❌ Failed to load $name"
81+
exit 1
16182
fi
162-
done
163-
timeout-minutes: 20
164-
165-
- name: Load images into Kind (Windows)
166-
if: runner.os == 'Windows'
167-
run: |
168-
Get-ChildItem -Path containers -Directory | ForEach-Object {
169-
$name = $_.Name
170-
Write-Host "Loading $name into kind..."
171-
kind load docker-image "${name}:latest" --name aggregator
172-
}
173-
shell: powershell
174-
timeout-minutes: 20
175-
83+
'
84+
timeout-minutes: 10
17685
- name: Generate key pair for UMA proxy
17786
run: |
17887
kubectl config use-context kind-aggregator
@@ -182,13 +91,11 @@ jobs:
18291
kubectl delete secret uma-proxy-key-pair -n default --ignore-not-found
18392
kubectl create secret generic uma-proxy-key-pair --from-file=uma-proxy.crt=uma-proxy.crt --from-file=uma-proxy.key=uma-proxy.key -n default
18493
rm uma-proxy.crt uma-proxy.key
185-
18694
- name: Deploy aggregator-cleaner
18795
run: |
18896
kubectl apply -f k8s/ops/ns.yaml
18997
kubectl apply -f k8s/ops/cleaner.yaml
19098
kubectl wait --namespace aggregator-ops --for=condition=available deployment/aggregator-cleaner --timeout=60s || true
191-
19299
- name: Deploy Traefik
193100
run: |
194101
helm repo add traefik https://traefik.github.io/charts
@@ -204,68 +111,42 @@ jobs:
204111
--set providers.kubernetesCRD.allowCrossNamespace=true \
205112
--wait --timeout=3m
206113
kubectl rollout status deployment aggregator-traefik -n aggregator-traefik --timeout=180s
207-
208114
- name: Deploy aggregator
209115
run: |
210116
kubectl apply -f k8s/app/ns.yaml
211117
kubectl apply -f k8s/app/config.yaml
212118
kubectl apply -f k8s/app/aggregator.yaml
213119
kubectl rollout status deployment aggregator-server -n aggregator-app --timeout=120s
214-
215-
- name: Add /etc/hosts entry (Linux)
216-
if: runner.os == 'Linux'
120+
- name: Add /etc/hosts entry
217121
run: |
218122
echo "127.0.0.1 aggregator.local" | sudo tee -a /etc/hosts
219-
220-
- name: Add hosts entry (Windows)
221-
if: runner.os == 'Windows'
222-
run: |
223-
Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "127.0.0.1 aggregator.local"
224-
shell: powershell
225-
226123
- name: Run integration tests
227124
run: |
228125
cd integration-test
229126
go test -v -timeout 30m ./...
230127
timeout-minutes: 35
231-
232-
- name: Collect logs on failure (Linux)
233-
if: failure() && runner.os == 'Linux'
128+
- name: Collect logs on failure
129+
if: failure()
234130
run: |
235131
echo "=== Cluster Info ==="
236132
kubectl cluster-info dump --output-directory=./cluster-logs --namespaces aggregator-app,aggregator-ops 2>&1 || true
237133
echo "=== Docker Containers ==="
238134
docker ps -a
239135
echo "=== Kind Logs ==="
240136
kind export logs ./kind-logs --name aggregator || true
241-
242-
- name: Collect logs on failure (Windows)
243-
if: failure() && runner.os == 'Windows'
244-
run: |
245-
Write-Host "=== Cluster Info ==="
246-
kubectl cluster-info dump --output-directory=./cluster-logs --namespaces aggregator-app,aggregator-ops
247-
Write-Host "=== Docker Containers ==="
248-
docker ps -a
249-
Write-Host "=== Kind Logs ==="
250-
kind export logs ./kind-logs --name aggregator
251-
shell: powershell
252-
continue-on-error: true
253-
254137
- name: Upload logs on failure
255138
if: failure()
256139
uses: actions/upload-artifact@v4
257140
with:
258-
name: test-logs-${{ matrix.os }}
141+
name: test-logs
259142
path: |
260143
cluster-logs/
261144
kind-logs/
262145
retention-days: 7
263-
264146
- name: Cleanup
265147
if: always()
266148
run: |
267149
kind delete cluster --name aggregator || true
268-
269150
notify:
270151
name: Notify Results
271152
needs: integration-tests
@@ -280,4 +161,3 @@ jobs:
280161
echo "❌ Integration tests failed"
281162
exit 1
282163
fi
283-

0 commit comments

Comments
 (0)