99
1010jobs :
1111 build :
12- strategy :
13- matrix :
14- mongodb : ["4.4", "5.0"]
1512 runs-on : ubuntu-latest
1613 steps :
1714 - name : Checkout
1815 uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
1916 - name : Setup Go
2017 uses : actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
2118 with :
22- go-version : 1.19 .x
19+ go-version : 1.20 .x
2320 - name : Restore Go cache
2421 uses : actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
2522 with :
2623 path : ~/go/pkg/mod
2724 key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
2825 restore-keys : |
2926 ${{ runner.os }}-go-
30- - name : Setup Kubernetes
31- uses : engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 # v0.5.0
32- with :
33- version : v0.11.1
34- image : kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
35- - name : Setup kustomize
36- shell : bash
37- run : |
38- curl --silent --location --remote-name "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.5.7/kustomize_v4.5.7_linux_amd64.tar.gz"
39- tar xvzf kustomize_v4.5.7_linux_amd64.tar.gz
40- sudo mv kustomize /usr/local/bin/kustomize
41- rm -rfv *.tar.gz
42- kustomize version
43- - name : Install Helm
44- uses : azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
4527 - name : fmt
4628 run : make fmt
4729 - name : vet
5032 run : make lint
5133 - name : Run tests
5234 run : make test
35+ - name : Build binary
36+ run : make build
5337 - name : Send go coverage report
5438 uses : shogo82148/actions-goveralls@31ee804b8576ae49f6dc3caa22591bc5080e7920 # v1.6.0
5539 with :
@@ -63,13 +47,53 @@ jobs:
6347 fi
6448 - name : Build container image
6549 run : |
66- make docker-build IMG=test/mongodb-query-exporter:latest BUILD_PLATFORMS=linux/amd64 \
67- BUILD_ARGS="--cache-from=type=local,src=/tmp/.buildx-cache \
68- --cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max"
50+ make docker-build
51+ - name : Create image tarball
52+ run : |
53+ docker save raffis/mongodb-query-exporter:latest --output exporter-container.tar
54+ - name : Upload image
55+ uses : actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
56+ with :
57+ name : exporter-container
58+ path : exporter-container.tar
59+
60+ e2e-tests :
61+ needs : [build]
62+ strategy :
63+ matrix :
64+ mongodb : ["4.4", "5.0"]
65+ runs-on : ubuntu-latest
66+ steps :
67+ - name : Checkout
68+ uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
69+ - name : Download exporter container
70+ uses : actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
71+ with :
72+ name : exporter-container
73+ path : /tmp
74+ - name : Load image
75+ run : |
76+ docker load --input /tmp/exporter-container.tar
77+ docker image ls -a
78+ - name : Setup Kubernetes
79+ uses : engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 # v0.5.0
80+ with :
81+ version : v0.11.1
82+ image : kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
83+ - name : Setup kustomize
84+ shell : bash
85+ run : |
86+ curl --silent --location --remote-name "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.5.7/kustomize_v4.5.7_linux_amd64.tar.gz"
87+ tar xvzf kustomize_v4.5.7_linux_amd64.tar.gz
88+ sudo mv kustomize /usr/local/bin/kustomize
89+ rm -rfv *.tar.gz
90+ kustomize version
91+ - name : Install Helm
92+ uses : azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
6993 - name : Load test image
70- run : kind load docker-image test /mongodb-query-exporter:latest
94+ run : kind load docker-image raffis /mongodb-query-exporter:latest
7195 - name : Deploy exporter
72- run : make deploy-test IMG=test/mongodb-query-exporter:latest
96+ run : make deploy-test
7397 - name : Setup MongoDB
7498 env :
7599 MONGODB_VER : ${{ '13.5.0' }}
0 commit comments