Skip to content

Commit 2f8ce69

Browse files
shaxbeeZibi Mandziejewicz
authored andcommitted
feat: e2e test
1 parent bd745ed commit 2f8ce69

File tree

4 files changed

+89
-38
lines changed

4 files changed

+89
-38
lines changed

.github/workflows/ci.yaml

Lines changed: 84 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,43 @@
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: Build images
26+
uses: hiberbee/github-action-skaffold@1.27.0
27+
with:
28+
skaffold-version: ${{ env.SKAFFOLD_VERSION }}
29+
command: build
30+
file-output: build/images.json
31+
- name: Archive image tags
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: images
35+
path: build/images.json
736
verify:
837
name: Verify
938
runs-on: ubuntu-latest
1039
env:
11-
CODECOV_FILE: "build/coverage.xml"
40+
CODECOV_FILE: build/coverage.xml
1241
steps:
1342
- name: Checkout
1443
uses: actions/checkout@v4
@@ -24,39 +53,65 @@ jobs:
2453
run: make lint
2554
- name: Integration test
2655
run: make integration-test coverage
27-
- name: Code Coverage Report
28-
uses: irongut/CodeCoverageSummary@v1.3.0
56+
- name: Archive coverage report
57+
uses: actions/upload-artifact@v4
2958
with:
30-
filename: ${{ env.CODECOV_FILE }}
31-
badge: true
32-
format: markdown
33-
output: both
34-
image-build:
35-
name: Image Build
59+
name: coverage
60+
path: ${{ env.CODECOV_FILE }}
61+
e2e:
62+
name: E2E Test
63+
needs:
64+
- verify
65+
- image-build
3666
runs-on: ubuntu-latest
67+
env:
68+
CODECOV_FILE: build/coverage.e2e.xml
69+
SKAFFOLD_NAMESPACE: sandbox
70+
SKAFFOLD_RUN_ID: e2e-test
3771
steps:
3872
- name: Checkout
3973
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
74+
- name: Setup Skaffold
75+
uses: heypigeonhq/setup-skaffold@v1.0.0
4476
with:
45-
platforms: linux/amd64,linux/arm64
46-
- name: Login to GitHub Container Registry
47-
uses: docker/login-action@v3
48-
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
77+
version: v2.14.1
78+
- name: Download image tags
79+
uses: actions/download-artifact@v4
5480
with:
55-
skaffold-version: 2.14.1
56-
command: build
57-
file-output: images.json
58-
- name: Archive image tags
81+
name: images
82+
- name: Create Kind cluster
83+
uses: helm/kind-action@v1
84+
- name: Bootstrap
85+
run: |
86+
kustomize build --enable-helm config/bootstrap | kubectl apply -f -
87+
kubectl --namespace cert-manager wait --for=condition=Available deployment/cert-manager
88+
kubectl get namespace sandbox 2>/dev/null || kubectl create namespace sandbox
89+
- name: Deploy
90+
run: skaffold deploy --build-artifacts=build/images.json
91+
- name: Run E2E tests
92+
run: skaffold verify --namespace sandbox --build-artifacts=build/images.json
93+
- name: Fetch coverage
94+
run: make fetch-coverage
95+
- name: Archive coverage report
5996
uses: actions/upload-artifact@v4
6097
with:
61-
name: images
62-
path: images.json
98+
name: coverage
99+
path: ${{ env.CODECOV_FILE }}
100+
coverage:
101+
name: Coverage Report
102+
needs:
103+
- verify
104+
- e2e
105+
runs-on: ubuntu-latest
106+
steps:
107+
- name: Download coverage reports
108+
uses: actions/download-artifact@v4
109+
with:
110+
name: coverage
111+
- name: Generate
112+
uses: irongut/CodeCoverageSummary@v1.3.0
113+
with:
114+
filename: build/coverage.xml,build/coverage.e2e.xml
115+
badge: true
116+
format: markdown
117+
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)