Skip to content

Commit a8818f5

Browse files
authored
Central mk.sh script (#688)
* Add mk.sh script * Call as functions from mk.sh * Remove Makefile * mk.sh orchestrates everything * Align builds to filenames * Make an install Gitversion function for Linux to avoid copy paste coding * Fix GitHub rate limiting curl * ver_quad instead of ver_nsis * Update meson.build to read version variables from file * Refactor post_build.sh to update version parameters in manifest * Add configure action to mk.sh
1 parent 203f40c commit a8818f5

39 files changed

Lines changed: 1120 additions & 747 deletions

.github/workflows/build-all.yaml

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
--security-opt apparmor:unconfined
2020
strategy:
2121
matrix:
22-
flavour: [pkg-appimage-snapshot, pkg-appimage-deployment, pkg-appimage]
22+
flavour: [deployment, test, dev]
2323
steps:
2424
## This is for debugging only and helps developing the workflow.
2525
# - name: Environment Variables
@@ -58,11 +58,14 @@ jobs:
5858
ldconfig
5959
- name: Build Oolite
6060
run: |
61-
ShellScripts/common/build_oolite.sh ${{matrix.flavour}}
61+
./mk.sh build ${{matrix.flavour}} --github-repository="$GITHUB_REPOSITORY"
62+
- name: Package Oolite
63+
run: |
64+
./mk.sh pkg-appimage ${{matrix.flavour}}
6265
- name: Archive installer
6366
uses: actions/upload-artifact@v6
6467
with:
65-
name: oolite-linux-${{matrix.flavour}}
68+
name: oolite-linux-appimage-${{matrix.flavour}}
6669
path: |
6770
build/oolite*.AppImage
6871
retention-days: 5
@@ -90,11 +93,15 @@ jobs:
9093
fetch-depth: 0
9194
- name: Build flatpak
9295
run: |
93-
installers/flatpak/create_flatpak.sh
96+
echo "Installing gitversion..."
97+
source ShellScripts/Linux/install_gitversion_fn.sh
98+
mkdir -p /usr/local/bin
99+
install_gitversion "."
100+
./mk.sh pkg-flatpak deployment --github-repository="$GITHUB_REPOSITORY"
94101
- name: Archive installer
95102
uses: actions/upload-artifact@v6
96103
with:
97-
name: oolite-flatpak
104+
name: oolite-linux-flatpak-deployment
98105
path: |
99106
build/space.oolite.Oolite*.flatpak
100107
retention-days: 5
@@ -103,7 +110,7 @@ jobs:
103110
runs-on: windows-latest
104111
strategy:
105112
matrix:
106-
flavour: [pkg-win-snapshot, pkg-win-deployment, pkg-win]
113+
flavour: [deployment, test, dev]
107114
steps:
108115
## This is for debugging only and helps developing the workflow.
109116
# - name: Environment Variables
@@ -117,6 +124,7 @@ jobs:
117124
- name: Set up MSYS2
118125
uses: msys2/setup-msys2@v2
119126
with:
127+
msystem: UCRT64
120128
update: true
121129
cache: false
122130
- name: Checkout Oolite
@@ -139,12 +147,20 @@ jobs:
139147
shell: msys2 {0}
140148
env:
141149
msystem: UCRT64
150+
PYTHONUTF8: "1"
151+
run: |
152+
./mk.sh build ${{matrix.flavour}} --github-repository="$GITHUB_REPOSITORY"
153+
- name: Package Oolite
154+
shell: msys2 {0}
155+
env:
156+
msystem: UCRT64
157+
PYTHONUTF8: "1"
142158
run: |
143-
ShellScripts/common/build_oolite.sh ${{matrix.flavour}}
159+
./mk.sh pkg-win ${{matrix.flavour}}
144160
- name: Archive installer
145161
uses: actions/upload-artifact@v6
146162
with:
147-
name: oolite-windows-${{matrix.flavour}}
163+
name: oolite-windows-nsis-${{matrix.flavour}}
148164
path: |
149165
build/OoliteInstall*.exe
150166
retention-days: 5
@@ -164,7 +180,7 @@ jobs:
164180
uses: actions/download-artifact@v7
165181
with:
166182
path: artifacts
167-
- name: Calculate version number and set OOLITE_VERSION
183+
- name: Calculate version number and set VER_FULL
168184
id: version
169185
run: |
170186
set -x
@@ -184,14 +200,14 @@ jobs:
184200
echo "Found AppImage: $APPIMAGE_PATH"
185201
# 3. Run with packageinfo and extract the string inside quotes
186202
chmod +x "$APPIMAGE_PATH"
187-
VERSION_STR=$("$APPIMAGE_PATH" packageinfo | awk -F'"' '/^[[:space:]]*version =/ {print $2; exit}')
188-
if [[ -z "$VERSION_STR" ]]; then
203+
VER_FULL=$("$APPIMAGE_PATH" packageinfo | awk -F'"' '/^[[:space:]]*version =/ {print $2; exit}')
204+
if [[ -z "$VER_FULL" ]]; then
189205
echo "❌ Failed to extract version string from packageinfo output!" >&2
190206
exit 1
191207
fi
192-
echo "Extracted Version: $VERSION_STR"
208+
echo "Extracted Version: $VER_FULL"
193209
# 4. Output the extracted version for subsequent steps
194-
echo "OOLITE_VERSION=$VERSION_STR" >> "$GITHUB_OUTPUT"
210+
echo "VER_FULL=$VER_FULL" >> "$GITHUB_OUTPUT"
195211
- name: Remove old prereleases
196212
if: github.ref == 'refs/heads/master' || endsWith(github.ref, 'maintenance')
197213
uses: s00d/delete-older-releases@0.2.1
@@ -208,17 +224,17 @@ jobs:
208224
with:
209225
repo_token: "${{ secrets.GITHUB_TOKEN }}"
210226
# automatic_release_tag: "latest"
211-
automatic_release_tag: "${{ steps.version.outputs.OOLITE_VERSION }}"
227+
automatic_release_tag: "${{ steps.version.outputs.VER_FULL }}"
212228
prerelease: true
213-
title: "Oolite ${{ steps.version.outputs.OOLITE_VERSION }}"
229+
title: "Oolite ${{ steps.version.outputs.VER_FULL }}"
214230
files: |
215-
artifacts/oolite-windows-pkg-win-snapshot/OoliteInstall-*-dev.exe
216-
artifacts/oolite-windows-pkg-win-deployment/OoliteInstall-*.exe
217-
artifacts/oolite-windows-pkg-win/OoliteInstall-*.exe
218-
artifacts/oolite-linux-pkg-appimage-snapshot/*.AppImage
219-
artifacts/oolite-linux-pkg-appimage-deployment/*.AppImage
220-
artifacts/oolite-linux-pkg-appimage/*.AppImage
221-
artifacts/oolite-flatpak/*.flatpak
231+
artifacts/oolite-windows-nsis-deployment/OoliteInstall-*.exe
232+
artifacts/oolite-windows-nsis-test/OoliteInstall-*.exe
233+
artifacts/oolite-windows-nsis-dev/OoliteInstall-*-dev.exe
234+
artifacts/oolite-linux-appimage-deployment/*.AppImage
235+
artifacts/oolite-linux-appimage-test/*.AppImage
236+
artifacts/oolite-linux-appimage-dev/*.AppImage
237+
artifacts/oolite-linux-flatpak-deployment/*.flatpak
222238
- name: Remove old workflow runs
223239
if: github.ref == 'refs/heads/master' || endsWith(github.ref, 'maintenance')
224240
uses: Mattraks/delete-workflow-runs@v2

.github/workflows/test_builds.yaml

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
cat << EOF >> ~/.curlrc
3333
header = "Authorization: Bearer $GITHUB_TOKEN"
3434
header = "Accept: application/vnd.github+json"
35-
EOF
35+
EOF
3636
- uses: actions/checkout@v6
3737
with:
3838
fetch-depth: 0
@@ -47,17 +47,16 @@ jobs:
4747
- name: Install Mozilla static library
4848
run: |
4949
ShellScripts/Linux/install_mozilla_js.sh system
50-
- name: Build and test Oolite
51-
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
50+
- name: Build Oolite
5251
run: |
53-
ShellScripts/common/build_oolite.sh test
54-
- name: Build Oolite (no test)
55-
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
52+
./mk.sh build dev
53+
- name: Test Oolite
54+
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
5655
run: |
57-
ShellScripts/common/build_oolite.sh
56+
./mk.sh test dev
5857
- name: Build AppImage
5958
run: |
60-
ShellScripts/common/build_oolite.sh pkg-appimage-snapshot
59+
./mk.sh pkg-appimage dev
6160
6261
fedora:
6362
runs-on: ubuntu-latest
@@ -82,7 +81,7 @@ jobs:
8281
cat << EOF >> ~/.curlrc
8382
header = "Authorization: Bearer $GITHUB_TOKEN"
8483
header = "Accept: application/vnd.github+json"
85-
EOF
84+
EOF
8685
- uses: actions/checkout@v6
8786
with:
8887
fetch-depth: 0
@@ -97,17 +96,16 @@ jobs:
9796
ShellScripts/Linux/install_mozilla_js.sh system
9897
echo "/usr/local/lib64" | tee -a /etc/ld.so.conf
9998
ldconfig
100-
- name: Build and test Oolite
101-
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
99+
- name: Build Oolite
102100
run: |
103-
ShellScripts/common/build_oolite.sh test
104-
- name: Build Oolite (no test)
105-
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
101+
./mk.sh build dev
102+
- name: Test Oolite
103+
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
106104
run: |
107-
ShellScripts/common/build_oolite.sh
105+
./mk.sh test dev
108106
- name: Build AppImage
109107
run: |
110-
ShellScripts/common/build_oolite.sh pkg-appimage-snapshot
108+
./mk.sh pkg-appimage dev
111109
112110
arch:
113111
runs-on: ubuntu-latest
@@ -132,7 +130,7 @@ jobs:
132130
cat << EOF >> ~/.curlrc
133131
header = "Authorization: Bearer $GITHUB_TOKEN"
134132
header = "Accept: application/vnd.github+json"
135-
EOF
133+
EOF
136134
- uses: actions/checkout@v6
137135
with:
138136
fetch-depth: 0
@@ -147,17 +145,16 @@ jobs:
147145
ShellScripts/Linux/install_mozilla_js.sh system
148146
echo "/usr/local/lib" | tee -a /etc/ld.so.conf
149147
ldconfig
150-
- name: Build and test Oolite
151-
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
148+
- name: Build Oolite
152149
run: |
153-
ShellScripts/common/build_oolite.sh test
154-
- name: Build Oolite (no test)
155-
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
150+
./mk.sh build dev
151+
- name: Test Oolite
152+
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
156153
run: |
157-
ShellScripts/common/build_oolite.sh
154+
./mk.sh test dev
158155
- name: Build AppImage
159156
run: |
160-
ShellScripts/common/build_oolite.sh pkg-appimage-snapshot
157+
./mk.sh pkg-appimage dev
161158
162159
windows:
163160
runs-on: windows-latest
@@ -191,18 +188,20 @@ jobs:
191188
EOF
192189
cp ~/.curlrc /c/Users/runneradmin/.curlrc 2>/dev/null || true
193190
ShellScripts/Windows/install_deps.sh clang
194-
- name: Build and test Oolite
195-
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
191+
192+
- name: Build Oolite
196193
shell: msys2 {0}
197194
env:
198195
msystem: UCRT64
196+
PYTHONUTF8: "1"
199197
run: |
200-
ShellScripts/common/build_oolite.sh test
198+
./mk.sh build dev
201199
202-
- name: Build Oolite (no test)
203-
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
200+
- name: Test Oolite
201+
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
204202
shell: msys2 {0}
205203
env:
206204
msystem: UCRT64
205+
PYTHONUTF8: "1"
207206
run: |
208-
ShellScripts/common/build_oolite.sh
207+
./mk.sh test dev

Makefile

Lines changed: 0 additions & 97 deletions
This file was deleted.

0 commit comments

Comments
 (0)