-
Notifications
You must be signed in to change notification settings - Fork 29
135 lines (115 loc) · 3.6 KB
/
go.yml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches:
- main
- 'release/**'
- remote-agent
pull_request:
branches:
- main
- 'release/**'
- remote-agent
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
TEST_KUBECTL: yes
TEST_MINIKUBE_ENABLED: yes
TEST_MQTT_LOCAL_ENABLED: yes
TEST_DOCKER_ENABLED: yes
TEST_K8S_STATE: yes
TEST_SYMPHONY_HELM_VERSION: yes
TEST_HELM_CHART: yes
TEST_CONFIGMAP: yes # requires minikube start
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.4
- name: Set up custom GOPATH
run: |
mkdir -p /home/runner/go
echo "export GOPATH=/home/runner/go" >> $HOME/.bashrc
echo "export PATH=\$PATH:\$GOPATH/bin" >> $HOME/.bashrc
source $HOME/.bashrc
- name: Install make
run: sudo apt-get update && sudo apt-get install -y build-essential
- name: Check docker version and images
run: docker version && docker images
- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version --client
kubectl config view
- name: Install minikube
run: |
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin/
minikube start
kubectl config view
- name: Install Mqtt
run: |
sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients
sudo service mosquitto start
sudo service mosquitto status
- name: Install Mage
run: |
cd ..
git clone https://github.com/magefile/mage
cd mage
go run bootstrap.go
cd ..
- name: COA Test
run: cd coa && mage cleanTest
- name: API Build
run: cd api && go build -o symphony-api
- name: API Test
run: |
echo "TEST_KUBECTL:$TEST_KUBECTL TEST_MINIKUBE_ENABLED:$TEST_MINIKUBE_ENABLED TEST_K8S_STATE: $TEST_K8S_STATE TEST_CONFIGMAP: $TEST_CONFIGMAP"
export REPOPATH="${{ github.workspace }}"
echo "REPOPATH=$REPOPATH"
export DOCKER_API_VERSION=1.45
cd api && mage cleanTest
- name: K8S Test
run: cd k8s && mage operatorTest
- name: target-api-testcoverage-app
run: |
cd api
COVERAGE=`mage printCoverage`
echo "coverage=$COVERAGE"
go tool cover -html=coverage.out -o coverage-api.html
continue-on-error: true
if: always()
- name: target-k8s-testcoverage-app
run: |
cd k8s
COVERAGE=`mage printCoverage`
echo "coverage=$COVERAGE"
go tool cover -html=coverage.out -o coverage-k8s.html
continue-on-error: true
if: always()
- name: target-coa-testcoverage-app
run: |
cd coa
COVERAGE=`mage printCoverage`
echo "coverage=$COVERAGE"
go tool cover -html=coverage.out -o coverage-coa.html
continue-on-error: true
if: always()
- name: Upload test assets
uses: actions/upload-artifact@v4
with:
name: test-coverage
path: |
api/coverage-api.html
k8s/coverage-k8s.html
coa/coverage-coa.html