-
Notifications
You must be signed in to change notification settings - Fork 6
89 lines (84 loc) · 3.21 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
---
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
gke:
environment: GKE
name: Google Kubernetes Engine
runs-on: ubuntu-latest
steps:
- name: Set up /bin permissions
run: |
sudo chmod -R 777 /bin
- name: Checkout deployments
uses: actions/checkout@v4
with:
repository: networkservicemesh/deployments-k8s
path: networkservicemesh/deployments-k8s
- name: Checkout files
uses: actions/checkout@v4
with:
path: ${{ github.repository }}
- name: Set up go
uses: actions/setup-go@v5
with:
go-version: 1.20.5
- uses: 'google-github-actions/auth@v2'
with:
project_id: ${{ secrets.GOOGLE_PROJECT_ID }}
credentials_json: ${{ secrets.GCLOUD_SERVICE_KEY }}
- name: Install gcloud-sdk
uses: google-github-actions/setup-gcloud@v2
- name: Setup cluster
working-directory: ${{ github.repository }}
run: |
gcloud components install gke-gcloud-auth-plugin
gcloud components update
gcloud container clusters create "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --machine-type="${GKE_CLUSTER_TYPE}" --num-nodes="${GKE_CLUSTER_NUM_NODES}" --zone="${GKE_CLUSTER_ZONE}" --enable-gvnic -q
echo "Writing config to ${KUBECONFIG}"
gcloud container clusters get-credentials "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --zone="${GKE_CLUSTER_ZONE}"
env:
GKE_PROJECT_ID: ${{ secrets.GOOGLE_PROJECT_ID }}
GKE_CLUSTER_NAME: gke-${{ github.run_id }}-${{ github.run_number }}
GKE_CLUSTER_ZONE: us-central1-a
GKE_CLUSTER_TYPE: n1-standard-2
GKE_CLUSTER_NUM_NODES: 2
KUBECONFIG: config
USE_GKE_GCLOUD_AUTH_PLUGIN: true
- name: Run integration tests
working-directory: ${{ github.repository }}
run: |
export KUBECONFIG=$(pwd)/config
go test -count 1 -timeout 1h55m -race -v ./... -parallel 4
env:
ARTIFACTS_DIR: logs
USE_GKE_GCLOUD_AUTH_PLUGIN: true
- name: Cleanup
if: ${{ always() }}
working-directory: ${{ github.repository }}
run: |
gcloud container clusters delete "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --zone="${GKE_CLUSTER_ZONE}" -q
env:
GKE_PROJECT_ID: ${{ secrets.GOOGLE_PROJECT_ID }}
GKE_CLUSTER_NAME: gke-${{ github.run_id }}-${{ github.run_number }}
GKE_CLUSTER_ZONE: us-central1-a
- name: Upload logs
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: logs-${{ github.run_number }}
path: ${{ github.repository }}/logs