-
Notifications
You must be signed in to change notification settings - Fork 2.2k
62 lines (53 loc) · 2.11 KB
/
ci_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
name: CI Build all products
on:
workflow_call:
jobs:
build_all:
strategy:
matrix:
builds:
- [ FiveM, five, windows ]
- [ RedM, rdr3, windows ]
- [ Server, server, windows ]
- [ Server, server, linux ]
name: ${{ matrix.builds[0] }}${{ matrix.builds[2] == 'linux' && ' (Linux)' || '' }}
runs-on: ${{ matrix.builds[2] == 'windows' && 'windows-latest' || 'ubuntu-20.04' }}
env:
PROGRAM: ${{ matrix.builds[1] }}
PLATFORM: ${{ matrix.builds[2] }}
steps:
- name: Checkout
shell: bash
run: |
# Settings
# - Windows: D is too small, C is big enough, checkout action doesn't allow this.
[[ $PLATFORM = windows ]] && ROOT="C:\b" || ROOT=~/b
ROOT_REPO="$ROOT/$PROGRAM"
ROOT_DEP="$ROOT/dep"
JOB_SLOTS=$(nproc --all);
#JOB_SLOTS=$((JOB_SLOTS * 2)) # can cause heap allocation issues on Windows
# Share with other steps
echo "ROOT_REPO=$ROOT_REPO" >> "$GITHUB_ENV"
echo "ROOT_DEP=$ROOT_DEP" >> "$GITHUB_ENV"
echo "JOB_SLOTS=$JOB_SLOTS" >> "$GITHUB_ENV"
# Checkout all repos
mkdir -p "$ROOT_REPO" && cd "$_" || exit 1
# Call each git command individually, preventing unnecessary checkouts
git init .
git config core.symlinks true
git remote add origin https://github.com/$GITHUB_REPOSITORY.git
git pull origin $GITHUB_REF:PR_BRANCH --depth=1
git submodule update --jobs=$JOB_SLOTS --init --depth=1
- name: Dependencies
shell: bash
run: |
mkdir -p "$ROOT_DEP" && cd "$_" || exit 1
- name: Compile
shell: bash
run: |
cd "$ROOT_REPO"
# messes with current build tools, so clear it
BUILD_SCRIPT=".github/workflows/ci/build_$PLATFORM.sh"
PLATFORM= # clear out, some other scripts consider this variable
chmod +x "$BUILD_SCRIPT"
$BUILD_SCRIPT "$ROOT_DEP" $JOB_SLOTS