Skip to content

Commit 0120c12

Browse files
shaxbeeZibi Mandziejewicz
authored andcommitted
feat: e2e test
1 parent bd745ed commit 0120c12

File tree

4 files changed

+94
-38
lines changed

4 files changed

+94
-38
lines changed

.github/workflows/ci.yaml

Lines changed: 89 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,46 @@
1-
name: ci
1+
name: CI
22

33
on:
44
push:
55

66
jobs:
7+
image-build:
8+
name: Image Build
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
- name: Set up QEMU
14+
uses: docker/setup-qemu-action@v3
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v3
17+
with:
18+
platforms: linux/amd64,linux/arm64
19+
- name: Login to GitHub Container Registry
20+
uses: docker/login-action@v3
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
- name: Setup Skaffold
26+
uses: heypigeonhq/setup-skaffold@v1.0.0
27+
with:
28+
version: 2.14.1
29+
- name: Build images
30+
run: |
31+
mkdir build
32+
skaffold build --file-output=build/images.json
33+
- name: Archive image tags
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: images
37+
path: build/images.json
38+
739
verify:
840
name: Verify
941
runs-on: ubuntu-latest
1042
env:
11-
CODECOV_FILE: "build/coverage.xml"
43+
CODECOV_FILE: build/coverage.xml
1244
steps:
1345
- name: Checkout
1446
uses: actions/checkout@v4
@@ -24,39 +56,67 @@ jobs:
2456
run: make lint
2557
- name: Integration test
2658
run: make integration-test coverage
27-
- name: Code Coverage Report
28-
uses: irongut/CodeCoverageSummary@v1.3.0
59+
- name: Archive coverage report
60+
uses: actions/upload-artifact@v4
2961
with:
30-
filename: ${{ env.CODECOV_FILE }}
31-
badge: true
32-
format: markdown
33-
output: both
34-
image-build:
35-
name: Image Build
62+
name: coverage
63+
path: ${{ env.CODECOV_FILE }}
64+
65+
e2e:
66+
name: E2E Test
67+
needs:
68+
- verify
69+
- image-build
3670
runs-on: ubuntu-latest
71+
env:
72+
CODECOV_FILE: build/coverage.e2e.xml
73+
SKAFFOLD_NAMESPACE: sandbox
74+
SKAFFOLD_RUN_ID: e2e-test
3775
steps:
3876
- name: Checkout
3977
uses: actions/checkout@v4
40-
- name: Set up QEMU
41-
uses: docker/setup-qemu-action@v3
42-
- name: Set up Docker Buildx
43-
uses: docker/setup-buildx-action@v3
78+
- name: Setup Skaffold
79+
uses: heypigeonhq/setup-skaffold@v1.0.0
4480
with:
45-
platforms: linux/amd64,linux/arm64
46-
- name: Login to GitHub Container Registry
47-
uses: docker/login-action@v3
81+
version: 2.14.1
82+
- name: Download image tags
83+
uses: actions/download-artifact@v4
4884
with:
49-
registry: ghcr.io
50-
username: ${{ github.actor }}
51-
password: ${{ secrets.GITHUB_TOKEN }}
52-
- name: Build images
53-
uses: hiberbee/github-action-skaffold@1.27.0
54-
with:
55-
skaffold-version: 2.14.1
56-
command: build
57-
file-output: images.json
58-
- name: Archive image tags
85+
name: images
86+
- name: Create Kind cluster
87+
uses: helm/kind-action@v1
88+
- name: Bootstrap
89+
run: |
90+
kustomize build --enable-helm config/bootstrap | kubectl apply -f -
91+
kubectl --namespace cert-manager wait --for=condition=Available deployment/cert-manager
92+
kubectl get namespace sandbox 2>/dev/null || kubectl create namespace sandbox
93+
- name: Deploy
94+
run: skaffold deploy --build-artifacts=build/images.json
95+
- name: Run E2E tests
96+
run: skaffold verify --namespace sandbox --build-artifacts=build/images.json
97+
- name: Fetch coverage
98+
run: make fetch-coverage
99+
- name: Archive coverage report
59100
uses: actions/upload-artifact@v4
60101
with:
61-
name: images
62-
path: images.json
102+
name: coverage
103+
path: ${{ env.CODECOV_FILE }}
104+
105+
coverage:
106+
name: Coverage Report
107+
needs:
108+
- verify
109+
- e2e
110+
runs-on: ubuntu-latest
111+
steps:
112+
- name: Download coverage reports
113+
uses: actions/download-artifact@v4
114+
with:
115+
name: coverage
116+
- name: Generate
117+
uses: irongut/CodeCoverageSummary@v1.3.0
118+
with:
119+
filename: build/coverage.xml,build/coverage.*.xml
120+
badge: true
121+
format: markdown
122+
output: both

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ kustomize build --enable-helm config/bootstrap | kubectl apply -f -
3232

3333
```
3434
docker build --tag ghcr.io/agoda-com/etcd .
35-
```
36-
37-
```
3835
kubectl apply -k config/default
3936
```
4037

@@ -84,11 +81,6 @@ End-to-end tests:
8481
make e2e-test
8582
```
8683

87-
Run end-to-end tests on dev cluster:
88-
```sh
89-
make e2e-test
90-
```
91-
9284
Coverage:
9385
```sh
9486
make test coverage

config/default/kustomization.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ kind: Kustomization
33
namespace: etcd
44
resources:
55
- ../rbac
6-
- ../base
6+
- ../base
7+
- namespace.yaml

config/default/namespace.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Namespace
2+
metadata:
3+
name: etcd

0 commit comments

Comments
 (0)