-
Notifications
You must be signed in to change notification settings - Fork 11
165 lines (136 loc) · 4.97 KB
/
main.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
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: CI
on: [push, pull_request]
jobs:
golang-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Go fmt Check
uses: Jerome1337/[email protected]
with:
gofmt-path: './'
gofmt-flags: '-l -d'
- name: Go Mod
run: go mod tidy
- name: Clone Tongsuo
uses: actions/checkout@v3
with:
repository: Tongsuo-Project/Tongsuo
path: Tongsuo
ref: 8.3-stable
- name: Build Tongsuo
run: |
cd Tongsuo
./config --prefix=${RUNNER_TEMP}/tongsuo --libdir=${RUNNER_TEMP}/tongsuo/lib enable-ntls
make -j4
make install
- name: Golang lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.61.0
LD_LIBRARY_PATH=${RUNNER_TEMP}/tongsuo/lib CGO_CFLAGS="-Wall -I${RUNNER_TEMP}/tongsuo/include -Wno-deprecated-declarations" CGO_LDFLAGS="-L${RUNNER_TEMP}/tongsuo/lib" golangci-lint run ./...
build-and-test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Clone Tongsuo
uses: actions/checkout@v3
with:
repository: Tongsuo-Project/Tongsuo
path: Tongsuo
ref: 8.3-stable
- name: Build Tongsuo
run: |
cd Tongsuo
./config --prefix=${RUNNER_TEMP}/tongsuo --libdir=${RUNNER_TEMP}/tongsuo/lib enable-ntls
make -j4
make install
- name: Build
run: CGO_CFLAGS="-Wall -I${RUNNER_TEMP}/tongsuo/include -Wno-deprecated-declarations" CGO_LDFLAGS="-L${RUNNER_TEMP}/tongsuo/lib" go build
- name: Test on Ubuntu
run: LD_LIBRARY_PATH=${RUNNER_TEMP}/tongsuo/lib CGO_CFLAGS="-Wall -I${RUNNER_TEMP}/tongsuo/include -Wno-deprecated-declarations" CGO_LDFLAGS="-L${RUNNER_TEMP}/tongsuo/lib" go test ./...
if: matrix.os == 'ubuntu-latest'
- name: Test on macOS
run: DYLD_LIBRARY_PATH=${RUNNER_TEMP}/tongsuo/lib CGO_CFLAGS="-Wall -I${RUNNER_TEMP}/tongsuo/include -Wno-deprecated-declarations" CGO_LDFLAGS="-L${RUNNER_TEMP}/tongsuo/lib" go test ./...
if: matrix.os == 'macos-latest'
build-static:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Clone Tongsuo
uses: actions/checkout@v3
with:
repository: Tongsuo-Project/Tongsuo
path: tongsuo
ref: 8.3-stable
- name: Build Tongsuo Static
run: |
cd tongsuo
./config --prefix=${RUNNER_TEMP}/tongsuo --libdir=${RUNNER_TEMP}/tongsuo/lib enable-ntls no-shared
make -j4
make install
- name: Build
run: CGO_CFLAGS="-Wall -I${RUNNER_TEMP}/tongsuo/include -Wno-deprecated-declarations" CGO_LDFLAGS="-L${RUNNER_TEMP}/tongsuo/lib" go build
- name: Test on Ubuntu
run: LD_LIBRARY_PATH=${RUNNER_TEMP}/tongsuo/lib CGO_CFLAGS="-Wall -I${RUNNER_TEMP}/tongsuo/include -Wno-deprecated-declarations" CGO_LDFLAGS="-L${RUNNER_TEMP}/tongsuo/lib" go test ./...
if: matrix.os == 'ubuntu-latest'
- name: Test on macOS
run: DYLD_LIBRARY_PATH=${RUNNER_TEMP}/tongsuo/lib CGO_CFLAGS="-Wall -I${RUNNER_TEMP}/tongsuo/include -Wno-deprecated-declarations" CGO_LDFLAGS="-L${RUNNER_TEMP}/tongsuo/lib" go test ./...
if: matrix.os == 'macos-latest'
build-on-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Clone Tongsuo
uses: actions/checkout@v3
with:
repository: Tongsuo-Project/Tongsuo
path: Tongsuo
ref: 8.3-stable
- uses: ilammy/msvc-dev-cmd@v1
- uses: ilammy/setup-nasm@v1
- uses: shogo82148/actions-setup-perl@v1
- name: Build Tongsuo
shell: cmd
run: |
mkdir _build
cd _build
perl ..\Configure --banner=Configured --prefix=%RUNNER_TEMP%\tongsuo enable-ntls VC-WIN64A
nmake /S
nmake install
working-directory: Tongsuo
- name: Build
shell: cmd
run: CGO_CFLAGS="-Wall -I%RUNNER_TEMP%\tongsuo\include -Wno-deprecated-declarations" CGO_LDFLAGS="%RUNNER_TEMP%\tongsuo\lib" go build
- name: Test on Windows
shell: cmd
run: |
set PATH=%RUNNER_TEMP%\tongsuo\lib;%PATH%
set CGO_CFLAGS="-Wall -I%RUNNER_TEMP%\tongsuo\include -Wno-deprecated-declarations"
set CGO_LDFLAGS="-L%RUNNER_TEMP%\tongsuo\lib"
go test ./...