This commit is contained in:
Jesse Talavera-Greenberg 2023-11-01 13:57:01 -04:00
parent 19d208d265
commit 5af5c9fdf1
5 changed files with 204 additions and 119 deletions

View File

@ -4,23 +4,6 @@ inputs:
target:
description: Platform target
required: true
test-suite:
description: True if running the test suite
required: false
default: "false"
testfile-dir:
description: Directory containing the test files
required: false
default: "testfiles"
testfile-repo:
description: Repository containing the test files
required: true
testfile-repo-token:
description: Token for the repository containing the test files
required: true
dsi-nand-archive:
description: Name of the DSI NAND archive
required: true
runs:
using: composite
@ -38,23 +21,18 @@ runs:
shell: bash
run: brew install pkg-config cmake ninja ccache
- name: Add RetroArch PPA
if: inputs.test-suite == 'true'
shell: bash
run: sudo add-apt-repository --yes ppa:libretro/stable
# Skip this step on act due to https://github.com/nektos/act/issues/1849
- name: Install Dependencies (Linux x86_64/Android)
if: ${{ !env.ACT && runner.os == 'Linux' && !contains(inputs.target, 'aarch64') }}
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: cmake ninja-build libepoxy-dev ccache p7zip-full xvfb libx11-xcb-dev xdg-utils x11-xserver-utils retroarch
version: 1.0
packages: cmake ninja-build libepoxy-dev ccache
version: 1.1
- name: Install Dependencies (Linux x86_64/Android + act)
if: ${{ env.ACT && runner.os == 'Linux' && !contains(inputs.target, 'aarch64') }}
shell: bash
run: sudo apt-get update -qy && sudo apt-get install -qy libepoxy-dev ccache ninja-build cmake p7zip-full xvfb libx11-xcb-dev xdg-utils x11-xserver-utils retroarch
run: sudo apt-get update -qy && sudo apt-get install -qy libepoxy-dev cmake ninja-build libepoxy-dev ccache
- name: Install Cross-Compile Support (Linux aarch64)
if: ${{ runner.os == 'Linux' && contains(inputs.target, 'aarch64') }}
@ -73,30 +51,5 @@ runs:
uses: hendrikmuhs/ccache-action@v1.2.10
with:
key: ${{ inputs.target }}-${{ matrix.build-type }}
variant: ${{ runner.os == 'Windows' && 'sccache' || 'ccache' }}
variant: ${{ runner.os == 'Windows' && 'sccache' || 'ccache' }} # Equivalent to (runner.os == 'Windows') ? 'sccache' : 'ccache'
# Using sccache on Windows due to https://github.com/hendrikmuhs/ccache-action/issues/112
- name: Download Test Files
if: inputs.test-suite == 'true'
uses: actions/checkout@v3
with:
repository: "${{ inputs.testfile-repo }}"
token: "${{ inputs.testfile-repo-token }}"
path: "${{ inputs.testfile-dir }}"
- name: Prepare Test Files
if: inputs.test-suite == 'true'
working-directory: "${{ inputs.testfile-dir }}"
shell: bash
run: 7z x "${{ inputs.dsi-nand-archive }}"
- name: Install Go
if: inputs.test-suite == 'true'
uses: actions/setup-go@v4
with:
go-version: '^1.21.0'
- name: Install Emutest
if: inputs.test-suite == 'true'
shell: bash
run: go install github.com/kivutar/emutest@latest

61
.github/actions/test-deps/action.yml vendored Normal file
View File

