Skip to content

Commit 3ee74a3

Browse files
committed
Let github do the heavy lifting for demo builds.
To lazy to adapt my dev environment for * AppImages * Windows executables Triggered by any tag that begins with "buildMeADemo-". Only requirement is that this commit has been cherry-picked into the branch for which I want a demo. Note: Use `git push origin buildMeADemo-2` (adapted to latest one) instead of GUI's "push all" tags. To prevent a mess.
1 parent 0f262a1 commit 3ee74a3

1 file changed

Lines changed: 216 additions & 0 deletions

File tree

.github/workflows/r1do-demo.yml

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
name: r1do-demo-builds
2+
on:
3+
# R1do: Would be nice if openxcom could add next line to `nightly.yml`` (uncommented) as to reuse the workflow.
4+
#workflow_call:
5+
push:
6+
tags:
7+
- 'buildMeADemo-*'
8+
jobs:
9+
# R1do: Then I would probably only need the next 2 lines.
10+
#call-workflow:
11+
#uses: OpenXcom/OpenXcom/.github/workflows/nightly.yml
12+
#
13+
# Fork owner also needs to adapt the actions permission setting, (using the most restrictive one) named:
14+
# "Allow $FORK_OWNER, and select non-$FORK_OWNER, actions and reusable workflows"
15+
# Allow the following actions/workflows:
16+
# joncloud/makensis-action@v5.0,microsoft/setup-msbuild@v2,miurahr/install-linuxdeploy-action@v1,nrwl/nx-set-shas@v4,transifex/cli-action@v2
17+
#
18+
windows:
19+
name: Windows
20+
runs-on: windows-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Setup Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.x'
31+
32+
- name: Setup environment
33+
shell: bash
34+
run: |
35+
echo "DATEFILE=`git log -1 --date=format:\"%Y_%m_%d_%H%M\" --format=\"%ad\"`" >> $GITHUB_ENV
36+
echo "DATEVERSION=`git log -1 --date=format:\"%Y-%m-%d %H:%M\" --format=\"%ad\"`" >> $GITHUB_ENV
37+
38+
- name: Setup version info
39+
shell: bash
40+
run: |
41+
sed -i "s/GAME_VERSION_GIT \"[^\"]*\"/GAME_VERSION_GIT \" git ${{ env.DATEVERSION }}\"/" install/win/version.nsh
42+
sed -i "s/GAME_DATE_GIT \"[^\"]*\"/GAME_DATE_GIT \"${{ env.DATEFILE }}\"/" install/win/version.nsh
43+
44+
sed -i "s/OPENXCOM_VERSION_GIT \"[^\"]*\"/OPENXCOM_VERSION_GIT \" git ${{ env.DATEVERSION }}\"/" src/version.h
45+
46+
echo "FILENAME=openxcom_git_${{ env.DATEFILE }}" >> $GITHUB_ENV
47+
48+
- name: Install XP Toolset
49+
shell: powershell
50+
run: |
51+
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
52+
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
53+
$WorkLoads = '--add Microsoft.VisualStudio.Component.WinXP'
54+
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache')
55+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
56+
if ($process.ExitCode -eq 0) {
57+
Write-Host "components have been successfully added"
58+
} else {
59+
Write-Host "components were not installed"
60+
}
61+
62+
- name: Add msbuild to PATH
63+
uses: microsoft/setup-msbuild@v2
64+
65+
- name: Compile source (x86 & x64)
66+
env:
67+
VC_FLAGS: /v:minimal /m /p:BuildInParallel=true /p:PreferredToolArchitecture=x64 /p:Configuration=Release_XP
68+
run: |
69+
cd src
70+
msbuild OpenXcom.2010.sln ${{ env.VC_FLAGS }} /p:Platform=Win32
71+
msbuild OpenXcom.2010.sln ${{ env.VC_FLAGS }} /p:Platform=x64
72+
cd ..
73+
Rename-Item -Path "bin\Win32\Release_XP" -NewName "Release"
74+
Rename-Item -Path "bin\x64\Release_XP" -NewName "Release"
75+
76+
- name: Pull translations
77+
env:
78+
TX_TOKEN: ${{ secrets.TX_TOKEN }}
79+
if: ${{ env.TX_TOKEN }}
80+
shell: powershell
81+
run: |
82+
Invoke-WebRequest -Uri "https://github.com/transifex/cli/releases/latest/download/tx-windows-amd64.zip" -OutFile "tx.zip"
83+
Expand-Archive -Path "tx.zip"
84+
.\tx\tx.exe --token ${{ secrets.TX_TOKEN }} pull --all --minimum-perc=50
85+
86+
- name: Pull data patch
87+
uses: actions/checkout@v4
88+
with:
89+
repository: OpenXcom/XcomDataPatch
90+
path: ./patch
91+
92+
- name: Copy data to bin
93+
shell: powershell
94+
run: |
95+
Copy-Item -Recurse -ErrorAction SilentlyContinue -Path "translations\openxcom\common\*" -Destination "bin\common"
96+
Copy-Item -Recurse -ErrorAction SilentlyContinue -Path "translations\openxcom\standard\*" -Destination "bin\standard"
97+
Copy-Item -Recurse -ErrorAction SilentlyContinue -Path "translations\openxcom\install\*" -Destination "install"
98+
Copy-Item -Recurse -ErrorAction SilentlyContinue -Path "patch\xcom1\*" -Destination "bin\standard\xcom1"
99+
Copy-Item -Recurse -ErrorAction SilentlyContinue -Path "patch\xcom2\*" -Destination "bin\standard\xcom2"
100+
101+
- name: Set up NSIS
102+
run: |
103+
choco install nsis
104+
cd install\win
105+
python convert_lang.py
106+
cd ..\..
107+
108+
- name: Create nightly installer
109+
uses: joncloud/makensis-action@v5.0
110+
with:
111+
script-file: "install/win/installer.nsi"
112+
113+
- name: Create nightly ZIPs
114+
shell: powershell
115+
run: |
116+
New-Item -ItemType "directory" -Path "artifacts"
117+
Rename-Item -Path "README.md" -NewName "README.txt"
118+
Compress-Archive -Path "bin\Win32\Release\OpenXcom.exe", "bin\Win32\*.dll", "bin\common", "bin\standard", "bin\TFTD", "bin\UFO", "CHANGELOG.txt", "LICENSE.txt", "README.txt" -DestinationPath "artifacts\${{ env.FILENAME }}_win32.zip"
119+
Compress-Archive -Path "bin\x64\Release\OpenXcom.exe", "bin\x64\*.dll", "bin\common", "bin\standard", "bin\TFTD", "bin\UFO", "CHANGELOG.txt", "LICENSE.txt", "README.txt" -DestinationPath "artifacts\${{ env.FILENAME }}_win64.zip"
120+
Copy-Item -Path "install\win\openxcom-v1.0-win.exe" -Destination "artifacts\${{ env.FILENAME }}_win.exe"
121+
122+
- name: Get SHA hashes
123+
uses: nrwl/nx-set-shas@v4
124+
with:
125+
main-branch-name: master
126+
127+
- name: Generate build log
128+
run: |
129+
git log --pretty=format:"<strong>%an, %ad</strong>%n%B" -n 10 --date=iso-local ${{ env.NX_BASE }}..${{ env.NX_HEAD }} > artifacts\${{ env.FILENAME }}.log
130+
131+
- name: Archive artifacts
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: ${{ env.FILENAME }}_windows
135+
path: artifacts/*
136+
137+
linux:
138+
name: Linux
139+
runs-on: ubuntu-22.04
140+
steps:
141+
- name: Checkout
142+
uses: actions/checkout@v4
143+
with:
144+
fetch-depth: 0
145+
146+
- name: Setup environment
147+
run: |
148+
echo "DATEFILE=`git log -1 --date=format:\"%Y_%m_%d_%H%M\" --format=\"%ad\"`" >> $GITHUB_ENV
149+
echo "DATEVERSION=`git log -1 --date=format:\"%Y-%m-%d %H:%M\" --format=\"%ad\"`" >> $GITHUB_ENV
150+
echo "CMAKE_BUILD_PARALLEL_LEVEL=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 2`" >> $GITHUB_ENV
151+
152+
- name: Setup version info
153+
run: |
154+
sed -i "s/OPENXCOM_VERSION_GIT \"[^\"]*\"/OPENXCOM_VERSION_GIT \" git ${{ env.DATEVERSION }}\"/" src/version.h
155+
echo "FILENAME=openxcom_git_${{ env.DATEFILE }}" >> $GITHUB_ENV
156+
157+
- name: Install packages
158+
run: |
159+
sudo apt-get update
160+
sudo apt-get -yq --no-install-suggests --no-install-recommends install appstream libfuse2 libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libyaml-cpp-dev
161+
162+
- name: Install LinuxDeploy
163+
uses: miurahr/install-linuxdeploy-action@v1
164+
with:
165+
plugins: appimage
166+
167+
- name: Pull translations
168+
uses: transifex/cli-action@v2
169+
env:
170+
TX_TOKEN: ${{ secrets.TX_TOKEN }}
171+
if: ${{ env.TX_TOKEN }}
172+
with:
173+
token: ${{ secrets.TX_TOKEN }}
174+
args: pull --all --minimum-perc=50
175+
176+
- name: Pull data patch
177+
uses: actions/checkout@v4
178+
with:
179+
repository: OpenXcom/XcomDataPatch
180+
path: ./patch
181+
182+
- name: Copy data to bin
183+
run: |
184+
cp -rf translations/openxcom/common/. bin/common || :
185+
cp -rf translations/openxcom/standard/. bin/standard || :
186+
cp -rf patch/xcom1/. bin/standard/xcom1 || :
187+
cp -rf patch/xcom2/. bin/standard/xcom2 || :
188+
189+
- name: Compile source code
190+
run: |
191+
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
192+
make -j$(nproc)
193+
make install DESTDIR=AppDir
194+
195+
- name: Generate AppImage
196+
run: |
197+
rm -rf AppDir/usr/share/openxcom/UFO
198+
rm -rf AppDir/usr/share/openxcom/TFTD
199+
linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage
200+
mkdir artifacts
201+
mv OpenXcom-x86_64.AppImage artifacts/${{ env.FILENAME }}-x86_64.AppImage
202+
203+
- name: Get SHA hashes
204+
uses: nrwl/nx-set-shas@v4
205+
with:
206+
main-branch-name: master
207+
208+
- name: Generate build log
209+
run: |
210+
git log --pretty=format:"<strong>%an, %ad</strong>%n%B" -n 10 --date=iso-local ${{ env.NX_BASE }}..${{ env.NX_HEAD }} > artifacts/${{ env.FILENAME }}.log
211+
212+
- name: Archive artifacts
213+
uses: actions/upload-artifact@v4
214+
with:
215+
name: ${{ env.FILENAME }}_linux
216+
path: artifacts/*

0 commit comments

Comments
 (0)