Skip to content

Commit 915d3ec

Browse files
shaxbeeZibi Mandziejewicz
authored andcommitted
feat: e2e test
1 parent bd745ed commit 915d3ec

File tree

4 files changed

+96
-38
lines changed

4 files changed

+96
-38
lines changed

.github/workflows/ci.yaml

Lines changed: 91 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,69 @@ 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+
path: build
87+
- name: Create Kind cluster
88+
uses: helm/kind-action@v1
89+
- name: Bootstrap
90+
run: |
91+
kustomize build --enable-helm config/bootstrap | kubectl apply -f -
92+
kubectl --namespace cert-manager wait --for=condition=Available deployment/cert-manager
93+
kubectl get namespace sandbox 2>/dev/null || kubectl create namespace sandbox
94+
- name: Deploy
95+
run: skaffold deploy --profile e2e --build-artifacts=build/images.json
96+
- name: Run E2E tests
97+
run: skaffold verify --namespace sandbox --build-artifacts=build/images.json
98+
- name: Fetch coverage
99+
run: make fetch-coverage
100+
- name: Archive coverage report
59101
uses: actions/upload-artifact@v4
60102
with:
61-
name: images
62-
path: images.json
103+
name: coverage
104+
path: ${{ env.CODECOV_FILE }}
105+
106+
coverage:
107+
name: Coverage Report
108+
needs:
109+
- verify
110+
- e2e
111+
runs-on: ubuntu-latest
112+
steps:
113+
- name: Download coverage reports
114+
uses: actions/download-artifact@v4
115+
with:
116+
name: coverage
117+
path: build
118+
- name: Generate
119+
uses: irongut/CodeCoverageSummary@v1.3.0
120+
with:
121+
filename: build/coverage.xml,build/coverage.*.xml
122+
badge: true
123+
format: markdown
124+
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)