@ -0,0 +1,61 @@
name: Install Test Suite Dependencies
description: Install Test Suite Dependencies
inputs:
target:
description: Platform target
required: true
testfile-dir:
description: Directory containing the test files
required: false
default: "testfiles"
testfile-repo:
description: Repository containing the test files
required: true
testfile-repo-token:
description: Token for the repository containing the test files
required: true
dsi-nand-archive:
description: Name of the DSI NAND archive
required: true
runs:
using: composite
steps:
- name: Add RetroArch PPA (Linux)
if: ${{ runner.os == 'Linux' }}
shell: bash
run: sudo add-apt-repository --yes ppa:libretro/stable
# Skip this step on act due to https://github.com/nektos/act/issues/1849
- name: Install Dependencies (Linux x86_64/Android)
if: ${{ !env.ACT && runner.os == 'Linux' && !contains(inputs.target, 'aarch64') }}
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: cmake p7zip-full xvfb xdg-utils x11-xserver-utils retroarch
version: 1.0
- name: Install Dependencies (Linux x86_64/Android + act)
if: ${{ env.ACT && runner.os == 'Linux' && !contains(inputs.target, 'aarch64') }}
shell: bash
run: sudo apt-get update -qy && sudo apt-get install -qy cmake p7zip-full xvfb xdg-utils x11-xserver-utils retroarch
- name: Download Test Files
uses: actions/checkout@v3
with:
repository: "${{ inputs.testfile-repo }}"
token: "${{ inputs.testfile-repo-token }}"
path: "${{ inputs.testfile-dir }}"
- name: Prepare Test Files
working-directory: "${{ inputs.testfile-dir }}"
shell: bash
run: 7z x "${{ inputs.dsi-nand-archive }}"
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '^1.21.0'
- name: Install Emutest
shell: bash
run: go install github.com/kivutar/emutest@latest

View File

@ -1,29 +1,6 @@
name: Build (Internal)
on:
workflow_call:
secrets:
TESTFILE_REPO_TOKEN:
required: false
TESTFILE_REPO:
required: false
ARM7_BIOS:
required: false
ARM9_BIOS:
required: false
ARM7_DSI_BIOS:
required: false
ARM9_DSI_BIOS:
required: false
NDS_FIRMWARE:
required: false
DSI_FIRMWARE:
required: false
NDS_ROM:
required: false
DSI_NAND_ARCHIVE:
required: false
DSI_NAND:
required: false
inputs:
cmake-args:
description: Additional arguments to pass to CMake.
@ -76,14 +53,13 @@ on:
type: string
required: true
test-suite:
description: Whether to run the test suite
description: Whether there will be a test suite based on this run's output
type: boolean
required: false
default: false
env:
BUILD_DIR: "${{ github.workspace }}/${{ inputs.build-dir }}"
DIST_DIR: "${{ github.workspace }}/${{ inputs.dist-dir }}"
TESTFILE_DIR: "${{ github.workspace }}/testfiles"
jobs:
build:
strategy:
@ -109,16 +85,11 @@ jobs:
uses: ./.github/actions/deps
with:
target: ${{ inputs.target }}
test-suite: ${{ inputs.test-suite }}
testfile-repo: ${{ secrets.TESTFILE_REPO }}
testfile-repo-token: ${{ secrets.TESTFILE_REPO_TOKEN }}
dsi-nand-archive: ${{ secrets.DSI_NAND_ARCHIVE }}
- name: Create build environment
run: mkdir -vp "${{ env.BUILD_DIR }}"
- name: Configure
if: ${{ !inputs.test-suite }}
working-directory: "${{ env.BUILD_DIR }}"
run: |
cmake "${{ github.workspace }}" \
@ -127,26 +98,6 @@ jobs:
-DMELONDS_REPOSITORY_TAG="${{ vars.MELONDS_REPOSITORY_TAG }}" \
${{ inputs.cmake-args }}
- name: Configure (with test suite)
if: ${{ inputs.test-suite }}
working-directory: "${{ env.BUILD_DIR }}"
run: |
cmake "${{ github.workspace }}" \
-DCMAKE_BUILD_TYPE="${{ matrix.build-type }}" \
-DMELONDS_REPOSITORY_URL="${{ vars.MELONDS_REPOSITORY_URL }}" \
-DMELONDS_REPOSITORY_TAG="${{ vars.MELONDS_REPOSITORY_TAG }}" \
-DBUILD_TESTING=ON \
-DRETROARCH="$(which retroarch)" \
-DARM7_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM7_BIOS }}" \
-DARM9_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM9_BIOS }}" \
-DARM7_DSI_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM7_DSI_BIOS }}" \
-DARM9_DSI_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM9_DSI_BIOS }}" \
-DNDS_FIRMWARE="${{ env.TESTFILE_DIR }}/${{ secrets.NDS_FIRMWARE }}" \
-DDSI_FIRMWARE="${{ env.TESTFILE_DIR }}/${{ secrets.DSI_FIRMWARE }}" \
-DDSI_NAND="${{ env.TESTFILE_DIR }}/${{ secrets.DSI_NAND }}" \
-DNDS_ROM="${{ env.TESTFILE_DIR }}/${{ secrets.NDS_ROM }}" \
${{ inputs.cmake-args }}
- name: Build
working-directory: "${{ env.BUILD_DIR }}"
run: cmake --build "${{ env.BUILD_DIR }}" --parallel
@ -167,7 +118,16 @@ jobs:
if-no-files-found: error
path: "${{ env.DIST_DIR }}"
- name: Run Test Suite
if: ${{ inputs.test-suite }}
working-directory: "${{ env.BUILD_DIR }}"
run: xvfb-run ctest --extra-verbose --exclude-regex example --output-on-failure
- name: Remove Extra Artifacts
run: |
rm -rf "${{ env.BUILD_DIR }}/_deps" "${{ env.BUILD_DIR }}/src/libretro/CMakeFiles"
# Remove various files that we won't need to pass to the test suite
- name: Upload CMake Build Directory
uses: actions/upload-artifact@v3
if: ${{ matrix.build-type == 'Debug' && inputs.test-suite }}
with:
name: "zzz-not-for-players-cmake-build-${{ inputs.archive-name }}-${{ matrix.build-type }}"
# So no one tries to download this on nightly.link
if-no-files-found: error
path: "${{ env.BUILD_DIR }}"

