Commit 5fd6cd19 authored by mercury233's avatar mercury233 Committed by GitHub

add CI override, refactor downloading dependencies in CI (#2999)

parent e69da396
......@@ -11,71 +11,97 @@ on:
branches: [ "master" ]
jobs:
build-windows:
strategy:
fail-fast: false
matrix:
name:
- windows
# - windows-irrklang
# - windows-no-dxsdk
- windows-x64
# - windows-2025
include:
- name: windows
os: windows-2022
vs: vs2022
audiolib: miniaudio
# - name: windows-irrklang
# os: windows-2022
# vs: vs2022
# audiolib: irrklang
# - name: windows-no-dxsdk
# os: windows-2022
# vs: vs2022
# audiolib: miniaudio
# nodxsdk: true
- name: windows-x64
os: windows-2022
vs: vs2022
audiolib: miniaudio
x64: true
# - name: windows-2025
# os: windows-2025
# vs: vs2025 # to be enabled after the release of Visual Studio 2025
# audiolib: miniaudio
runs-on: ${{ matrix.os }}
prepare:
runs-on: ubuntu-latest
outputs:
ocgcore-url: ${{ steps.parse-pr-override.outputs.ocgcore-url }}
ocgcore-branch: ${{ steps.parse-pr-override.outputs.ocgcore-branch }}
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Parse pull request description for dependency overrides
id: parse-pr-override
env:
PR_BODY: ${{ github.event.pull_request.body }}
shell: python
run: |
# You can override the URLs and branches of dependencies by adding lines in the pull request description.
# This is useful when you want to test changes which require modifications in the submodules or dependencies.
# Expected description format:
# > name: owner/repo@branch
# (leading >, dependency name, followed by GitHub repository, optional branch)
# Example:
# > ocgcore: mercury233/ygopro-core@patch-branch
# Supported dependencies:
# ocgcore, irrlicht
import re, os
body = os.environ.get('PR_BODY', '')
# Default URLs and branches for dependencies
ocgcore_url = 'https://github.com/Fluorohydride/ygopro-core'
ocgcore_branch = ''
irrlicht_url = 'https://github.com/mercury233/irrlicht'
irrlicht_branch = ''
# Regex patterns for parsing:
# REPO_RE: matches format "owner/repo" (e.g., "user/repo-name")
# BRANCH_RE: matches branch names with dots, slashes, and hyphens (e.g., "feature/my-branch", "v1.0")
REPO_RE = r'[\w][\w.-]*/[\w][\w.-]*'
BRANCH_RE = r'[\w][\w./-]*'
m = re.search(rf'(?m)^\s*>\s*ocgcore\s*:\s*({REPO_RE})(?:@({BRANCH_RE}))?\s*$', body)
if m:
ocgcore_url = f'https://github.com/{m.group(1)}'
if m.group(2):
ocgcore_branch = m.group(2)
m = re.search(rf'(?m)^\s*>\s*irrlicht\s*:\s*({REPO_RE})(?:@({BRANCH_RE}))?\s*$', body)
if m:
irrlicht_url = f'https://github.com/{m.group(1)}'
if m.group(2):
irrlicht_branch = m.group(2)
# Output the parsed URLs and branches for downstream jobs
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write(f'ocgcore-url={ocgcore_url}\n')
f.write(f'ocgcore-branch={ocgcore_branch}\n')
f.write(f'irrlicht-url={irrlicht_url}\n')
f.write(f'irrlicht-branch={irrlicht_branch}\n')
- name: Update submodules
- name: Download irrlicht
run: |
cd ocgcore
git checkout master
git pull origin master
cd ..
# cd script
# git checkout master
# git pull origin master
# cd ..
branch="${{ steps.parse-pr-override.outputs.irrlicht-branch }}"
if [ -n "$branch" ]; then
git clone --depth=1 -b "$branch" ${{ steps.parse-pr-override.outputs.irrlicht-url }} irrlicht
else
git clone --depth=1 ${{ steps.parse-pr-override.outputs.irrlicht-url }} irrlicht
fi
- name: Download premake
id: premake
- name: Download lua
id: lua
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/premake/premake-core/releases/download/v5.0.0-beta7/premake-5.0.0-beta7-windows.zip
filename: premake5.zip
url: https://www.lua.org/ftp/lua-5.4.8.tar.gz
- name: Extract premake
- name: Extract lua
run: |
7z x ${{ steps.premake.outputs.filepath }}
tar xf ${{ steps.lua.outputs.filepath }}
mv lua-5.4.8 lua
- name: Download miniaudio
run: |
git clone --depth=1 -b 0.11.23 https://github.com/mackron/miniaudio
cd miniaudio
cp extras/miniaudio_split/miniaudio.* .
cd ..
- name: Upload sources
uses: actions/upload-artifact@v4
with:
name: dependencies-sources
path: |
lua/
miniaudio/
irrlicht/
prepare-static-dependencies:
runs-on: ubuntu-latest
steps:
- name: Download libevent
id: libevent
uses: mercury233/action-cache-download-file@v1.0.0
......@@ -86,7 +112,7 @@ jobs:
- name: Extract libevent
run: |
tar xf ${{ steps.libevent.outputs.filepath }}
move libevent-2.1.12-stable event
mv libevent-2.1.12-stable event
- name: Download freetype
id: freetype
......@@ -97,18 +123,7 @@ jobs:
- name: Extract freetype
run: |
tar xf ${{ steps.freetype.outputs.filepath }}
move freetype-2.13.3 freetype
- name: Download lua
id: lua
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.lua.org/ftp/lua-5.4.8.tar.gz
- name: Extract lua
run: |
tar xf ${{ steps.lua.outputs.filepath }}
move lua-5.4.8 lua
mv freetype-2.13.3 freetype
- name: Download sqlite
id: sqlite
......@@ -119,67 +134,146 @@ jobs:
- name: Extract sqlite
run: |
7z x ${{ steps.sqlite.outputs.filepath }}
move sqlite-amalgamation-3500100 sqlite3
mv sqlite-amalgamation-3500100 sqlite3
- name: Download miniaudio
if: matrix.audiolib == 'miniaudio'
- name: Create miniaudio external directory
run: |
git clone --depth=1 -b 0.11.23 https://github.com/mackron/miniaudio
cd miniaudio
xcopy /Y extras\miniaudio_split\miniaudio.* .
cd ..
mkdir -p miniaudio/external
- name: Download ogg
if: matrix.audiolib == 'miniaudio'
id: ogg
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/ogg/releases/download/v1.3.5/libogg-1.3.5.tar.gz
- name: Extract ogg
if: matrix.audiolib == 'miniaudio'
run: |
tar xf ${{ steps.ogg.outputs.filepath }}
move libogg-1.3.5 miniaudio/external/ogg
mv libogg-1.3.5 miniaudio/external/ogg
- name: Download opus
if: matrix.audiolib == 'miniaudio'
id: opus
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz
- name: Extract opus
if: matrix.audiolib == 'miniaudio'
run: |
tar xf ${{ steps.opus.outputs.filepath }}
move opus-1.5.2 miniaudio/external/opus
mv opus-1.5.2 miniaudio/external/opus
- name: Download opusfile
if: matrix.audiolib == 'miniaudio'
id: opusfile
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/opusfile/releases/download/v0.12/opusfile-0.12.tar.gz
- name: Extract opusfile
if: matrix.audiolib == 'miniaudio'
run: |
tar xf ${{ steps.opusfile.outputs.filepath }}
move opusfile-0.12 miniaudio/external/opusfile
mv opusfile-0.12 miniaudio/external/opusfile
- name: Download vorbis
if: matrix.audiolib == 'miniaudio'
id: vorbis
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/vorbis/releases/download/v1.3.7/libvorbis-1.3.7.tar.gz
- name: Extract vorbis
if: matrix.audiolib == 'miniaudio'
run: |
tar xf ${{ steps.vorbis.outputs.filepath }}
move libvorbis-1.3.7 miniaudio/external/vorbis
mv libvorbis-1.3.7 miniaudio/external/vorbis
- name: Upload static dependencies
uses: actions/upload-artifact@v4
with:
name: dependencies-sources-static-link
path: |
event/
freetype/
sqlite3/
miniaudio/
!miniaudio/external/opus/dnn/
build-windows:
needs: [prepare, prepare-static-dependencies]
strategy:
fail-fast: false
matrix:
name:
- windows
# - windows-irrklang
# - windows-no-dxsdk
- windows-x64
# - windows-2025
include:
- name: windows
os: windows-2022
vs: vs2022
audiolib: miniaudio
# - name: windows-irrklang
# os: windows-2022
# vs: vs2022
# audiolib: irrklang
# - name: windows-no-dxsdk
# os: windows-2022
# vs: vs2022
# audiolib: miniaudio
# nodxsdk: true
- name: windows-x64
os: windows-2022
vs: vs2022
audiolib: miniaudio
x64: true
# - name: windows-2025
# os: windows-2025
# vs: vs2025 # to be enabled after the release of Visual Studio 2025
# audiolib: miniaudio
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false
- name: Update submodules
# Here we use override URLs and branches from the prepare job, which can be set by pull request description,
# to make sure we are testing the correct code. Only the ocgcore submodule is required for the build.
run: |
git submodule update --init --no-fetch ocgcore
cd ocgcore
git fetch --depth=1 ${{ needs.prepare.outputs.ocgcore-url }} ${{ needs.prepare.outputs.ocgcore-branch }}
git checkout FETCH_HEAD
cd ..
# cd script
# git checkout master
# git pull origin master
# cd ..
- name: Download prepare sources
uses: actions/download-artifact@v4
with:
name: dependencies-sources
path: .
- name: Download static dependencies sources
uses: actions/download-artifact@v4
with:
name: dependencies-sources-static-link
path: .
- name: Download premake
id: premake
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/premake/premake-core/releases/download/v5.0.0-beta7/premake-5.0.0-beta7-windows.zip
filename: premake5.zip
- name: Extract premake
run: |
7z x ${{ steps.premake.outputs.filepath }}
- name: Download irrKlang
if: matrix.audiolib == 'irrklang'
......@@ -194,10 +288,6 @@ jobs:
7z x ${{ steps.irrKlang.outputs.filepath }}
move irrKlang-1.6.0 irrKlang
- name: Download irrlicht
run: |
git clone --depth=1 https://github.com/mercury233/irrlicht
- name: Check DirectX SDK
if: matrix.nodxsdk != true
id: dxsdk
......@@ -249,6 +339,7 @@ jobs:
bin/release/x64/YGOPro.exe
build-linux:
needs: [prepare, prepare-static-dependencies]
strategy:
fail-fast: false
matrix:
......@@ -271,23 +362,36 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository with submodules
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
submodules: false
- name: Update submodules
run: |
git submodule update --init --no-fetch ocgcore
cd ocgcore
git checkout master
git pull origin master
git fetch --depth=1 ${{ needs.prepare.outputs.ocgcore-url }} ${{ needs.prepare.outputs.ocgcore-branch }}
git checkout FETCH_HEAD
cd ..
# cd script
# git checkout master
# git pull origin master
# cd ..
- name: Download prepare sources
uses: actions/download-artifact@v4
with:
name: dependencies-sources
path: .
- name: Download static dependencies sources
if: matrix.static-link == true
uses: actions/download-artifact@v4
with:
name: dependencies-sources-static-link
path: .
- name: Install dependencies
run: |
sudo apt-get update
......@@ -310,135 +414,23 @@ jobs:
tar xf ${{ steps.premake.outputs.filepath }}
chmod +x ./premake5
- name: Download libevent
if: matrix.static-link == true
id: libevent
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
filename: libevent.tar.gz
- name: Extract libevent
if: matrix.static-link == true
run: |
tar xf ${{ steps.libevent.outputs.filepath }}
mv libevent-2.1.12-stable event
- name: Configure libevent
if: matrix.static-link == true
run: |
cd event
chmod +x configure build-aux/*
./configure --disable-openssl --enable-static=yes --enable-shared=no
sed -f make-event-config.sed < config.h > ./include/event2/event-config.h
cd ..
- name: Download freetype
if: matrix.static-link == true
id: freetype
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://downloads.sourceforge.net/freetype/freetype-2.13.3.tar.gz
- name: Extract freetype
if: matrix.static-link == true
run: |
tar xf ${{ steps.freetype.outputs.filepath }}
mv freetype-2.13.3 freetype
- name: Download lua
id: lua
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.lua.org/ftp/lua-5.4.8.tar.gz
- name: Extract lua
run: |
tar xf ${{ steps.lua.outputs.filepath }}
mv lua-5.4.8 lua
- name: Download sqlite
if: matrix.static-link == true
id: sqlite
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.sqlite.org/2025/sqlite-amalgamation-3500100.zip
- name: Extract sqlite
if: matrix.static-link == true
run: |
7z x ${{ steps.sqlite.outputs.filepath }}
mv sqlite-amalgamation-3500100 sqlite3
- name: Download miniaudio
run: |
git clone --depth=1 -b 0.11.23 https://github.com/mackron/miniaudio
cd miniaudio
cp extras/miniaudio_split/miniaudio.* .
cd ..
- name: Download ogg
if: matrix.static-link == true
id: ogg
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/ogg/releases/download/v1.3.5/libogg-1.3.5.tar.gz
- name: Extract ogg
if: matrix.static-link == true
run: |
tar xf ${{ steps.ogg.outputs.filepath }}
mv libogg-1.3.5 miniaudio/external/ogg
- name: Configure ogg
if: matrix.static-link == true
run: |
cd miniaudio/external/ogg
chmod +x configure
./configure
cd ../../..
- name: Download opus
if: matrix.static-link == true
id: opus
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz
- name: Extract opus
if: matrix.static-link == true
run: |
tar xf ${{ steps.opus.outputs.filepath }}
mv opus-1.5.2 miniaudio/external/opus
- name: Download opusfile
if: matrix.static-link == true
id: opusfile
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/opusfile/releases/download/v0.12/opusfile-0.12.tar.gz
- name: Extract opusfile
if: matrix.static-link == true
run: |
tar xf ${{ steps.opusfile.outputs.filepath }}
mv opusfile-0.12 miniaudio/external/opusfile
- name: Download vorbis
if: matrix.static-link == true
id: vorbis
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/vorbis/releases/download/v1.3.7/libvorbis-1.3.7.tar.gz
- name: Extract vorbis
if: matrix.static-link == true
run: |
tar xf ${{ steps.vorbis.outputs.filepath }}
mv libvorbis-1.3.7 miniaudio/external/vorbis
- name: Download irrlicht
run: |
git clone --depth=1 https://github.com/mercury233/irrlicht
- name: Copy premake files
run: |
cp -pr premake/* .
......@@ -472,6 +464,7 @@ jobs:
bin/release/YGOPro
build-macos:
needs: [prepare, prepare-static-dependencies]
strategy:
fail-fast: false
matrix:
......@@ -498,23 +491,36 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository with submodules
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
submodules: false
- name: Update submodules
run: |
git submodule update --init --no-fetch ocgcore
cd ocgcore
git checkout master
git pull origin master
git fetch --depth=1 ${{ needs.prepare.outputs.ocgcore-url }} ${{ needs.prepare.outputs.ocgcore-branch }}
git checkout FETCH_HEAD
cd ..
# cd script
# git checkout master
# git pull origin master
# cd ..
- name: Download prepare sources
uses: actions/download-artifact@v4
with:
name: dependencies-sources
path: .
- name: Download static dependencies sources
if: matrix.static-link == true
uses: actions/download-artifact@v4
with:
name: dependencies-sources-static-link
path: .
- name: Install dependencies
if: matrix.static-link != true
run: |
......@@ -533,128 +539,15 @@ jobs:
tar xf ${{ steps.premake.outputs.filepath }}
chmod +x ./premake5
- name: Download libevent
if: matrix.static-link == true
id: libevent
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
filename: libevent.tar.gz
- name: Extract libevent
if: matrix.static-link == true
run: |
tar xf ${{ steps.libevent.outputs.filepath }}
mv libevent-2.1.12-stable event
- name: Configure libevent
if: matrix.static-link == true
run: |
cd event
chmod +x configure build-aux/*
./configure --disable-openssl --enable-static=yes --enable-shared=no
sed -f make-event-config.sed < config.h > ./include/event2/event-config.h
cd ..
- name: Download freetype
if: matrix.static-link == true
id: freetype
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://downloads.sourceforge.net/freetype/freetype-2.13.3.tar.gz
- name: Extract freetype
if: matrix.static-link == true
run: |
tar xf ${{ steps.freetype.outputs.filepath }}
mv freetype-2.13.3 freetype
- name: Download lua
id: lua
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.lua.org/ftp/lua-5.4.8.tar.gz
- name: Extract lua
run: |
tar xf ${{ steps.lua.outputs.filepath }}
mv lua-5.4.8 lua
- name: Download sqlite
if: matrix.static-link == true
id: sqlite
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.sqlite.org/2025/sqlite-amalgamation-3500100.zip
- name: Extract sqlite
if: matrix.static-link == true
run: |
7z x ${{ steps.sqlite.outputs.filepath }}
mv sqlite-amalgamation-3500100 sqlite3
- name: Download miniaudio
run: |
git clone --depth=1 -b 0.11.23 https://github.com/mackron/miniaudio
cd miniaudio
cp extras/miniaudio_split/miniaudio.* .
cd ..
- name: Download ogg
if: matrix.static-link == true
id: ogg
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/ogg/releases/download/v1.3.5/libogg-1.3.5.tar.gz
- name: Extract ogg
if: matrix.static-link == true
run: |
tar xf ${{ steps.ogg.outputs.filepath }}
mv libogg-1.3.5 miniaudio/external/ogg
- name: Download opus
if: matrix.static-link == true
id: opus
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz
- name: Extract opus
if: matrix.static-link == true
run: |
tar xf ${{ steps.opus.outputs.filepath }}
mv opus-1.5.2 miniaudio/external/opus
- name: Download opusfile
if: matrix.static-link == true
id: opusfile
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/opusfile/releases/download/v0.12/opusfile-0.12.tar.gz
- name: Extract opusfile
if: matrix.static-link == true
run: |
tar xf ${{ steps.opusfile.outputs.filepath }}
mv opusfile-0.12 miniaudio/external/opusfile
- name: Download vorbis
if: matrix.static-link == true
id: vorbis
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/xiph/vorbis/releases/download/v1.3.7/libvorbis-1.3.7.tar.gz
- name: Extract vorbis
if: matrix.static-link == true
run: |
tar xf ${{ steps.vorbis.outputs.filepath }}
mv libvorbis-1.3.7 miniaudio/external/vorbis
- name: Download irrlicht
run: |
git clone --depth=1 https://github.com/mercury233/irrlicht
- name: Copy premake files
run: |
cp -pr premake/* .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment