mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-11 16:46:16 +00:00
255 lines
7.7 KiB
YAML
255 lines
7.7 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
pull_request:
|
|
branches:
|
|
- "**"
|
|
types: [opened, synchronize, reopened]
|
|
workflow_dispatch:
|
|
|
|
#concurrency:
|
|
# group: ${{ github.ref }}
|
|
# cancel-in-progress: true
|
|
|
|
jobs:
|
|
verify-formatting:
|
|
name: Verify Formatting
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Checkout Source
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Verify Formatting
|
|
uses: jidicula/clang-format-action@v4.14.0
|
|
with:
|
|
clang-format-version: '19'
|
|
check-path: 'src'
|
|
|
|
|
|
dump-root:
|
|
name: Dump Root FS
|
|
runs-on: ${{ matrix.runner }}
|
|
needs: [build]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- Windows 2025
|
|
- Windows 2022
|
|
- Windows 2019
|
|
include:
|
|
- platform: Windows 2025
|
|
runner: windows-2025
|
|
- platform: Windows 2022
|
|
runner: windows-2022
|
|
- platform: Windows 2019
|
|
runner: windows-2019
|
|
steps:
|
|
- name: Checkout Source
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download Windows Artifacts
|
|
uses: pyTooling/download-artifact@v4
|
|
with:
|
|
name: Windows Release Artifacts
|
|
path: build/release/artifacts
|
|
|
|
- name: Dump Root FS
|
|
run: src/tools/create-root.bat
|
|
|
|
- name: Dump API Set
|
|
run: cd root && ../build/release/artifacts/dump-apiset.exe
|
|
|
|
- name: Upload Artifacts
|
|
uses: pyTooling/upload-artifact@v4
|
|
with:
|
|
name: Temp ${{ matrix.platform }} Root FS
|
|
path: "*"
|
|
working-directory: root
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ${{ matrix.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- Windows
|
|
- Linux GCC
|
|
- Linux Clang
|
|
- macOS arm64
|
|
- macOS x86_64
|
|
- Android x86_64
|
|
- Android arm64-v8a
|
|
configuration:
|
|
- Debug
|
|
- Release
|
|
include:
|
|
- configuration: Debug
|
|
preset: debug
|
|
- configuration: Release
|
|
preset: release
|
|
- platform: Windows
|
|
runner: windows-latest
|
|
- platform: Linux GCC
|
|
runner: ubuntu-24.04
|
|
- platform: Linux Clang
|
|
runner: ubuntu-24.04
|
|
clang-version: 18
|
|
- platform: macOS arm64
|
|
runner: macos-latest
|
|
- platform: macOS x86_64
|
|
runner: macos-13
|
|
- platform: Android x86_64
|
|
runner: ubuntu-24.04
|
|
abi: x86_64
|
|
- platform: Android arm64-v8a
|
|
runner: ubuntu-24.04
|
|
abi: arm64-v8a
|
|
steps:
|
|
- name: Checkout Source
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install Ninja
|
|
uses: seanmiddleditch/gha-setup-ninja@v5
|
|
|
|
- name: Install Clang
|
|
if: "${{ matrix.platform == 'Linux Clang' }}"
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y wget gnupg software-properties-common
|
|
wget https://apt.llvm.org/llvm-snapshot.gpg.key -O- | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
|
|
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] https://apt.llvm.org/$(lsb_release -sc)/ llvm-toolchain-$(lsb_release -sc)-${{ matrix.clang-version }} main" | sudo tee /etc/apt/sources.list.d/llvm.list
|
|
sudo apt update
|
|
sudo apt install -y clang-${{ matrix.clang-version }} lld-${{ matrix.clang-version }}
|
|
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{ matrix.clang-version }} 100
|
|
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{ matrix.clang-version }} 100
|
|
sudo update-alternatives --set cc /usr/bin/clang-${{ matrix.clang-version }}
|
|
sudo update-alternatives --set c++ /usr/bin/clang++-${{ matrix.clang-version }}
|
|
|
|
- name: Enable Developer Command Prompt
|
|
uses: ilammy/msvc-dev-cmd@v1.13.0
|
|
if: "${{ matrix.platform == 'Windows' }}"
|
|
|
|
- uses: nttld/setup-ndk@v1
|
|
id: setup-ndk
|
|
if: ${{ startsWith(matrix.platform, 'Android') }}
|
|
with:
|
|
ndk-version: r26d
|
|
add-to-path: false
|
|
|
|
- name: CMake Build
|
|
run: cmake --preset=${{matrix.preset}} -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/toolchain/android-ndk.cmake && cmake --build --preset=${{matrix.preset}}
|
|
if: ${{ startsWith(matrix.platform, 'Android') }}
|
|
env:
|
|
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
|
|
ANDROID_ABI: ${{matrix.abi}}
|
|
|
|
- name: CMake Build
|
|
run: cmake --workflow --preset=${{matrix.preset}}
|
|
if: ${{ !startsWith(matrix.platform, 'Android') }}
|
|
|
|
- name: Upload Artifacts
|
|
uses: pyTooling/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.platform }} ${{matrix.configuration}} Artifacts
|
|
working-directory: build/${{matrix.preset}}/artifacts/
|
|
path: "*"
|
|
|
|
- name: Upload Test Configuration
|
|
uses: pyTooling/upload-artifact@v4
|
|
with:
|
|
name: Temp ${{ matrix.platform }} ${{matrix.configuration}} Test Config
|
|
path: "**/CTestTestfile.cmake"
|
|
working-directory: build/${{matrix.preset}}
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ${{ matrix.runner }}
|
|
needs: [dump-root, build]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
filesystem:
|
|
- Windows 2025
|
|
- Windows 2022
|
|
- Windows 2019
|
|
platform:
|
|
- Windows
|
|
- Linux GCC
|
|
- Linux Clang
|
|
- macOS arm64
|
|
- macOS x86_64
|
|
configuration:
|
|
- Debug
|
|
- Release
|
|
include:
|
|
- configuration: Debug
|
|
preset: debug
|
|
- configuration: Release
|
|
preset: release
|
|
- platform: Windows
|
|
runner: windows-latest
|
|
- platform: Linux GCC
|
|
runner: ubuntu-24.04
|
|
- platform: Linux Clang
|
|
runner: ubuntu-24.04
|
|
- platform: macOS arm64
|
|
runner: macos-latest
|
|
- platform: macOS x86_64
|
|
runner: macos-13
|
|
steps:
|
|
- name: Download Test Config
|
|
uses: pyTooling/download-artifact@v4
|
|
with:
|
|
name: Temp ${{ matrix.platform }} ${{matrix.configuration}} Test Config
|
|
path: build/${{matrix.preset}}
|
|
|
|
- name: Download Artifacts
|
|
uses: pyTooling/download-artifact@v4
|
|
with:
|
|
name: ${{ matrix.platform }} ${{matrix.configuration}} Artifacts
|
|
path: build/${{matrix.preset}}/artifacts
|
|
|
|
- name: Download Windows Artifacts
|
|
uses: pyTooling/download-artifact@v4
|
|
if: "${{ matrix.platform != 'Windows' }}"
|
|
with:
|
|
name: Windows ${{matrix.configuration}} Artifacts
|
|
path: build/${{matrix.preset}}/artifacts
|
|
|
|
- name: Download Root FS
|
|
uses: pyTooling/download-artifact@v4
|
|
with:
|
|
name: Temp ${{ matrix.filesystem }} Root FS
|
|
path: build/${{matrix.preset}}/artifacts/root
|
|
|
|
- name: Copy Test Sample
|
|
run: cp build/${{matrix.preset}}/artifacts/test-sample.exe build/${{matrix.preset}}/artifacts/root/filesys/c/
|
|
|
|
- name: CMake Test
|
|
run: cd build/${{matrix.preset}} && ctest --verbose
|
|
env:
|
|
EMULATOR_ROOT: ${{github.workspace}}/build/${{matrix.preset}}/artifacts/root
|
|
|
|
summary:
|
|
name: Pipeline Summary
|
|
runs-on: ubuntu-24.04
|
|
needs: [dump-root, build, test, verify-formatting]
|
|
if: always()
|
|
steps:
|
|
- uses: geekyeggo/delete-artifact@v5
|
|
with:
|
|
name: 'Temp *'
|
|
- name: Pipeline suceeded
|
|
if: ${{ !(contains(needs.*.result, 'failure')) }}
|
|
run: exit 0
|
|
- name: Pipeline failed
|
|
if: ${{ contains(needs.*.result, 'failure') }}
|
|
run: exit 1
|