-
Notifications
You must be signed in to change notification settings - Fork 15
143 lines (122 loc) · 3.78 KB
/
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
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
name: Continuous Integration
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
defaults:
run:
shell: ${{ matrix.config.shell }}
strategy:
fail-fast: false
matrix:
config:
- name: Linux GCC
os: ubuntu-latest
compiler: gcc
shell: bash
suffix: ""
- name: MSYS2 MINGW64
os: windows-latest
compiler: gcc
shell: 'msys2 {0}'
msystem: mingw64
msys-env: mingw-w64-x86_64
suffix: "-win64"
- name: MSYS2 MINGW32
os: windows-latest
compiler: gcc
shell: 'msys2 {0}'
msystem: mingw32
msys-env: mingw-w64-i686
suffix: "-win32"
- name: macOS Clang
os: macos-latest
compiler: clang
shell: bash
suffix: "-macos"
steps:
- name: Install build dependencies (Chocolatey, Windows)
if: runner.os == 'Windows'
shell: cmd
run: choco install pandoc
- name: Install build dependencies (MSYS, Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.msystem }}
path-type: inherit
update: true
install: >-
autotools
base-devel
dos2unix
git
zip
${{ matrix.config.msys-env}}-gcc
${{ matrix.config.msys-env}}-python
${{ matrix.config.msys-env}}-SDL2
- name: Install build dependencies (Homebrew, macOS)
if: runner.os == 'macOS'
run: brew install sdl2 autoconf automake libtool pandoc
- name: Install build dependencies (apt, Linux)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt -q install libsdl2-dev
- uses: actions/checkout@v4
- name: Find Git version
id: version
run: |
if git describe --exact-match --tags >/dev/null; then
VERSION=$(git describe --exact-match --tags)
VERSION=${VERSION/#sdl-sopwith-/}
else
VERSION=$(git rev-parse --short HEAD)
fi
VERSION=$VERSION${{ matrix.config.suffix }}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
# Patch the version in configure.ac:
sed -i.old "s/\(AC_INIT([^,]*, \)\[[^]]*\], /\1[$VERSION], /" \
configure.ac
- name: autogen
run: |
./autogen.sh
- name: make
run: make -j8
- name: make check
run: make check
- name: autotools dist check
if: runner.os == 'Linux'
run: |
# This checks we can go through the entire process of generating
# a distribution package with autotools, and that the package can
# be built and installed successfully.
make distdir distdir=distdir
cd distdir
./configure
make -j4
make install DESTDIR=/tmp/asdfghj
- name: Build package (Windows)
if: runner.os == 'Windows'
run: |
cd pkg/win32
make
- name: Upload build (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
path: "pkg/win32/staging"
name: sdl-sopwith-${{steps.version.outputs.VERSION}}
- name: Build package (macOS)
if: runner.os == 'macOS'
run: |
cd pkg/macos
make PACKAGE_VERSION=${{steps.version.outputs.VERSION}} \
PACKAGE_STRING="Sopwith build ${{steps.version.outputs.VERSION}}"
- name: Upload build (macOS)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
path: "pkg/macos/sdl-sopwith-${{steps.version.outputs.VERSION}}.dmg"
name: sdl-sopwith-${{steps.version.outputs.VERSION}}