Browse Source

Set up reusable workflow and add doctests

pull/109/head
Ian Chamberlain 2 years ago
parent
commit
158e6a5924
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 50
      .github/workflows/ci.yml
  2. 48
      .github/workflows/setup.yml

50
.github/workflows/ci.yml

@ -9,10 +9,6 @@ on:
- master - master
workflow_dispatch: workflow_dispatch:
env:
# https://blog.rust-lang.org/2022/06/22/sparse-registry-testing.html
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
jobs: jobs:
lint: lint:
strategy: strategy:
@ -25,38 +21,10 @@ jobs:
# But if latest nightly fails, allow the workflow to continue # But if latest nightly fails, allow the workflow to continue
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:
# https://github.com/nektos/act/issues/917#issuecomment-1074421318 - uses: ./.github/workflows/setup.yml
- if: ${{ env.ACT }}
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: Checkout branch
uses: actions/checkout@v2
- name: Setup default Rust toolchain
uses: actions-rs/toolchain@v1
with: with:
components: clippy, rustfmt, rust-src
profile: minimal
toolchain: ${{ matrix.toolchain }} toolchain: ${{ matrix.toolchain }}
default: true
- name: Install build tools for host
run: sudo apt-get update && sudo apt-get install -y build-essential
- name: Install cargo-3ds
uses: actions-rs/cargo@v1
with:
command: install
# TODO: this should probably just be a released version from crates.io
# once cargo-3ds gets published somewhere...
args: >-
--git https://github.com/rust3ds/cargo-3ds
--rev 7b70b6b26c4740b9a10ab85b832ee73c41142bbb
- name: Check formatting - name: Check formatting
run: cargo fmt --all --verbose -- --check run: cargo fmt --all --verbose -- --check
@ -68,5 +36,21 @@ jobs:
# feature, but https://github.com/actions/runner/issues/2341 means we # feature, but https://github.com/actions/runner/issues/2341 means we
# can't have both that *and* colored output. # can't have both that *and* colored output.
doctests:
strategy:
matrix:
toolchain:
- nightly-2023-01-13
- nightly
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/setup.yml
with:
toolchain: ${{ matrix.toolchain }}
- name: Build doc tests
run: cargo 3ds test --doc --verbose
# TODO: it would be nice to actually build 3dsx for examples/tests, etc. # TODO: it would be nice to actually build 3dsx for examples/tests, etc.
# and run it somehow, but exactly how remains to be seen. # and run it somehow, but exactly how remains to be seen.

48
.github/workflows/setup.yml

@ -0,0 +1,48 @@
name: Setup
on:
workflow_call:
inputs:
toolchain:
required: true
type: string
env:
# https://blog.rust-lang.org/2022/06/22/sparse-registry-testing.html
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
jobs:
setup:
runs-on: ubuntu-latest
container: devkitpro/devkitarm
steps:
# https://github.com/nektos/act/issues/917#issuecomment-1074421318
- if: ${{ env.ACT }}
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: Checkout branch
uses: actions/checkout@v2
- name: Setup default Rust toolchain
# Use this helper
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy, rustfmt, rust-src
toolchain: ${{ matrix.toolchain }}
- name: Install build tools for host
run: sudo apt-get update && sudo apt-get install -y build-essential
- name: Install cargo-3ds
uses: actions-rs/cargo@v1
with:
command: install
# TODO: this should probably just be a released version from crates.io
# once cargo-3ds gets published somewhere...
# also switch to hash once feature/doctests gets merged
args: >-
--git https://github.com/rust3ds/cargo-3ds
--rev feature/doctests
Loading…
Cancel
Save