-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from ian-h-chamberlain/fix/refactor-simplify-ac…
…tion
- Loading branch information
Showing
19 changed files
with
283 additions
and
143 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
FROM buildpack-deps:latest as builder | ||
|
||
WORKDIR /tmp | ||
COPY ./docker/download_citra.sh /usr/local/bin/download_citra | ||
RUN apt-get update -y && apt-get install -y jq | ||
|
||
ARG CITRA_CHANNEL=nightly | ||
ARG CITRA_RELEASE=1995 | ||
RUN download_citra ${CITRA_CHANNEL} ${CITRA_RELEASE} | ||
|
||
FROM devkitpro/devkitarm:latest as devkitarm | ||
|
||
# For some reason, citra isn't always happy when you try to run it for the first time, | ||
# so we build a simple dummy program to force it to create its directory structure | ||
RUN cd /opt/devkitpro/examples/3ds/graphics/printing/hello-world && \ | ||
echo 'int main(int, char**) {}' > source/main.c && \ | ||
make && \ | ||
mv hello-world.3dsx /tmp/ | ||
|
||
FROM ubuntu:latest | ||
|
||
RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \ | ||
apt-get update -y && \ | ||
apt-get install -y \ | ||
libswscale5 \ | ||
libsdl2-2.0-0 \ | ||
libavformat58 \ | ||
libavfilter7 \ | ||
xvfb | ||
|
||
COPY --from=devkitarm /opt/devkitpro /opt/devkitpro | ||
# There's no way to copy ENV values from other stages properly: | ||
# https://github.com/moby/moby/issues/37345 | ||
# Luckily in this case we know exactly what the values should be: | ||
ENV DEVKITPRO=/opt/devkitpro | ||
ENV DEVKITARM=${DEVKITPRO}/devkitARM | ||
ENV PATH=${DEVKITARM}/bin:${PATH} | ||
|
||
COPY --from=builder /tmp/citra.AppImage /usr/local/bin/citra | ||
COPY --from=devkitarm /tmp/hello-world.3dsx /tmp/ | ||
# We run citra once before copying our config file, so it should create its | ||
# necessary directory structure and run once with defaults | ||
RUN xvfb-run citra --appimage-extract-and-run /tmp/hello-world.3dsx; \ | ||
rm -f /tmp/hello-world.3dsx | ||
# Initial run seems to miss this one directory so just make it manually | ||
RUN mkdir -p /root/.local/share/citra-emu/log | ||
|
||
COPY ./docker/sdl2-config.ini /root/.config/citra-emu/ | ||
COPY ./docker/test-runner.gdb /app/ | ||
COPY ./docker/entrypoint.sh /app/ | ||
|
||
WORKDIR /app | ||
|
||
ENTRYPOINT [ "/app/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Cargo 3DS Test | ||
description: > | ||
Run `cargo 3ds test` executables using Citra. Note that to use this action, | ||
you must mount `/var/run/docker.sock:/var/run/docker.sock` and `/tmp:/tmp` into | ||
the container so that the runner image can be built and doctest artifacts can | ||
be found, respectively. | ||
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 | ||
|
||
- 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 ${GITHUB_WORKSPACE} due to | ||
# https://github.com/actions/runner/issues/2058, which also means | ||
# we have to export this instead of using the env: key | ||
run: | | ||
cd ${{ inputs.working-directory }} | ||
export CARGO_TARGET_ARMV6K_NINTENDO_3DS_RUNNER=" | ||
docker run --rm | ||
-v ${{ runner.temp }}:${{ runner.temp }} | ||
-v ${{ github.workspace }}/target:/app/target | ||
-v ${{ github.workspace }}:${GITHUB_WORKSPACE} | ||
${{ inputs.runner-image }}:latest" | ||
env | ||
cargo 3ds -v test ${{ inputs.args }} | ||
env: | ||
# Ensure that doctests get built into a path which is mounted on the host | ||
# as well as in this container (via the bind mount in the RUNNER command) | ||
TMPDIR: ${{ runner.temp }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.