-
Notifications
You must be signed in to change notification settings - Fork 42
156 lines (148 loc) · 4.43 KB
/
ci-go.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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: CI
on:
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
paths-ignore:
- "docs/**"
push:
branches:
- main
paths-ignore:
- "docs/**"
env:
GO_VERSION: 1.22.1
permissions:
contents: read
jobs:
lint-go:
name: Lint (go)
runs-on: namespace-profile-linux-4vcpu-8gb-cached
env:
GO_VERSION: 1.22.1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
## skip cache, use Namespace volume cache
cache: false
- name: Setup Namespace cache
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: go
path: |
/home/runner/go/pkg
/home/runner/.cache/go-build
/home/runner/.cache/golangci-lint
- name: Find go path
id: go-dir
run: echo "path=$(go list -f '{{.Dir}}/...' -m | xargs)" >> $GITHUB_OUTPUT
## Equivalent to 'make lint' arguments
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.57.1
args: --timeout=10m -v ${{ steps.go-dir.outputs.path }}
## skip cache, use Namespace volume cache
skip-cache: true
unit-test-go:
name: Unit Test (go)
runs-on: namespace-profile-linux-4vcpu-8gb-cached
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
## skip cache, use Namespace volume cache
cache: false
- name: Setup Namespace cache
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: go
- name: Run Unit Test
run: make unit-test-all
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
directory: "./"
validate-swagger:
name: Validate (Swagger)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: "**/*.sum"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run swagger-check
run: make swagger-check
e2e-nakama:
name: E2E (Nakama)
runs-on:
- nscloud-ubuntu-22.04-amd64-4x16-with-cache-with-features
- nscloud-cache-tag-e2e
- nscloud-exp-features:privileged;host-pid-namespace
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
## skip cache, use Namespace volume cache
cache: false
- name: Install and configure Namespace CLI
uses: namespacelabs/nscloud-setup@v0
- name: Configure Namespace powered Buildx
uses: namespacelabs/nscloud-setup-buildx-action@v0
- name: Setup Namespace cache
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: go
- name: E2E Test (Nakama)
run: make e2e-nakama
- name: E2E docker compose logs last status
if: success() || failure()
run: |
docker compose logs
e2e-evm:
name: E2E (EVM)
runs-on:
- nscloud-ubuntu-22.04-amd64-4x16-with-cache-with-features
- nscloud-cache-tag-e2e
- nscloud-exp-features:privileged;host-pid-namespace
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
## skip cache, use Namespace volume cache
cache: false
- name: Install and configure Namespace CLI
uses: namespacelabs/nscloud-setup@v0
- name: Configure Namespace powered Buildx
uses: namespacelabs/nscloud-setup-buildx-action@v0
- name: Setup Namespace cache
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: go
- name: E2E Test (EVM)
run: make e2e-evm
- name: E2E docker compose logs last status
if: success() || failure()
run: |
docker compose logs