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

36
.github/actions/test/action.yml

@ -7,27 +7,37 @@ description: >
inputs: inputs:
args: args:
description: > description: Extra arguments to pass to `cargo 3ds test`
Extra arguments to pass to `cargo 3ds test`
required: false required: false
default: '' default: ''
runner-image:
description: The name of the container image to build for running tests in
required: false
default: test-runner-3ds
runs: runs:
using: composite using: composite
steps: steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build test-runner image - name: Build test-runner image
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
tags: test-runner-3ds:latest tags: ${{ inputs.runner-image }}:latest
push: false push: false
- shell: bash - shell: bash
env: # Set a custom runner for `cargo test` commands to use.
# Set a custom runner for `cargo test` commands to use # Use ${GITHUB_WORKSPACE} due to
CARGO_TARGET_ARMV6K_NINTENDO_3DS_RUNNER: |- # https://github.com/actions/runner/issues/2058, which also means
docker run --rm \ # we have to export this instead of using the env: key
-v /tmp:/tmp \ run: |
-v ${{ github.workspace }}/target:/app/target \ export CARGO_TARGET_ARMV6K_NINTENDO_3DS_RUNNER="docker run --rm
-v ${{ github.workspace }}:${{ github.workspace }} \ -v /tmp:/tmp
test-runner-3ds:latest -v ${GITHUB_WORKSPACE}/target:/app/target
run: cargo 3ds test ${{ inputs.args }} -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:
continue-on-error: ${{ matrix.toolchain == 'nightly' }} continue-on-error: ${{ matrix.toolchain == 'nightly' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: devkitpro/devkitarm
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
steps: steps:
- name: Checkout branch - name: Checkout branch
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -52,6 +57,8 @@ jobs:
- name: Build and run tests (unit + integration) - name: Build and run tests (unit + integration)
uses: ./.github/actions/test uses: ./.github/actions/test
with:
args: -- -v
- name: Build and run doc tests - name: Build and run doc tests
# Let's still run doc tests even if lib/integration tests fail: # Let's still run doc tests even if lib/integration tests fail:
@ -62,7 +69,7 @@ jobs:
RUSTDOCFLAGS: " --persist-doctests target/armv6k-nintendo-3ds/debug/doctests" RUSTDOCFLAGS: " --persist-doctests target/armv6k-nintendo-3ds/debug/doctests"
uses: ./.github/actions/test uses: ./.github/actions/test
with: with:
args: --doc args: --doc -- -v
- name: Upload citra logs and capture videos - name: Upload citra logs and capture videos
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

17
Dockerfile

@ -1,14 +1,12 @@
FROM buildpack-deps:latest as builder FROM buildpack-deps:latest as builder
ARG CITRA_CHANNEL=nightly
ARG CITRA_RELEASE=1962
WORKDIR /tmp WORKDIR /tmp
COPY ./docker/download_citra.sh /usr/local/bin/download_citra COPY ./docker/download_citra.sh /usr/local/bin/download_citra
RUN apt-get update -y && apt-get install -y jq 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 FROM ubuntu:latest
@ -21,8 +19,13 @@ RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
libavfilter7 \ libavfilter7 \
xvfb xvfb
COPY --from=devkitarm /opt/devkitpro /opt/devkitpro COPY --from=devkitpro/devkitarm:latest /opt/devkitpro /opt/devkitpro
ENV PATH=/opt/devkitpro/devkitARM/bin:${PATH} # 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=builder /tmp/citra.AppImage /usr/local/bin/citra
COPY ./docker/sdl2-config.ini /app/ 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
curl "${RELEASE_API}" | curl "${RELEASE_API}" |
jq --raw-output '.assets[].browser_download_url' | 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 xargs wget -O citra-linux.tar.gz
tar --strip-components 1 -xvf citra-linux.tar.gz tar --strip-components 1 -xvf citra-linux.tar.gz

Loading…
Cancel
Save