|
|
|
name: Cargo 3DS Test
|
|
|
|
description: >
|
|
|
|
Run `cargo 3ds test` executables using Citra. Note that to use this action,
|
|
|
|
you must use a container image of `devkitpro/devkitarm` and mount
|
|
|
|
`/var/run/docker.sock:/var/run/docker.sock` into the container so that the
|
|
|
|
runner image can be built by the action.
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
args:
|
|
|
|
description: Extra arguments to pass to `cargo 3ds test`
|
|
|
|
required: false
|
|
|
|
default: ''
|
|
|
|
|
|
|
|
runner-image:
|
|
|
|
description: The name of the container image to build for running tests in
|
|
|
|
required: false
|
|
|
|
default: test-runner-3ds
|
|
|
|
|
|
|
|
working-directory:
|
|
|
|
description: Change to this directory before running tests. Defaults to $GITHUB_WORKSPACE
|
|
|
|
required: false
|
|
|
|
default: ${GITHUB_WORKSPACE}
|
|
|
|
|
|
|
|
runs:
|
|
|
|
using: composite
|
|
|
|
steps:
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Build test-runner image
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
with:
|
|
|
|
context: ${{ github.action_path }}
|
|
|
|
tags: ${{ inputs.runner-image }}:latest
|
|
|
|
push: false
|
|
|
|
load: true
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
|
|
|
|
- name: Ensure docker is installed in the container
|
|
|
|
shell: bash
|
|
|
|
run: apt-get update -y && apt-get install docker.io -y
|
|
|
|
|
|
|
|
- name: Run cargo 3ds test
|
|
|
|
shell: bash
|
|
|
|
# Set a custom runner for `cargo test` commands to use.
|
|
|
|
# Use ${PWD} and ${RUNNER_TEMP} due to
|
|
|
|
# https://github.com/actions/runner/issues/2058, which also means
|
|
|
|
# we have to export this in `run` instead of using the `env` key
|
|
|
|
run: |
|
|
|
|
cd ${{ inputs.working-directory }}
|
|
|
|
|
|
|
|
# Hopefully this still works if the input is an absolute path:
|
|
|
|
mounted_pwd="${{ github.workspace }}/${{ inputs.working-directory }}"
|
|
|
|
|
|
|
|
export CARGO_TARGET_ARMV6K_NINTENDO_3DS_RUNNER="
|
|
|
|
docker run --rm
|
|
|
|
-v ${{ github.workspace }}:${GITHUB_WORKSPACE}
|
|
|
|
-v ${mounted_pwd}/target:/app/target
|
|
|
|
-v ${{ runner.temp }}:${RUNNER_TEMP}
|
|
|
|
${{ inputs.runner-image }}:latest"
|
|
|
|
env
|
|
|
|
cargo 3ds -v test ${{ inputs.args }}
|
|
|
|
env:
|
|
|
|
# Make sure doctests are built into the shared tempdir instead of the
|
|
|
|
# container's /tmp which will be immediately removed
|
|
|
|
TMPDIR: ${{ env.RUNNER_TEMP }}
|