-
Notifications
You must be signed in to change notification settings - Fork 44
186 lines (184 loc) · 5.49 KB
/
test.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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
app:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.20
- name: Test golang code
run: go test ./...
- name: Build golang code
run: go build
linux-android-windows-libs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.20
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25c
add-to-path: true
- name: Install requirement
run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu binutils-mingw-w64 gcc-mingw-w64-x86-64 -y
- name: Test golang code
run: go test ./...
- name: Build linux libs
run: ./scripts/build_libs/buildso.sh
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Build windows libs
run: ./scripts/build_libs/builddll.sh
- uses: actions/upload-artifact@v4
with:
name: linux-libs
path: build/linux
# - uses: actions/upload-artifact@v4
# with:
# name: android-libs
# path: build/android
- uses: actions/upload-artifact@v4
with:
name: windows-libs
path: build/windows
macos-iOS-libs:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.20
- name: Test golang code
run: go test ./...
- name: Build libs
run: ./scripts/build_libs/builddylib.sh
- uses: actions/upload-artifact@v4
with:
name: macos-libs
path: build/macos
- uses: actions/upload-artifact@v4
with:
name: ios-libs
path: build/ios
gomobile-android-libs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.20
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r21e
add-to-path: false
- name: Test golang code
run: go test ./...
- name: install and setup gomobile
run: |
go get -u golang.org/x/mobile
go install golang.org/x/mobile/cmd/gobind@latest
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
gomobile version
gomobile clean
env:
GO111MODULE: on
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: build android aar
run: gomobile bind -target=android -o gateway.aar ./client
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- uses: actions/upload-artifact@v4
with:
name: android-aar-libs
path: gateway.aar
gomobile-apple-libs:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.20
- name: Test golang code
run: go test ./...
- name: install and setup gomobile
run: |
go get -u golang.org/x/mobile
go install golang.org/x/mobile/cmd/gobind@latest
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
gomobile version
gomobile clean
env:
GO111MODULE: on
- name: build ios xcframework
run: gomobile bind -ldflags '-w -s -extldflags "-lresolve"' --target=ios,macos,iossimulator -o OpenIoTHubGateway.xcframework ./client
- run: zip -r OpenIoTHubGateway.xcframework.zip OpenIoTHubGateway.xcframework
- uses: actions/upload-artifact@v4
with:
name: ios-macos-xcframework-libs
path: OpenIoTHubGateway.xcframework.zip
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.20
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v2
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v2
- name: setup-snapcraft
# FIXME: the mkdirs are a hack for https://github.com/goreleaser/goreleaser/issues/1715
run: |
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
mkdir -p $HOME/.cache/snapcraft/download
mkdir -p $HOME/.cache/snapcraft/stage-packages
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean --snapshot
- name: Upload assets
uses: actions/upload-artifact@v4
with:
name: goreleaser-dist
path: dist/*