forked from TheAssemblyArmada/Vanilla-Conquer
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (101 loc) · 3.57 KB
/
linux.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
name: linux
on:
pull_request:
push:
jobs:
create_dev_release:
runs-on: ubuntu-22.04
steps:
- name: Create Development release
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/primary' }}
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
mocha-linux:
runs-on: ubuntu-22.04
strategy:
matrix:
platform: [clang, gcc]
steps:
- uses: actions/[email protected]
with:
submodules: 'true'
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set Git Info
id: gitinfo
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set variables
id: vars
run: |
if [ "${{ matrix.platform }}" = "clang" ]
then
echo "cc=clang" >> $GITHUB_OUTPUT
echo "cxx=clang++" >> $GITHUB_OUTPUT
else
echo "cc=gcc" >> $GITHUB_OUTPUT
echo "cxx=g++" >> $GITHUB_OUTPUT
fi
- name: Install dependencies
run: |
sudo apt-get update -qq > /dev/null
sudo apt-get install -qq -y clang-format-14 libsdl2-dev libopenal-dev > /dev/null
- name: Configure Mocha Conquer
env:
CC: ${{ steps.vars.outputs.cc }}
CXX: ${{ steps.vars.outputs.cxx }}
run: |
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DMAP_EDITORTD=ON -DMAP_EDITORRA=ON -DBUILD_TOOLS=ON -DBUILD_TESTS=ON -B build
- name: Check formatting
if: ${{ matrix.platform }} == clang
run: |
cmake --build build --target format
git diff --exit-code
- name: Build Mocha Conquer
run: |
cmake --build build -- -j 4
cp ./build/mochatd ./build/mochatd.dbg
cp ./build/mochara ./build/mochara.dbg
cp ./build/mochamix ./build/mochamix.dbg
strip --strip-all ./build/mochatd
strip --strip-all ./build/mochara
strip --strip-all ./build/mochamix
objcopy --add-gnu-debuglink=./build/mochatd.dbg ./build/mochatd
objcopy --add-gnu-debuglink=./build/mochara.dbg ./build/mochara
objcopy --add-gnu-debuglink=./build/mochamix.dbg ./build/mochamix
- name: Run unit tests
run: |
cd build
ctest
- name: Create archives
run: |
mkdir artifact
7z a artifact/mocha-conquer-linux-${{ matrix.platform }}-x86_64-${{ steps.gitinfo.outputs.sha_short }}.zip ./build/mochatd ./build/mochara ./build/mochamix
7z a artifact/mocha-conquer-linux-${{ matrix.platform }}-x86_64-${{ steps.gitinfo.outputs.sha_short }}-debug.zip ./build/mochatd.dbg ./build/mochara.dbg ./build/mochamix.dbg
- name: Upload artifact
uses: actions/[email protected]
with:
name: mocha-conquer-linux-${{ matrix.platform }}-x86_64
path: artifact
- name: Upload development release
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/primary' }}
uses: softprops/action-gh-release@v1
with:
name: Development Build
tag_name: "latest"
prerelease: true
files: |
artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload tagged release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v1
with:
files: |
artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}