Skip to content

Commit 7754d0d

Browse files
committed
Add compile on PR workflow
1 parent ad8e0d4 commit 7754d0d

1 file changed

Lines changed: 112 additions & 0 deletions

File tree

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Builds when a PR is opened.
2+
name: PR Compile Test
3+
4+
on: pull_request
5+
6+
jobs:
7+
build:
8+
name: Build for ${{ matrix.os_short }} using sm-${{ matrix.sm_branch }}
9+
runs-on: ${{ matrix.os }}
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os:
15+
- ubuntu-20.04
16+
- windows-latest
17+
include:
18+
- meta_branch: "1.10-dev"
19+
sm_branch: "1.10-dev"
20+
spcomp_version: "1.10.x"
21+
22+
- os: ubuntu-20.04
23+
os_short: linux
24+
package_ext: tar.gz
25+
26+
- os: windows-latest
27+
os_short: win
28+
package_ext: zip
29+
30+
steps:
31+
- name: Prepare env
32+
shell: bash
33+
run: |
34+
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
35+
36+
- name: Install (Linux)
37+
if: runner.os == 'Linux'
38+
run: |
39+
sudo dpkg --add-architecture i386
40+
sudo apt-get update
41+
sudo apt-get install -y clang g++-multilib
42+
echo "CC=clang" >> $GITHUB_ENV
43+
echo "CXX=clang++" >> $GITHUB_ENV
44+
45+
- name: Add msbuild to PATH (Windows)
46+
if: runner.os == 'Windows'
47+
uses: microsoft/setup-msbuild@v1.1
48+
49+
- name: Install (Windows)
50+
if: runner.os == 'Windows'
51+
shell: cmd
52+
run: |
53+
:: See https://github.com/microsoft/vswhere/wiki/Find-VC
54+
for /f "usebackq delims=*" %%i in (`vswhere -latest -property installationPath`) do (
55+
call "%%i"\Common7\Tools\vsdevcmd.bat -arch=x86 -host_arch=x64
56+
)
57+
58+
:: Loop over all environment variables and make them global.
59+
for /f "delims== tokens=1,2" %%a in ('set') do (
60+
echo>>"%GITHUB_ENV%" %%a=%%b
61+
)
62+
63+
64+
- name: Fetch Metamod:Source ${{ matrix.meta_branch }}
65+
uses: actions/checkout@v2
66+
with:
67+
repository: alliedmodders/metamod-source
68+
ref: ${{ matrix.meta_branch }}
69+
path: mmsource
70+
71+
- name: Fetch SourceMod ${{ matrix.sm_branch }}
72+
uses: actions/checkout@v2
73+
with:
74+
repository: alliedmodders/sourcemod
75+
ref: ${{ matrix.sm_branch }}
76+
path: sourcemod
77+
submodules: recursive
78+
79+
- name: Checkout AMBuild
80+
uses: actions/checkout@v3
81+
with:
82+
repository: alliedmodders/ambuild
83+
path: ambuild
84+
85+
- name: Set up Python
86+
uses: actions/setup-python@v4
87+
with:
88+
python-version: '3.x'
89+
90+
- name: Set up spcomp
91+
uses: rumblefrog/setup-sp@v1.2.2
92+
with:
93+
version: ${{ matrix.spcomp_version }}
94+
no-spcomp-proxy: true
95+
96+
- name: Checkout ambuild
97+
run: |
98+
python -m pip install wheel
99+
pip install git+https://github.com/alliedmodders/ambuild
100+
101+
- name: Checkout project
102+
uses: actions/checkout@v3
103+
with:
104+
path: src
105+
106+
- name: Build Files
107+
working-directory: src
108+
run: |
109+
mkdir build
110+
cd build
111+
python3 ../configure.py --sm-path="${{ github.workspace }}/sourcemod" --mms-path="${{ github.workspace }}/mmsource" --symbol-files --enable-optimize
112+
ambuild

0 commit comments

Comments
 (0)