-
-
Notifications
You must be signed in to change notification settings - Fork 23
173 lines (135 loc) · 4.88 KB
/
build.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
name: Build & Deploy
on: [push]
env:
SCRVER: ${{ github.sha }}
jobs:
server:
name: Build Server
runs-on: ubuntu-latest
env:
GO111MODULE: "on"
CGO_ENABLED: 0
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set version env
run: |
echo "SCRVER=$(git describe --always --long --dirty)" >> "$GITHUB_ENV"
- name: Install Golang
uses: actions/setup-go@v4
with:
go-version: "1.21.6"
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: "18.4.0"
- name: Export bin paths
run: |
echo "GOPATH=$(go env GOPATH)" >> "$GITHUB_ENV"
echo "GOBIN=$(go env GOPATH)/bin" >> "$GITHUB_ENV"
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Create bin paths
run: |
mkdir -p $GOBIN
- name: Install PostCSS CLI
run: npm i -g postcss-cli
- name: Install Golang Dep
run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- name: Install Packr2
run: go get github.com/gobuffalo/packr/v2/packr2@v2.6.0
- name: Install UPX
run: |
wget https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz
tar -xf upx-3.95-amd64_linux.tar.xz
mv upx-3.95-amd64_linux/upx $GITHUB_WORKSPACE/upx
- name: Process UI
working-directory: server/ui/template
run: |
yarn
postcss styles.css -o dist/styles.css
cp index.html dist/index.html
- name: Install server dependencies
working-directory: server
run: go get
- name: Pack UI files
working-directory: server
run: packr2
- name: Create build folder
working-directory: server
run: mkdir build
- name: Build Linux binary
working-directory: server
run: go build -ldflags "-s -w -X github.com/rumblefrog/source-chat-relay/server/config.SCRVER=${{ env.SCRVER }} -extldflags '-static'" -o build/linux-server
- name: Build ARMv7 binary
working-directory: server
run: |
export GOARCH=arm
export GOARM=7
go build -ldflags "-s -w -X github.com/rumblefrog/source-chat-relay/server/config.SCRVER=${{ env.SCRVER }} -extldflags '-static'" -o build/armv7-server
- name: Build Windows binary
working-directory: server
run: |
export GOOS=windows
go build -ldflags "-s -w -X github.com/rumblefrog/source-chat-relay/server/config.SCRVER=${{ env.SCRVER }} -extldflags '-static'" -o build/windows-server
- name: Upload server artifact
uses: actions/upload-artifact@v3
with:
name: Server
path: server/build/
client:
name: Build Client
runs-on: ubuntu-latest
strategy:
matrix:
sm-version: ["1.10.x", "1.11.x"]
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set version env
run: |
echo "SCRVER=$(git describe --always --long --dirty)" >> "$GITHUB_ENV"
- name: Setup SourcePawn Compiler ${{ matrix.sm-version }}
id: setup-sp
uses: rumblefrog/setup-sp@v1.2.2
with:
version: ${{ matrix.sm-version }}
- name: Create external dependency directory
run: mkdir includes
- name: Update version file
working-directory: client
run: envsubst < SCR-Version.inc > SCR-Version.inc.temp && mv SCR-Version.inc.temp SCR-Version.inc
- name: Fetch plugin dependencies
run: |
wget https://raw.githubusercontent.com/nefarius/sm-ext-socket/master/socket.inc -P includes
wget https://raw.githubusercontent.com/rumblefrog/SM-ByteBuffer-Inc/master/bytebuffer.inc -P includes
wget https://www.doctormckay.com/download/scripting/include/morecolors.inc -P includes
- name: Create build folder
run: mkdir build
- name: Compile client against SM ${{ steps.setup-sp.outputs.version }}
run: spcomp64 -iincludes client/Source-Chat-Relay.sp -o build/Source-Chat-Relay.smx
- name: Upload plugin artifact
if: matrix.sm-version == '1.10.x'
uses: actions/upload-artifact@v3
with:
name: Plugin
path: build/
doc:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: "12.22.12"
- name: Export npm bin path
run: export PATH=$PATH:$(npm bin -g)
- name: Install yarn
run: npm i -g yarn
- name: Install dependencies
working-directory: docs
run: yarn
- name: Build documentation
working-directory: docs
run: yarn gatsby build --prefix-paths