Browse Source

Reflow actions completely

Add a "test" action instead of a "citra" action. It might still be
useful to have the citra action for examples later on but it's pretty
simple to reimplement.
pull/7/head
Ian Chamberlain 1 year ago
parent
commit
7ba17cff18
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 12
      .github/actions/citra/action.yml
  2. 11
      .github/actions/setup/action.yml
  3. 33
      .github/actions/test/action.yml
  4. 41
      .github/workflows/ci.yml

12
.github/actions/citra/action.yml

@ -1,12 +0,0 @@
name: 'Run 3DS Executable'
description: 'Run a given 3DS executable with citra and GDB'
inputs:
executable:
description: >
The 3DS executable(s) to run. Globs and space separated lists allowed.
required: true
runs:
using: docker
image: ../../../Dockerfile
args:
- ${{ inputs.executable }}

11
.github/actions/setup/action.yml

@ -10,14 +10,6 @@ inputs:
runs: runs:
using: composite using: composite
steps: steps:
# https://github.com/nektos/act/issues/917#issuecomment-1074421318
- if: ${{ env.ACT }}
shell: bash
name: Hack container for local development
run: |
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
- name: Setup default Rust toolchain - name: Setup default Rust toolchain
# Use this helper action so we get matcher support # Use this helper action so we get matcher support
# https://github.com/actions-rust-lang/setup-rust-toolchain/pull/15 # https://github.com/actions-rust-lang/setup-rust-toolchain/pull/15
@ -25,6 +17,7 @@ runs:
with: with:
components: clippy, rustfmt, rust-src components: clippy, rustfmt, rust-src
toolchain: ${{ inputs.toolchain }} toolchain: ${{ inputs.toolchain }}
rustflags: ""
- name: Set up Rust cache - name: Set up Rust cache
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
@ -38,7 +31,7 @@ runs:
- name: Install cargo-3ds - name: Install cargo-3ds
shell: bash shell: bash
# TODO: replace with crates.io version once published # TODO: replace with crates.io version once published
run: cargo install --git https://github.com/rust3ds/cargo-3ds --branch feature/verbose-flag run: cargo install --locked --git https://github.com/rust3ds/cargo-3ds
- name: Set PATH to include devkitARM - name: Set PATH to include devkitARM
shell: bash shell: bash

33
.github/actions/test/action.yml

@ -0,0 +1,33 @@
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: ''
runs:
using: composite
steps:
- name: Build test-runner image
uses: docker/build-push-action@v2
with:
tags: test-runner-3ds:latest
push: false
- shell: bash
env:
# Set a custom runner for `cargo test` commands to use
CARGO_TARGET_ARMV6K_NINTENDO_3DS_RUNNER: |-
docker run --rm \
-v /tmp:/tmp \
-v ${{ github.workspace }}/target:/app/target \
-v ${{ github.workspace }}:${{ github.workspace }} \
test-runner-3ds:latest
run: cargo 3ds test ${{ inputs.args }}

41
.github/workflows/ci.yml

@ -9,10 +9,6 @@ on:
- main - main
workflow_dispatch: workflow_dispatch:
env:
# actions-rust-lang/setup-rust-toolchain sets some default RUSTFLAGS, which we don't want to use
RUSTFLAGS: ""
jobs: jobs:
lint: lint:
strategy: strategy:
@ -34,8 +30,7 @@ jobs:
run: cargo fmt --all --verbose -- --check run: cargo fmt --all --verbose -- --check
- name: Run clippy - name: Run clippy
# We have to build the test crate here since it's not included in build-std by default run: cargo 3ds clippy --color=always --verbose --all-targets
run: cargo 3ds clippy -Zbuild-std=std,test --color=always --verbose --all-targets
test: test:
strategy: strategy:
@ -47,7 +42,6 @@ jobs:
continue-on-error: ${{ matrix.toolchain == 'nightly' }} continue-on-error: ${{ matrix.toolchain == 'nightly' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: devkitpro/devkitarm
steps: steps:
- name: Checkout branch - name: Checkout branch
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -56,29 +50,26 @@ jobs:
with: with:
toolchain: ${{ matrix.toolchain }} toolchain: ${{ matrix.toolchain }}
- name: Build lib tests - name: Build and run tests (unit + integration)
run: cargo 3ds test --no-run --lib uses: ./.github/actions/test
- name: Build integration tests
run: cargo 3ds test --no-run --test integration
- name: Build doc tests - name: Build and run doc tests
run: cargo 3ds test --no-run --doc # Let's still run doc tests even if lib/integration tests fail:
if: ${{ !cancelled() }}
- name: Run lib + integration tests env:
uses: ./.github/actions/citra # This ensures the citra logs and video output gets put in a directory
# where we can upload as artifacts
RUSTDOCFLAGS: " --persist-doctests target/armv6k-nintendo-3ds/debug/doctests"
uses: ./.github/actions/test
with: with:
executable: ./target/armv6k-nintendo-3ds/debug/deps/*.elf args: --doc
# TODO: run doc tests. We might be able to do something with e.g.
# cargo's "runner" configuration, but it seems we also need a test
# runtime and stuff for that to work.
- name: Upload citra logs and capture videos - name: Upload citra logs and capture videos
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: success() || failure() # We always want to upload artifacts regardless of previous success/failure
if: ${{ !cancelled() }}
with: with:
name: citra-logs-${{ matrix.toolchain }} name: citra-logs-${{ matrix.toolchain }}
path: | path: |
target/armv6k-nintendo-3ds/debug/deps/*.txt target/armv6k-nintendo-3ds/debug/**/*.txt
target/armv6k-nintendo-3ds/debug/deps/*.webm target/armv6k-nintendo-3ds/debug/**/*.webm

Loading…
Cancel
Save