From cabd3acf1a49a1ba59df6b964fc7381c9d0b0d1a Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Mon, 3 Apr 2023 13:22:20 -0400 Subject: [PATCH] Try using a composite action instead of workflow --- .github/actions/setup/action.yml | 45 ++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 10 +++++-- .github/workflows/setup.yml | 48 -------------------------------- 3 files changed, 53 insertions(+), 50 deletions(-) create mode 100644 .github/actions/setup/action.yml delete mode 100644 .github/workflows/setup.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..2f33006 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,45 @@ +name: Setup +description: Set up CI environment for Rust + 3DS development + +inputs: + toolchain: + description: The Rust toolchain to use for the steps + required: true + default: nightly + +runs: + using: composite + 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: Checkout branch + uses: actions/checkout@v2 + + - name: Setup default Rust toolchain + # Use this helper action so we get matcher support + # https://github.com/actions-rust-lang/setup-rust-toolchain/pull/15 + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: clippy, rustfmt, rust-src + toolchain: ${{ matrix.toolchain }} + + - name: Install build tools for host + shell: bash + 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb4d218..7b44782 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,10 @@ on: - master workflow_dispatch: +env: + # https://blog.rust-lang.org/2022/06/22/sparse-registry-testing.html + CARGO_UNSTABLE_SPARSE_REGISTRY: "true" + jobs: lint: strategy: @@ -21,8 +25,9 @@ jobs: # But if latest nightly fails, allow the workflow to continue continue-on-error: ${{ matrix.toolchain == 'nightly' }} runs-on: ubuntu-latest + container: devkitpro/devkitarm steps: - - uses: ./.github/workflows/setup.yml + - uses: ./.github/actions/setup with: toolchain: ${{ matrix.toolchain }} @@ -44,8 +49,9 @@ jobs: - nightly continue-on-error: ${{ matrix.toolchain == 'nightly' }} runs-on: ubuntu-latest + container: devkitpro/devkitarm steps: - - uses: ./.github/workflows/setup.yml + - uses: ./.github/actions/setup with: toolchain: ${{ matrix.toolchain }} diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml deleted file mode 100644 index bfdc8de..0000000 --- a/.github/workflows/setup.yml +++ /dev/null @@ -1,48 +0,0 @@ -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