-
Notifications
You must be signed in to change notification settings - Fork 6
210 lines (181 loc) · 6.29 KB
/
ci.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: Extension builder
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest, windows-2019, windows-latest]
include:
- os: ubuntu-20.04
release: true
cc: clang-8
cxx: clang++-8
- os: ubuntu-latest
release: false
cc: clang
cxx: clang++
- os: windows-2019
release: true
cc: msvc
- os: windows-latest
release: false
cc: msvc
fail-fast: false
name: ${{ matrix.os }} - ${{ matrix.cc }}
runs-on: ${{ matrix.os }}
env:
# We currently only support tf2 - however when we support more sdks
# we will have to deal with the special case of our custom tf2 + AM's sdks
SDKS: '["tf2"]'
MMSOURCE_VERSION: '1.10'
SOURCEMOD_VERSION: '1.11'
CACHE_PATH: ${{ github.workspace }}/cache
steps:
- uses: actions/checkout@v2
name: Repository checkout
with:
fetch-depth: 0
path: CBaseNPC
- uses: actions/checkout@v2
name: Sourcemod checkout
with:
repository: alliedmodders/sourcemod
ref: ${{ env.SOURCEMOD_VERSION }}-dev
submodules: true
path: cache/sourcemod
- uses: actions/checkout@v2
name: Metamod-Source checkout
with:
repository: alliedmodders/metamod-source
ref: ${{ env.MMSOURCE_VERSION }}-dev
path: cache/metamod
- uses: actions/checkout@v2
name: AMBuild checkout
with:
repository: alliedmodders/ambuild
ref: master
path: cache/ambuild
- uses: actions/checkout@v2
name: Custom TF2 SDK checkout
with:
repository: TF2-DMB/hl2sdk-tf2
ref: tf2
path: cache/hl2sdk-tf2
#- uses: actions/cache@v2
# name: Setup cache
# with:
# path: ${{ env.CACHE_PATH }}
# key: ${{ runner.os }}-mms_${{ env.MMSOURCE_VERSION }}-sm_${{ env.SOURCEMOD_VERSION }}-${{ join(fromJSON(env.SDKS), '') }}
# restore-keys: |
# ${{ runner.os }}-mms_${{ env.MMSOURCE_VERSION }}-sm_${{ env.SOURCEMOD_VERSION }}-${{ join(fromJSON(env.SDKS), '') }}
- uses: actions/setup-python@v2
name: Setup Python 3.8
with:
python-version: 3.8
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Setup AMBuild
working-directory: cache
shell: bash
run: |
pip install ./ambuild
- name: Linux dependencies
if: startsWith(runner.os, 'Linux')
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
gcc-multilib g++-multilib libstdc++6 lib32stdc++6 \
libc6-dev libc6-dev-i386 linux-libc-dev \
linux-libc-dev:i386 lib32z1-dev ${{ matrix.cc }}
- name: Select clang compiler
if: startsWith(runner.os, 'Linux')
run: |
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
${{ matrix.cc }} --version
${{ matrix.cxx }} --version
- name: Build
working-directory: CBaseNPC
run: |
mkdir build
cd build
python ../configure.py --enable-auto-versioning --enable-optimize --sdks=${{ join(fromJSON(env.SDKS)) }} --mms-path=${{ env.CACHE_PATH }}/metamod --hl2sdk-root=${{ env.CACHE_PATH }} --sm-path=${{ env.CACHE_PATH }}/sourcemod
ambuild
- name: Upload artifact
if: github.event_name == 'push' && matrix.release
uses: actions/upload-artifact@v1
with:
name: cbasenpc_${{ runner.os }}
path: ${{ github.workspace }}/CBaseNPC/build/package
- name: Upload artifact
if: github.event_name == 'push' && strategy.job-index == 0
uses: actions/upload-artifact@v1
with:
name: cbasenpc_versioning_files
path: ${{ github.workspace }}/CBaseNPC/build/includes
release:
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: build
steps:
- run: sudo apt-get install -y tree
- name: Download Linux release
uses: actions/download-artifact@v1
with:
name: cbasenpc_Linux
path: cbasenpc_linux
- name: Download Windows release
uses: actions/download-artifact@v1
with:
name: cbasenpc_Windows
path: cbasenpc_windows
- name: Download CBaseNPC verisioning files
uses: actions/download-artifact@v1
with:
name: cbasenpc_versioning_files
path: cbasenpc_versioning_files
- name: Prepare archives
run: |
cd cbasenpc_linux
tar -czf cbasenpc_linux.tar.gz *
cd ../cbasenpc_windows
zip -r cbasenpc_windows.zip .
cd ..
RELEASE="$(cat ./cbasenpc_versioning_files/git_action_release)"
echo "GITHUB_RELEASE_TAG=$RELEASE" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GITHUB_RELEASE_TAG }}
release_name: CBaseNPC ${{ env.GITHUB_RELEASE_TAG }}
body: |
${{ github.event.head_commit.message }}
draft: false
prerelease: false
- name: Upload Linux release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cbasenpc_linux/cbasenpc_linux.tar.gz
asset_name: cbasenpc${{ env.GITHUB_RELEASE_TAG }}_linux.tar.gz
asset_content_type: application/gzip
- name: Upload Windows release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cbasenpc_windows/cbasenpc_windows.zip
asset_name: cbasenpc${{ env.GITHUB_RELEASE_TAG }}_windows.zip
asset_content_type: application/zip