-
Notifications
You must be signed in to change notification settings - Fork 1
172 lines (151 loc) · 4.09 KB
/
Copy pathci.yml
File metadata and controls
172 lines (151 loc) · 4.09 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: ci
on:
workflow_dispatch:
schedule:
- cron: "0 18 * * *"
push:
branches:
- main
- master
- "quanquan/**"
pull_request:
branches:
- main
- master
permissions:
contents: read
jobs:
go-gates:
name: go gates (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
env:
CGO_ENABLED: "0"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.26.4"
cache: true
- name: Check Go Version
run: go version
- name: Format Check
if: runner.os != 'Windows'
run: |
files="$(gofmt -l $(find . -path ./third_party -prune -o -name '*.go' -print))"
if [ -n "${files}" ]; then
echo "${files}"
exit 1
fi
- name: Project Gates
run: ./scripts/check-go-gates.sh
- name: Lua Race Check
if: runner.os == 'Linux'
# Go race detector 在 Linux 上依赖 CGO;该例外仅启用测试工具链,核心代码仍禁止 import "C"。
env:
CGO_ENABLED: "1"
run: go test -race ./lua
native-cross-compile:
name: native cross compile (${{ matrix.name }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- name: linux-windows-android
os: ubuntu-latest
targets: >-
linux/amd64
linux/386
linux/arm64
linux/arm/6
linux/arm/7
windows/amd64
windows/386
windows/arm64
android/arm64
- name: darwin
os: macos-latest
targets: >-
darwin/amd64
darwin/arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.26.4"
cache: true
- name: Setup mise tools
uses: jdx/mise-action@v2
with:
install: true
cache: true
- name: Setup Android NDK
id: setup-ndk
if: matrix.name == 'linux-windows-android'
uses: nttld/setup-ndk@v1
with:
ndk-version: r27c
- name: Export Android NDK
if: matrix.name == 'linux-windows-android'
run: echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> "${GITHUB_ENV}"
- name: Native Toolchain Summary
env:
NATIVE_CROSS_TARGETS: ${{ matrix.targets }}
run: |
set -euo pipefail
./scripts/bootstrap-native-toolchains.sh --install || true
eval "$(./scripts/bootstrap-native-toolchains.sh --emit-env)"
./scripts/bootstrap-native-toolchains.sh || true
- name: Native Cross Compile
env:
NATIVE_CROSS_TARGETS: ${{ matrix.targets }}
NATIVE_CROSS_REQUIRE_ALL: "1"
run: |
set -euo pipefail
eval "$(./scripts/bootstrap-native-toolchains.sh --emit-env)"
./scripts/check-native-cross-compile.sh
native-module-gates:
name: native module gates (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
env:
CGO_ENABLED: "1"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.26.4"
cache: true
- name: Check Go Version
run: go version
- name: Native Go Tests
run: go test -tags native_modules ./...
- name: Native CLI Build
run: go build -tags native_modules -trimpath -o "build/ci-native-glua" ./cmd/glua
- name: Native Real Module Acceptance
run: ./scripts/test-native-real-modules.sh