-
Notifications
You must be signed in to change notification settings - Fork 52
120 lines (105 loc) · 3.82 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
117
118
119
120
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/vanilla' }}
uses: "0xDylan/action-auto-releases-n20@v1.1"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
vanilla-linux:
runs-on: ${{ matrix.os }}
strategy:
matrix:
platform: [clang, gcc]
networking: [net, nonet]
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
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 ninja-build > /dev/null
- name: Configure Vanilla Conquer
env:
CC: ${{ steps.vars.outputs.cc }}
CXX: ${{ steps.vars.outputs.cxx }}
run: |
cmake --preset ${{ matrix.platform }}-vanilla-${{ matrix.networking }}-tests
- name: Check formatting
if: ${{ matrix.platform }} == clang
run: |
cmake --build build --target format
git diff --exit-code
- name: Build Vanilla Conquer
run: |
cmake --build build
cp ./build/vanillatd ./build/vanillatd.dbg
cp ./build/vanillara ./build/vanillara.dbg
cp ./build/vanillamix ./build/vanillamix.dbg
strip --strip-all ./build/vanillatd
strip --strip-all ./build/vanillara
strip --strip-all ./build/vanillamix
objcopy --add-gnu-debuglink=./build/vanillatd.dbg ./build/vanillatd
objcopy --add-gnu-debuglink=./build/vanillara.dbg ./build/vanillara
objcopy --add-gnu-debuglink=./build/vanillamix.dbg ./build/vanillamix
- name: Run unit tests
run: |
cd build
ctest
- name: Create archives
if: ${{ matrix.networking == 'net' }}
run: |
mkdir artifact
7z a artifact/vanilla-conquer-linux-${{ matrix.platform }}-${{ matrix.os }}-x86_64-${{ steps.gitinfo.outputs.sha_short }}.zip ./build/vanillatd ./build/vanillara ./build/vanillamix
7z a artifact/vanilla-conquer-linux-${{ matrix.platform }}-${{ matrix.os }}-x86_64-${{ steps.gitinfo.outputs.sha_short }}-debug.zip ./build/vanillatd.dbg ./build/vanillara.dbg ./build/vanillamix.dbg
- name: Upload artifact
if: ${{ matrix.networking == 'net' }}
uses: actions/upload-artifact@v4
with:
name: vanilla-conquer-linux-${{ matrix.platform }}-${{ matrix.os }}-x86_64
path: artifact
- name: Upload development release
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/vanilla' && matrix.networking == 'net' }}
uses: softprops/action-gh-release@v2
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/') && matrix.networking == 'net' }}
uses: softprops/action-gh-release@v2
with:
files: |
artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}