Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
toolchain:
# Oldest supported nightly
- nightly-2024-02-18
- nightly-2025-07-25
- nightly
ctru-rs-ref:
# "known good" version of `test-runner` crate
Expand All @@ -28,7 +28,7 @@ jobs:
image: devkitpro/devkitarm
volumes:
# So the test action can `docker run` the runner:
- '/var/run/docker.sock:/var/run/docker.sock'
- "/var/run/docker.sock:/var/run/docker.sock"
steps:
- name: Checkout branch
uses: actions/checkout@v4
Expand All @@ -54,8 +54,8 @@ jobs:

- uses: actions/checkout@v4
with:
repository: 'rust3ds/ctru-rs'
path: 'ctru-rs'
repository: "rust3ds/ctru-rs"
path: "ctru-rs"
ref: ${{ steps.resolve-ref.outputs.sha }}

- name: Build and run tests (unit + integration)
Expand All @@ -77,7 +77,7 @@ jobs:
args: --doc --package test-runner -v

- name: Upload citra logs and capture videos
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
# We always want to upload artifacts regardless of previous success/failure
if: ${{ !cancelled() }}
with:
Expand Down
42 changes: 22 additions & 20 deletions run-tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
FROM buildpack-deps:latest as builder
FROM buildpack-deps:latest AS builder

WORKDIR /tmp
COPY ./docker/download_citra.sh /usr/local/bin/download_citra
COPY ./docker/download_emu.sh /usr/local/bin/download_emu
RUN apt-get update -y && apt-get install -y jq

ARG TAG=r0c2f076
RUN download_citra ${TAG}
ARG TAG=2120
RUN download_emu ${TAG}

FROM devkitpro/devkitarm:latest as devkitarm
FROM devkitpro/devkitarm:latest AS devkitarm

# For some reason, citra isn't always happy when you try to run it for the first time,
# For some reason, azahar/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:mantic
FROM ubuntu:noble

RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
apt-get update -y && \
apt-get install -y \
libavfilter9 \
libavformat60 \
libavutil58 \
libsdl2-2.0-0 \
libswscale7 \
mesa-vulkan-drivers \
vulkan-tools \
xvfb
libavfilter9 \
libavformat60 \
libavutil58 \
libsdl2-2.0-0 \
libswscale7 \
libopengl0 \
libegl1 \
mesa-vulkan-drivers \
vulkan-tools \
xvfb

COPY --from=devkitarm /opt/devkitpro /opt/devkitpro
# There's no way to copy ENV values from other stages properly:
Expand All @@ -38,16 +40,16 @@ 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=builder /tmp/azahar.AppImage /usr/local/bin/azahar
COPY --from=devkitarm /tmp/hello-world.3dsx /tmp/
# We run citra once before copying our config file, so it should create its
# We run azahar/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; \
RUN xvfb-run azahar --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
RUN mkdir -p /root/.local/share/azahar-emu/log

COPY ./docker/sdl2-config.ini /root/.config/citra-emu/
COPY ./docker/sdl2-config.ini /root/.config/azahar-emu/
COPY ./docker/test-runner.gdb /app/
COPY ./docker/entrypoint.sh /app/

Expand Down
4 changes: 2 additions & 2 deletions run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Cargo 3DS Test
description: >
Run `cargo 3ds test` executables using Citra. Note that to use this action,
Run `cargo 3ds test` executables using Azahar/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.
Expand All @@ -9,7 +9,7 @@ inputs:
args:
description: Extra arguments to pass to `cargo 3ds test`
required: false
default: ''
default: ""

runner-image:
description: The name of the container image to build for running tests in
Expand Down
12 changes: 0 additions & 12 deletions run-tests/docker/download_citra.sh

This file was deleted.

14 changes: 14 additions & 0 deletions run-tests/docker/download_emu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -euxo pipefail

TAG=$1

curl "https://api.github.com/repos/azahar-emu/azahar/releases/tags/${TAG}" |
jq --raw-output '.assets[].browser_download_url' |
grep -E 'azahar.*.appimage.tar.gz' |
xargs wget -O azahar-linux.tar.gz

tar --strip-components 1 -xvf azahar-linux.tar.gz

chmod a+x azahar.AppImage
18 changes: 9 additions & 9 deletions run-tests/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@ fi

VIDEO_OUT="${EXE_NOEXT}_capture.webm"

CITRA_LOG_DIR=~/.local/share/citra-emu/log
CITRA_OUT="$CITRA_LOG_DIR/citra_output.txt"
EMU_LOG_DIR=~/.local/share/azahar-emu/log
EMU_OUT="$EMU_LOG_DIR/azahar_output.txt"

xvfb-run --auto-servernum \
citra \
azahar \
--appimage-extract-and-run \
--dump-video="$VIDEO_OUT" \
"$EXE_TO_RUN" \
&>"$CITRA_OUT" &
CITRA_PID=$!
&>"$EMU_OUT" &
EMU_PID=$!

# Citra takes a little while to start up, so wait a little before we try to connect
# Azahar/Citra takes a little while to start up, so wait a little before we try to connect
sleep 5

arm-none-eabi-gdb --silent --batch-silent --command /app/test-runner.gdb "$EXE_ELF"
STATUS=$?

kill $CITRA_PID
kill $EMU_PID
cleanup_jobs

CITRA_LOG="$CITRA_LOG_DIR/citra_log.txt"
EMU_LOG="$EMU_LOG_DIR/azahar_log.txt"

for f in "$CITRA_LOG" "$CITRA_OUT"; do
for f in "$EMU_LOG" "$EMU_OUT"; do
OUT="${EXE_NOEXT}_$(basename "$f")"
if test -f "$f"; then
cp "$f" "$OUT"
Expand Down
3 changes: 1 addition & 2 deletions setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ runs:

- name: Install cargo-3ds
shell: bash
# TODO: replace with crates.io version once published
run: cargo install --locked --git https://github.com/rust3ds/cargo-3ds
run: cargo install --locked cargo-3ds

- name: Set PATH to include devkitARM
shell: bash
Expand Down
Loading