View File

@ -43,25 +43,13 @@ jobs:
runs-on: ubuntu-latest
lib-ext: so
test-suite: true
secrets:
TESTFILE_REPO_TOKEN: ${{ secrets.TESTFILE_REPO_TOKEN }}
TESTFILE_REPO: ${{ secrets.TESTFILE_REPO }}
DSI_NAND_ARCHIVE: ${{ secrets.DSI_NAND_ARCHIVE }}
DSI_NAND: ${{ secrets.DSI_NAND }}
ARM7_BIOS: ${{ secrets.ARM7_BIOS }}
ARM9_BIOS: ${{ secrets.ARM9_BIOS }}
ARM7_DSI_BIOS: ${{ secrets.ARM7_DSI_BIOS }}
ARM9_DSI_BIOS: ${{ secrets.ARM9_DSI_BIOS }}
NDS_FIRMWARE: ${{ secrets.NDS_FIRMWARE }}
DSI_FIRMWARE: ${{ secrets.DSI_FIRMWARE }}
NDS_ROM: ${{ secrets.NDS_ROM }}
linux-aarch64:
name: Linux (aarch64)
uses: ./.github/workflows/build.yaml
with:
archive-name: melondsds_libretro-linux-aarch64
target: linux-aaarch64
target: linux-aarch64
runs-on: ubuntu-latest
lib-ext: so
cmake-args: -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DPKG_CONFIG_EXECUTABLE=/usr/bin/aarch64-linux-gnu-pkg-config
@ -89,4 +77,26 @@ jobs:
lib-ext: dylib
lib-name: melondsds_libretro_ios
cmake-args: -DENABLE_OGLRENDERER=OFF -DENABLE_JIT=OFF --toolchain ./cmake/toolchain/ios.toolchain.cmake -DPLATFORM=OS64 -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=13.0 -DDEPLOYMENT_TARGET=14 -DENABLE_STRICT_TRY_COMPILE_INT:BOOL=ON
# Disabled OpenGL on iOS due to https://github.com/JesseTG/melonds-ds/issues/23
# Disabled OpenGL on iOS due to https://github.com/JesseTG/melonds-ds/issues/23
test-linux-x86_64:
name: Test Suite (Linux x86_64)
uses: ./.github/workflows/test.yaml
needs: [ linux-x86_64 ]
with:
archive-name: melondsds_libretro-linux-x86_64
target: linux-x86_64
runs-on: ubuntu-latest
lib-ext: so
secrets:
TESTFILE_REPO_TOKEN: ${{ secrets.TESTFILE_REPO_TOKEN }}
TESTFILE_REPO: ${{ secrets.TESTFILE_REPO }}
DSI_NAND_ARCHIVE: ${{ secrets.DSI_NAND_ARCHIVE }}
DSI_NAND: ${{ secrets.DSI_NAND }}
ARM7_BIOS: ${{ secrets.ARM7_BIOS }}
ARM9_BIOS: ${{ secrets.ARM9_BIOS }}
ARM7_DSI_BIOS: ${{ secrets.ARM7_DSI_BIOS }}
ARM9_DSI_BIOS: ${{ secrets.ARM9_DSI_BIOS }}
NDS_FIRMWARE: ${{ secrets.NDS_FIRMWARE }}
DSI_FIRMWARE: ${{ secrets.DSI_FIRMWARE }}
NDS_ROM: ${{ secrets.NDS_ROM }}

