Rework github workflows

This commit is contained in:
Herman S.
2025-09-27 14:32:51 +09:00
parent 339eb21ef7
commit de4b2ec1a7
4 changed files with 198 additions and 427 deletions
+198
View File
@@ -0,0 +1,198 @@
name: CI
on:
push:
paths-ignore:
- '*.md'
- 'docs/**'
- 'LICENSE'
pull_request:
paths-ignore:
- '*.md'
- 'docs/**'
- 'LICENSE'
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@main
- name: Setup
env:
LLVM_VERSION: 19
run: |
UBUNTU_BASE=$(lsb_release -cs)
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt-add-repository "deb http://apt.llvm.org/${UBUNTU_BASE}/ llvm-toolchain-${UBUNTU_BASE}-$LLVM_VERSION main"
sudo apt-get -y update
sudo apt-get -y install clang-format-$LLVM_VERSION
- name: Lint
run: ./xenia-build.py lint --all
build-linux:
name: Build Linux
needs: lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- uses: actions/cache@main
id: cache
with:
key: ${{ hashFiles('tools/build/bin/premake5.exe') }}
path: tools/build/bin/premake5
- name: Setup
run: |
UBUNTU_BASE=$(lsb_release -cs)
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt-add-repository "deb http://apt.llvm.org/${UBUNTU_BASE}/ llvm-toolchain-${UBUNTU_BASE}-20 main"
sudo apt-get -y update
sudo apt-get -y install mesa-vulkan-drivers valgrind libc++-dev libc++abi-dev libgtk-3-dev libsdl2-dev libvulkan-dev libx11-xcb-dev clang-20 ninja-build spirv-tools
# Verify spirv-opt is available
which spirv-opt && spirv-opt --version || echo "Warning: spirv-opt not found in PATH"
git submodule update --init --depth=1 -j$(getconf _NPROCESSORS_ONLN) $(grep -oP '(?<=path = )(?!third_party\/(DirectXShaderCompiler|FidelityFX-(CAS|FSR)|premake-(androidndk|export-compile-commands))).+' .gitmodules)
if [ '${{ steps.cache.outputs.cache-hit }}' != 'true' ]; then
./xenia-build.py premake
cp third_party/premake-core/bin/release/premake5 tools/build/bin
fi
- name: Build
env:
CC: clang-20
CXX: clang++-20
run: ./xenia-build.py build --config=Release
- name: Prepare artifacts
id: prepare_artifacts
run: |
binary=build/bin/Linux/Release/xenia_edge
if [ $(stat -c%s $binary) -le 100000 ]; then
echo "::error::Binary is too small."
fi
chmod +x $binary
mkdir -p artifacts/xenia_edge
cp $binary artifacts/xenia_edge/
cp LICENSE artifacts/xenia_edge/
- name: Upload xenia edge artifacts
if: steps.prepare_artifacts.outcome == 'success'
uses: actions/upload-artifact@main
with:
name: xenia_edge_linux
path: artifacts/xenia_edge
if-no-files-found: error
build-windows:
name: Build Windows
needs: lint
runs-on: windows-2025
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Cache Vulkan SDK
id: cache-vulkan-sdk
uses: actions/cache@v3
with:
path: C:\VulkanSDK
key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/vulkan-sdk.exe') }}
restore-keys: |
${{ runner.os }}-vulkan-sdk-
- name: Cache submodules
id: cache-submodules
uses: actions/cache@v3
with:
path: third_party
key: ${{ runner.os }}-submodules-${{ hashFiles('.gitmodules') }}
- name: Setup
run: |
# Install Vulkan SDK which includes spirv-tools
if (Test-Path -Path "C:\VulkanSDK") {
echo "Vulkan SDK found in cache."
} else {
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "vulkan-sdk.exe"
Start-Process -FilePath "vulkan-sdk.exe" -ArgumentList "--accept-licenses", "--default-answer", "--confirm-command", "install" -Wait
}
$env:VULKAN_SDK = "C:\VulkanSDK\$(Get-ChildItem -Path 'C:\VulkanSDK' -Directory | Select-Object -First 1 -ExpandProperty Name)"
$env:PATH = "$env:VULKAN_SDK\Bin;$env:PATH"
echo "VULKAN_SDK=$env:VULKAN_SDK" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$env:VULKAN_SDK\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# Verify spirv-opt is available
$spirvOptPath = "$env:VULKAN_SDK\Bin\spirv-opt.exe"
if (Test-Path $spirvOptPath) {
& $spirvOptPath --version
echo "spirv-opt found at: $spirvOptPath"
} else {
echo "Warning: spirv-opt.exe not found at expected location"
}
$cacheHit = '${{ steps.cache-submodules.outputs.cache-hit }}'
if ($cacheHit -ne 'true') {
git submodule update --init --depth=1 -j $env:NUMBER_OF_PROCESSORS (Select-String -CaseSensitive '(?<=path = )(?!third_party\/(FidelityFX-(CAS|FSR)|premake-(androidndk|cmake|export-compile-commands))).+' .gitmodules).Matches.Value
}
- name: Build
run: python xenia-build.py build --config=Release --target=src\xenia-app
- name: Prepare artifacts
id: prepare_artifacts
run: |
foreach ($file in 'build\bin\Windows\Release\xenia_edge.exe','build\bin\Windows\Release\xenia_edge.pdb') {
if ((get-item $file).Length -le 100000) {
echo "::error::$file is too small."
}
}
robocopy . build\bin\Windows\Release LICENSE /r:0 /w:0
robocopy build\bin\Windows\Release artifacts\xenia_edge xenia_edge.exe xenia_edge.pdb LICENSE /r:0 /w:0
If ($LastExitCode -le 7) { echo "LastExitCode = $LastExitCode";$LastExitCode = 0 }
- name: Upload xenia edge artifacts
if: steps.prepare_artifacts.outcome == 'success'
uses: actions/upload-artifact@main
with:
name: xenia_edge_windows
path: artifacts\xenia_edge
if-no-files-found: error
release:
name: Create Release
needs: [build-linux, build-windows]
runs-on: ubuntu-latest
if: |
github.repository == 'has207/xenia-edge' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/edge'
steps:
- name: Download Linux artifacts
uses: actions/download-artifact@main
with:
name: xenia_edge_linux
path: linux_artifacts
- name: Download Windows artifacts
uses: actions/download-artifact@main
with:
name: xenia_edge_windows
path: windows_artifacts
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
# Create zips
cd linux_artifacts
7z a ../xenia_edge_linux.zip * -xr!'*.pdb' -mx9 -bb3
cd ../windows_artifacts
7z a ../xenia_edge_windows.zip * -xr!'*.pdb' -mx9 -bb3
cd ..
# Create release
tag=${GITHUB_SHA::7}
gh release create $tag xenia_edge_linux.zip xenia_edge_windows.zip \
--target $GITHUB_SHA -t "xenia_edge" --generate-notes
-54
View File
@@ -1,54 +0,0 @@
name: Create release
on:
workflow_call:
inputs:
os:
required: true
type: string
secrets:
RELEASE_TOKEN:
required: true
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
#- uses: actions/checkout@main
# with:
# repository: ${{ github.repository_owner }}/xenia-edge-releases
- uses: actions/download-artifact@main
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
asset=xenia_edge_${{ inputs.os }}.zip
7z a $asset -xr!'*.pdb' -mx9 -bb3
if [ ! -f $asset ]; then
ls -R
echo "::error::$asset doesn't exist!"
exit 1
fi
if [ $(stat -c%s $asset) -lt 100000 ]; then
ls -R
echo "::error::$asset is too small!"
exit 1
fi
tag=${GITHUB_SHA::7}
create_or_edit_release() {
local tag=$1
local title=$2
if gh release view $tag 2>/dev/null; then
# Release already exists, just upload the asset
gh release upload $tag $asset --clobber
else
# First build creates the release with auto-generated notes
gh release create $tag $asset --target $GITHUB_SHA -t $title --generate-notes
fi
}
create_or_edit_release $tag xenia_edge
-200
View File
@@ -1,200 +0,0 @@
name: Linux build
on:
push:
paths-ignore:
- '.clang-format'
- '.drone.star'
- '.gitattributes'
- '.gitignore'
- '.github/*'
- '.github/workflows/Windows_build.yml'
- '.github/*_TEMPLATE/**'
- '*.bat'
- '*.md'
- '*.ps1'
- '*.txt'
- '*.yml'
- 'docs/**'
- 'src/**/*_windows.*'
- 'src/**/*_android.*'
- 'src/**/*_mac.*'
- 'LICENSE'
pull_request:
paths-ignore:
- '.clang-format'
- '.drone.star'
- '.gitattributes'
- '.gitignore'
- '.github/*'
- '.github/workflows/Windows_build.yml'
- '.github/*_TEMPLATE/**'
- '*.bat'
- '*.md'
- '*.ps1'
- '*.txt'
- '*.yml'
- 'docs/**'
- 'src/**/*_windows.*'
- 'src/**/*_android.*'
- 'src/**/*_mac.*'
- 'LICENSE'
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@main
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- 'src/**'
lint:
name: Lint
needs: changes
if: needs.changes.outputs.src == 'true'
runs-on: ubuntu-24.04
outputs:
#LLVM_VERSION: ${{ steps.setup.outputs.LLVM_VERSION }}
UBUNTU_BASE: ${{ steps.setup.outputs.UBUNTU_BASE }}
steps:
- uses: actions/checkout@main
- name: Setup
id: setup
env:
LLVM_VERSION: 19 # Same as Windows
run: |
UBUNTU_BASE=$(lsb_release -cs)
#echo "LLVM_VERSION=$LLVM_VERSION" >> "$GITHUB_OUTPUT"
echo "UBUNTU_BASE=$UBUNTU_BASE" >> "$GITHUB_OUTPUT"
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt-add-repository "deb http://apt.llvm.org/${UBUNTU_BASE}/ llvm-toolchain-${UBUNTU_BASE}-$LLVM_VERSION main"
sudo apt-get -y update
sudo apt-get -y install clang-format-$LLVM_VERSION
- name: Lint
run: ./xenia-build.py lint --all
build-clang:
name: Build (Clang ${{ matrix.LLVM_VERSION }})
needs: lint
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
LLVM_VERSION: [20] # '${{ needs.lint.outputs.LLVM_VERSION }}'
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Cache build directory
uses: actions/cache@v3
with:
path: build
key: build-linux-clang-${{ matrix.LLVM_VERSION }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
build-linux-clang-${{ matrix.LLVM_VERSION }}-${{ github.ref }}-
- name: Restore file modification times
uses: chetan/git-restore-mtime-action@v2
- uses: actions/cache@main
id: cache
with:
key: ${{ hashFiles('tools/build/bin/premake5.exe') }}
path: tools/build/bin/premake5
- name: Setup
env:
UBUNTU_BASE: ${{ needs.lint.outputs.UBUNTU_BASE }}
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt-add-repository "deb http://apt.llvm.org/${UBUNTU_BASE}/ llvm-toolchain-${UBUNTU_BASE}-${{ matrix.LLVM_VERSION }} main"
sudo apt-get -y update
sudo apt-get -y install mesa-vulkan-drivers valgrind libc++-dev libc++abi-dev libgtk-3-dev libsdl2-dev libvulkan-dev libx11-xcb-dev clang-${{ matrix.LLVM_VERSION }} ninja-build spirv-tools
# Verify spirv-opt is available
which spirv-opt && spirv-opt --version || echo "Warning: spirv-opt not found in PATH"
git submodule update --init --depth=1 -j$(getconf _NPROCESSORS_ONLN) $(grep -oP '(?<=path = )(?!third_party\/(DirectXShaderCompiler|FidelityFX-(CAS|FSR)|premake-(androidndk|export-compile-commands))).+' .gitmodules)
if [ '${{ steps.cache.outputs.cache-hit }}' != 'true' ]; then
./xenia-build.py premake
cp third_party/premake-core/bin/release/premake5 tools/build/bin
fi
- name: Build
env:
CC: clang-${{ matrix.LLVM_VERSION }}
CXX: clang++-${{ matrix.LLVM_VERSION }}
run: ./xenia-build.py build --config=Release
- name: Prepare artifacts
id: prepare_artifacts
run: |
binary=build/bin/Linux/Release/xenia_edge
if [ $(stat -c%s $binary) -le 100000 ]; then
echo "::error::Binary is too small."
fi
chmod +x $binary
mkdir -p artifacts/xenia_edge
cp $binary artifacts/xenia_edge/
cp LICENSE artifacts/xenia_edge/
- name: Upload xenia edge artifacts
if: steps.prepare_artifacts.outcome == 'success'
uses: actions/upload-artifact@main
with:
name: xenia_edge_linux
path: artifacts/xenia_edge
if-no-files-found: error
# build-gcc:
# name: Build (GCC ${{ matrix.GCC_VERSION }})
# needs: lint
# runs-on: ubuntu-24.04
# strategy:
# fail-fast: false
# matrix:
# GCC_VERSION: [14]
# steps:
# - uses: actions/checkout@main
# with:
# fetch-depth: 0
# - name: Setup
# run: |
# sudo apt-get -y update
# sudo apt-get -y install mesa-vulkan-drivers valgrind libc++-dev libc++abi-dev libgtk-3-dev libsdl2-dev libvulkan-dev libx11-xcb-dev g++-${{ matrix.GCC_VERSION }}
# ./xenia-build.py setup
# - name: Build
# env:
# CC: gcc-${{ matrix.GCC_VERSION }}
# CXX: g++-${{ matrix.GCC_VERSION }}
# # AR: ar
# run: ./xenia-build.py build --config=Release
# - name: Prepare artifacts
# id: prepare_artifacts
# run: |
# if [ $(stat -c %s build/bin/Linux/Release/xenia_edge) -le 100000 ]; then
# echo "::error::Binary is too small."
# fi
# mkdir -p artifacts
# cp -r build/bin/Linux/Release/xenia_edge LICENSE artifacts
# - name: Upload xenia edge artifacts
# if: steps.prepare_artifacts.outcome == 'success'
# uses: actions/upload-artifact@main
# with:
# name: xenia_edge_linux_gcc
# path: artifacts
# if-no-files-found: error
create-release:
name: Create release
needs: [lint, build-clang] #build-gcc
if: |
github.repository == 'has207/xenia-edge' &&
github.event.action != 'pull_request' &&
github.ref == 'refs/heads/edge'
uses: ./.github/workflows/Create_release.yml
with:
os: linux
secrets:
RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-173
View File
@@ -1,173 +0,0 @@
name: Windows build
on:
push:
paths-ignore:
- '.clang-format'
- '.drone.star'
- '.gitattributes'
- '.gitignore'
- '.gdbinit'
- '.github/*'
- '.github/workflows/Linux_build.yml'
- '.github/*_TEMPLATE/**'
- '*.md'
- '*.yml'
- '*.txt'
- 'docs/**'
- 'src/**/*_posix.*'
- 'src/**/*_linux.*'
- 'src/**/*_gnulinux.*'
- 'src/**/*_x11.*'
- 'src/**/*_gtk.*'
- 'src/**/*_android.*'
- 'src/**/*_mac.*'
- 'LICENSE'
pull_request:
paths-ignore:
- '.clang-format'
- '.drone.star'
- '.gitattributes'
- '.gitignore'
- '.gdbinit'
- '.github/*'
- '.github/workflows/Linux_build.yml'
- '.github/*_TEMPLATE/**'
- '*.md'
- '*.yml'
- '*.txt'
- 'docs/**'
- 'src/**/*_posix.*'
- 'src/**/*_linux.*'
- 'src/**/*_gnulinux.*'
- 'src/**/*_x11.*'
- 'src/**/*_gtk.*'
- 'src/**/*_android.*'
- 'src/**/*_mac.*'
- 'LICENSE'
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@main
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- 'src/**'
lint:
name: Lint
needs: changes
if: needs.changes.outputs.src == 'true'
runs-on: windows-latest
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
steps:
- uses: actions/checkout@main
- name: Lint
run: python xenia-build.py lint --all
build:
name: Build
needs: lint
runs-on: windows-2025
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Cache build directory
uses: actions/cache@v3
with:
path: build
key: build-windows-${{ github.ref }}-${{ github.sha }}
restore-keys: |
build-windows-${{ github.ref }}-
- name: Cache Vulkan SDK
id: cache-vulkan-sdk
uses: actions/cache@v3
with:
path: C:\VulkanSDK
key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/vulkan-sdk.exe') }}
restore-keys: |
${{ runner.os }}-vulkan-sdk-
- name: Cache submodules
id: cache-submodules
uses: actions/cache@v3
with:
path: third_party
key: ${{ runner.os }}-submodules-${{ hashFiles('.gitmodules') }}
- name: Restore file modification times
uses: chetan/git-restore-mtime-action@v2
- name: Setup
run: |
# Install Vulkan SDK which includes spirv-tools
if (Test-Path -Path "C:\VulkanSDK") {
echo "Vulkan SDK found in cache."
} else {
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "vulkan-sdk.exe"
Start-Process -FilePath "vulkan-sdk.exe" -ArgumentList "--accept-licenses", "--default-answer", "--confirm-command", "install" -Wait
}
$env:VULKAN_SDK = "C:\VulkanSDK\$(Get-ChildItem -Path 'C:\VulkanSDK' -Directory | Select-Object -First 1 -ExpandProperty Name)"
$env:PATH = "$env:VULKAN_SDK\Bin;$env:PATH"
echo "VULKAN_SDK=$env:VULKAN_SDK" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$env:VULKAN_SDK\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# Verify spirv-opt is available
$spirvOptPath = "$env:VULKAN_SDK\Bin\spirv-opt.exe"
if (Test-Path $spirvOptPath) {
& $spirvOptPath --version
echo "spirv-opt found at: $spirvOptPath"
} else {
echo "Warning: spirv-opt.exe not found at expected location"
}
$cacheHit = '${{ steps.cache-submodules.outputs.cache-hit }}'
if ($cacheHit -ne 'true') {
git submodule update --init --depth=1 -j $env:NUMBER_OF_PROCESSORS (Select-String -CaseSensitive '(?<=path = )(?!third_party\/(FidelityFX-(CAS|FSR)|premake-(androidndk|cmake|export-compile-commands))).+' .gitmodules).Matches.Value
}
- name: Build
run: python xenia-build.py build --config=Release --target=src\xenia-app
- name: Prepare artifacts
id: prepare_artifacts
run: |
foreach ($file in 'build\bin\Windows\Release\xenia_edge.exe','build\bin\Windows\Release\xenia_edge.pdb') {
if ((get-item $file).Length -le 100000) {
echo "::error::$file is too small."
}
}
robocopy . build\bin\Windows\Release LICENSE /r:0 /w:0
robocopy build\bin\Windows\Release artifacts\xenia_edge xenia_edge.exe xenia_edge.pdb LICENSE /r:0 /w:0
If ($LastExitCode -le 7) { echo "LastExitCode = $LastExitCode";$LastExitCode = 0 }
- name: Upload xenia edge artifacts
if: steps.prepare_artifacts.outcome == 'success'
uses: actions/upload-artifact@main
with:
name: xenia_edge_windows
path: artifacts\xenia_edge
if-no-files-found: error
create-release:
name: Create release
needs: [lint, build]
if: |
github.repository == 'has207/xenia-edge' &&
github.event.action != 'pull_request' &&
github.ref == 'refs/heads/edge'
uses: ./.github/workflows/Create_release.yml
with:
os: windows
secrets:
RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN }}