Browse Source

Fix ENV from devkitarm image in dockerfile

Also try to fix citra download even though I don't know what's wrong
yet.
pull/7/head
Ian Chamberlain 1 year ago
parent
commit
5c29862e2d
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 3
      .github/actions/setup/action.yml
  2. 36
      .github/actions/test/action.yml
  3. 9
      .github/workflows/ci.yml
  4. 17
      Dockerfile
  5. 2
      docker/download_citra.sh

3
.github/actions/setup/action.yml

@ -17,12 +17,13 @@ runs: @@ -17,12 +17,13 @@ runs:
with:
components: clippy, rustfmt, rust-src
toolchain: ${{ inputs.toolchain }}
cache: "false" # We set up our own cache manually in the next step
rustflags: ""
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: rust3ds
cache-on-failure: "true"
- name: Install build tools for host
shell: bash

36
.github/actions/test/action.yml

@ -7,27 +7,37 @@ description: > @@ -7,27 +7,37 @@ description: >
inputs:
args:
description: >
Extra arguments to pass to `cargo 3ds test`
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
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@v2
uses: docker/build-push-action@v4
with:
tags: test-runner-3ds:latest
tags: ${{ inputs.runner-image }}: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 }}
# 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: |
export CARGO_TARGET_ARMV6K_NINTENDO_3DS_RUNNER="docker run --rm
-v /tmp:/tmp
-v ${GITHUB_WORKSPACE}/target:/app/target
-v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}
${{ inputs.runner-image }}:latest"
env
cargo 3ds -v test ${{ inputs.args }}

9
.github/workflows/ci.yml

@ -42,6 +42,11 @@ jobs: @@ -42,6 +42,11 @@ jobs:
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
runs-on: ubuntu-latest
container:
image: devkitpro/devkitarm
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
steps:
- name: Checkout branch
uses: actions/checkout@v3
@ -52,6 +57,8 @@ jobs: @@ -52,6 +57,8 @@ jobs:
- name: Build and run tests (unit + integration)
uses: ./.github/actions/test
with:
args: -- -v
- name: Build and run doc tests
# Let's still run doc tests even if lib/integration tests fail:
@ -62,7 +69,7 @@ jobs: @@ -62,7 +69,7 @@ jobs:
RUSTDOCFLAGS: " --persist-doctests target/armv6k-nintendo-3ds/debug/doctests"
uses: ./.github/actions/test
with:
args: --doc
args: --doc -- -v
- name: Upload citra logs and capture videos
uses: actions/upload-artifact@v3

17
Dockerfile

@ -1,14 +1,12 @@ @@ -1,14 +1,12 @@
FROM buildpack-deps:latest as builder
ARG CITRA_CHANNEL=nightly
ARG CITRA_RELEASE=1962
WORKDIR /tmp
COPY ./docker/download_citra.sh /usr/local/bin/download_citra
RUN apt-get update -y && apt-get install -y jq
RUN download_citra ${CITRA_CHANNEL} ${CITRA_RELEASE}
FROM devkitpro/devkitarm:latest as devkitarm
ARG CITRA_CHANNEL=nightly
ARG CITRA_RELEASE=1995
RUN download_citra ${CITRA_CHANNEL} ${CITRA_RELEASE}
FROM ubuntu:latest
@ -21,8 +19,13 @@ RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \ @@ -21,8 +19,13 @@ RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
libavfilter7 \
xvfb
COPY --from=devkitarm /opt/devkitpro /opt/devkitpro
ENV PATH=/opt/devkitpro/devkitARM/bin:${PATH}
COPY --from=devkitpro/devkitarm:latest /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 ./docker/sdl2-config.ini /app/

2
docker/download_citra.sh

@ -9,7 +9,7 @@ RELEASE_API="https://api.github.com/repos/citra-emu/citra-${CITRA_CHANNEL}/relea @@ -9,7 +9,7 @@ RELEASE_API="https://api.github.com/repos/citra-emu/citra-${CITRA_CHANNEL}/relea
curl "${RELEASE_API}" |
jq --raw-output '.assets[].browser_download_url' |
grep -E 'citra-linux-.*.tar.gz' |
grep -E 'citra-linux-.*[.]tar.gz' |
xargs wget -O citra-linux.tar.gz
tar --strip-components 1 -xvf citra-linux.tar.gz

Loading…
Cancel
Save