Skip to content

Commit

Permalink
[CI] Add premake5-msys2-windows.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarod42 committed Feb 27, 2025
1 parent 1050152 commit 83a8f8e
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/premake5-msys2-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: premake5-msys2-windows

on:
workflow_dispatch:
push:
paths:
- 'resinstaller/**'
- 'src/**'
- 'submodules/**'
- 'test/**'
- '.github/workflows/premake5-msys2-windows.yml'
- 'premake5.lua'

pull_request:
paths:
- 'resinstaller/**'
- 'src/**'
- 'submodules/**'
- 'test/**'
- '.github/workflows/premake5-msys2-windows.yml'
- 'premake5.lua'

jobs:
windows:
runs-on: windows-latest

steps:
- uses: msys2/setup-msys2@v2
with:
update: true
install: >-
make
gcc
python3
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-SDL2_net
mingw-w64-x86_64-SDL2_mixer
mingw-w64-x86_64-libvorbis
mingw-w64-x86_64-libogg
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
fetch-tags: true

- name: install premake5
uses: Jarod42/install-premake5@v4

- name: Retrieve CrashRpt_v.1.4.3_r1645
run: |
curl -o CrashRpt_v.1.4.3_r1645.7z -L https://kumisystems.dl.sourceforge.net/project/crashrpt/CrashRpt_v.1.4.3_r1645.7z
7z x -o"./CrashRpt_v.1.4.3_r1645" "CrashRpt_v.1.4.3_r1645.7z" "lib/*.*" "include/*.*" "bin/CrashRpt1403.dll" "bin/CrashSender1403.exe" "bin/crashrpt_lang.ini"
7z e -o"data/CrashRpt" CrashRpt_v.1.4.3_r1645.7z "lang_files/*.ini"
- name: run premake5
run: premake5.exe gmake --to=solution/gmake --crashRpt_root=CrashRpt_v.1.4.3_r1645

- name: build
shell: msys2 {0}
run: |
cd solution/gmake
make
- name: run tests
run: |
cd solution/gmake/bin/Release
./maxr_tests.exe
- name: prepare for upload # upload-artifact requires a common root path
shell: msys2 {0}
run: |
cd data
python mingw_deploy.py maxr.exe
- name: upload maxr
uses: actions/upload-artifact@v4
with:
name: maxr
path: |
data/**.exe
data/**.dll
40 changes: 40 additions & 0 deletions mingw_deploy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import ntpath
import os
import shutil
import subprocess
import sys

def usage():
print('mingw_deploy application [target-directory]')
print()
print('copy dependent mingw dlls needed by application in target-directory (default to near the application)')
sys.exit(-1)

# main
if __name__ == "__main__":
if len(sys.argv) < 2 or len(sys.argv) > 3:
print('invalid argument')
usage()
application = sys.argv[1]
target_directory = len(sys.argv) > 2 and sys.argv[2] or os.path.dirname(application)
if not os.path.exists(application):
print(application, "not found")
exit(-1)

# Retrieve dependencies from mingw
# so the ones from $(InstallPath)\msys64\mingw32\bin\$(dependencies.dll)
ret = subprocess.run(['cygcheck', application], capture_output=True)
dlls = [
line.strip() for line in ret.stdout.decode().split('\n')
if line.find('clang32') != -1
or line.find('clang64') != -1
or line.find('mingw32') != -1
or line.find('mingw64') != -1
or line.find('ucrt64') != -1
]
# copy dlls in target-directory
if len(dlls) > 0:
print("copy in", target_directory)
for file in dlls:
shutil.copyfile(ntpath.abspath(file), target_directory + '/' + ntpath.basename(file))
print(file, "copied")

0 comments on commit 83a8f8e

Please sign in to comment.