-
Notifications
You must be signed in to change notification settings - Fork 23
46 lines (37 loc) · 1.37 KB
/
unit.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Unit Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
with:
go-version: '~1.22'
cache-dependency-path: "**/*.sum"
- name: Create kubebuilder directory
# The default location for the etcd and kube-apiserver binaries is /kubebuilder/bin
run: sudo mkdir -p /usr/local/kubebuilder/bin
- name: Install etcd
run: |
wget -q https://github.com/etcd-io/etcd/releases/download/v3.5.0/etcd-v3.5.0-linux-amd64.tar.gz
tar xzf etcd-v3.5.0-linux-amd64.tar.gz
sudo mv etcd-v3.5.0-linux-amd64/etcd /usr/local/kubebuilder/bin/
- name: Install kube-apiserver
run: |
wget -q https://storage.googleapis.com/kubernetes-release/release/v1.22.2/bin/linux/amd64/kube-apiserver
chmod +x kube-apiserver
sudo mv kube-apiserver /usr/local/kubebuilder/bin/
- name: Run Unit Tests
run: go test -race -v ./... -coverprofile=coverage.out
- name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@c680c0f7c7442485f1749eb2a13e54a686e76eb5 #v1.0.8
- name: Coveralls
uses: coverallsapp/github-action@95b1a2355bd0e526ad2fd62da9fd386ad4c98474 #v2.2.1
with:
flag-name: unit-test
path-to-lcov: coverage.lcov