101
.github/workflows/test.yaml vendored Normal file
View File

@ -0,0 +1,101 @@
name: Test Suite (Internal)
on:
workflow_call:
secrets:
TESTFILE_REPO_TOKEN:
required: true
TESTFILE_REPO:
required: true
ARM7_BIOS:
required: true
ARM9_BIOS:
required: true
ARM7_DSI_BIOS:
required: true
ARM9_DSI_BIOS:
required: true
NDS_FIRMWARE:
required: true
DSI_FIRMWARE:
required: true
NDS_ROM:
required: true
DSI_NAND_ARCHIVE:
required: true
DSI_NAND:
required: true
inputs:
cmake-args:
description: Additional arguments to pass to CMake.
type: string
required: false
runs-on:
description: The platform on which the workflow will be run. Passed directly to jobs.<job_id>.runs-on.
type: string
required: true
shell:
description: The shell to use for running commands. Passed directly to jobs.<job_id>.defaults.run.shell.
type: string
required: false
default: bash
build-dir:
description: The directory in which to build the project.
type: string
required: false
default: "build"
archive-name:
description: The name of the archive to upload.
type: string
required: true
target:
description: The platform target.
type: string
required: true
env:
BUILD_DIR: "${{ github.workspace }}/${{ inputs.build-dir }}"
TESTFILE_DIR: "${{ github.workspace }}/testfiles"
jobs:
build:
runs-on: ${{ inputs.runs-on }}
defaults:
run:
shell: ${{ inputs.shell }}
steps:
- name: Check Out Source
uses: actions/checkout@v3
- name: Install Dependencies
uses: ./.github/actions/test-deps
with:
target: ${{ inputs.target }}
testfile-repo: ${{ secrets.TESTFILE_REPO }}
testfile-repo-token: ${{ secrets.TESTFILE_REPO_TOKEN }}
dsi-nand-archive: ${{ secrets.DSI_NAND_ARCHIVE }}
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: "zzz-not-for-players-cmake-build-${{ inputs.archive-name }}-Debug"
path: "${{ env.BUILD_DIR }}"
- name: Configure Test Suite
working-directory: "${{ env.BUILD_DIR }}"
run: |
cmake "${{ github.workspace }}" \
-DCMAKE_BUILD_TYPE="${{ matrix.build-type }}" \
-DMELONDS_REPOSITORY_URL="${{ vars.MELONDS_REPOSITORY_URL }}" \
-DMELONDS_REPOSITORY_TAG="${{ vars.MELONDS_REPOSITORY_TAG }}" \
-DBUILD_TESTING=ON \
-DARM7_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM7_BIOS }}" \
-DARM9_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM9_BIOS }}" \
-DARM7_DSI_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM7_DSI_BIOS }}" \
-DARM9_DSI_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM9_DSI_BIOS }}" \
-DNDS_FIRMWARE="${{ env.TESTFILE_DIR }}/${{ secrets.NDS_FIRMWARE }}" \
-DDSI_FIRMWARE="${{ env.TESTFILE_DIR }}/${{ secrets.DSI_FIRMWARE }}" \
-DDSI_NAND="${{ env.TESTFILE_DIR }}/${{ secrets.DSI_NAND }}" \
-DNDS_ROM="${{ env.TESTFILE_DIR }}/${{ secrets.NDS_ROM }}" \
${{ inputs.cmake-args }}
- name: Run Test Suite
working-directory: "${{ env.BUILD_DIR }}"
run: xvfb-run ctest --extra-verbose --exclude-regex example --output-on-failure