-
Notifications
You must be signed in to change notification settings - Fork 7
96 lines (91 loc) · 3.14 KB
/
ci.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
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
---
name: ci
on:
pull_request:
push:
branches:
- 'release/**'
jobs:
yamllint:
uses: networkservicemesh/.github/.github/workflows/yamllint.yaml@main
shellcheck:
uses: networkservicemesh/.github/.github/workflows/shellcheck.yaml@main
golangci-lint:
uses: networkservicemesh/.github/.github/workflows/golangci-lint.yaml@main
exclude-fmt-errorf:
uses: networkservicemesh/.github/.github/workflows/exclude-fmt-errorf.yaml@main
checkgomod:
uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main
azure:
environment: AKS
name: Azure Kubernetes Service
runs-on: ubuntu-latest
steps:
- name: Install azure-cli
uses: azure/CLI@v1
with:
inlineScript: |
az version
- name: Set up azure permissions
run: |
sudo chmod -R 777 ~/.azure
- name: Set up /bin permissions
run: |
sudo chmod -R 777 /bin
- name: Set up go
uses: actions/setup-go@v1
with:
go-version: 1.20.5
- name: Checkout files
uses: actions/checkout@v2
with:
path: ${{ github.repository }}
- name: Setup AKS cluster
working-directory: ${{ github.repository }}
run: |
az login --service-principal --username ${AZURE_SERVICE_PRINCIPAL} --password ${AZURE_SERVICE_PRINCIPAL_SECRET} --tenant ${AZURE_TENANT}
az aks create \
--resource-group "$AZURE_RESOURCE_GROUP" \
--name "$AZURE_CLUSTER_NAME" \
--node-count 2 \
--node-vm-size Standard_B2s \
--generate-ssh-keys \
--debug
az aks wait \
--name "$AZURE_CLUSTER_NAME" \
--resource-group "$AZURE_RESOURCE_GROUP" \
--created > /dev/null
az aks get-credentials \
--name "$AZURE_CLUSTER_NAME" \
--resource-group "$AZURE_RESOURCE_GROUP" \
--file "/tmp/config" \
--overwrite-existing
env:
AZURE_SERVICE_PRINCIPAL: ${{ secrets.AZURE_SERVICE_PRINCIPAL }}
AZURE_SERVICE_PRINCIPAL_SECRET: ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }}
AZURE_TENANT: ${{ secrets.AZURE_TENANT }}
AZURE_CLUSTER_NAME: aks-${{ github.run_id }}-${{ github.run_number }}
AZURE_RESOURCE_GROUP: nsm-ci
- name: Run tests
working-directory: ${{ github.repository }}
run: |
go test -count 1 -timeout 1h55m -race -v ./... -parallel 4
env:
KUBECONFIG: /tmp/config
- name: Cleanup AKS cluster
if: ${{ always() }}
working-directory: ${{ github.repository }}
run: |
az aks delete \
--name "$AZURE_CLUSTER_NAME" \
--resource-group "$AZURE_RESOURCE_GROUP" \
--yes
env:
AZURE_CLUSTER_NAME: aks-${{ github.run_id }}-${{ github.run_number }}
AZURE_RESOURCE_GROUP: nsm-ci
- name: Upload logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: logs-${{ github.run_number }}
path: ${{ github.repository }}/logs