From 7e16b8f1236ebb4b046e9ef4f546234f081d9177 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Wed, 5 Jul 2023 20:39:12 +0200 Subject: [PATCH 1/7] First CI test --- .github/actions/setup/action.yml | 36 +++++++++++++ .github/workflows/ci.yml | 87 ++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..7db3c8f --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,36 @@ +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: 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: ${{ inputs.toolchain }} + + - name: Install build tools for host + shell: bash + run: sudo apt-get update && sudo apt-get install -y build-essential + + - name: Set PATH to include devkitARM + shell: bash + # For some reason devkitARM/bin is not part of the default PATH in the container + run: echo "${DEVKITARM}/bin" >> $GITHUB_PATH diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a650544 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,87 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +env: + # https://blog.rust-lang.org/2022/06/22/sparse-registry-testing.html + CARGO_UNSTABLE_SPARSE_REGISTRY: "true" + # actions-rust-lang/setup-rust-toolchain sets some default RUSTFLAGS + RUSTFLAGS: "" + +jobs: + lint: + strategy: + matrix: + toolchain: + # Run against a "known good" nightly + - nightly-2023-01-13 + # Check for breakage on latest nightly + - nightly + + # But if latest nightly fails, allow the workflow to continue + continue-on-error: ${{ matrix.toolchain == 'nightly' }} + runs-on: ubuntu-latest + container: devkitpro/devkitarm + steps: + - name: Checkout branch + uses: actions/checkout@v2 + + - uses: ./.github/actions/setup + with: + toolchain: ${{ matrix.toolchain }} + + - name: Hide duplicate warnings from lint job + if: ${{ matrix.toolchain == 'nightly' }} + run: | + echo "::remove-matcher owner=clippy::" + echo "::remove-matcher owner=rustfmt::" + + - name: Check formatting + run: cargo fmt --all --verbose -- --check + + - name: Cargo check + run: cargo 3ds clippy --color=always --verbose --all-targets + # --deny=warnings would be nice, but can easily break CI for new clippy + # lints getting added. I'd also like to use Github's "inline warnings" + # feature, but https://github.com/actions/runner/issues/2341 means we + # can't have both that *and* colored output. + + project-build: + strategy: + matrix: + toolchain: + - nightly-2023-01-13 + - nightly + continue-on-error: ${{ matrix.toolchain == 'nightly' }} + runs-on: ubuntu-latest + container: devkitpro/devkitarm + steps: + - name: Checkout branch + uses: actions/checkout@v2 + + - uses: ./.github/actions/setup + with: + toolchain: ${{ matrix.toolchain }} + + - name: Hide duplicated warnings from lint job + run: echo "::remove-matcher owner=clippy::" + + - name: Install cargo-3ds + uses: actions-rs/cargo@v1 + with: + command: install + args: --path . + + - name: Create new project + run: cargo 3ds new app --bin + + - name: Build project + working-directory: ./app + run: cargo 3ds build --release From 66eb19ed1f94d7635afa3e56dbf980ab0bd4622f Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sun, 9 Jul 2023 20:11:17 +0200 Subject: [PATCH 2/7] Fixup lint job --- .github/workflows/ci.yml | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a650544..776cda6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,13 +20,8 @@ jobs: strategy: matrix: toolchain: - # Run against a "known good" nightly - - nightly-2023-01-13 - # Check for breakage on latest nightly - - nightly + - stable - # But if latest nightly fails, allow the workflow to continue - continue-on-error: ${{ matrix.toolchain == 'nightly' }} runs-on: ubuntu-latest container: devkitpro/devkitarm steps: @@ -37,21 +32,11 @@ jobs: with: toolchain: ${{ matrix.toolchain }} - - name: Hide duplicate warnings from lint job - if: ${{ matrix.toolchain == 'nightly' }} - run: | - echo "::remove-matcher owner=clippy::" - echo "::remove-matcher owner=rustfmt::" - - name: Check formatting run: cargo fmt --all --verbose -- --check - name: Cargo check - run: cargo 3ds clippy --color=always --verbose --all-targets - # --deny=warnings would be nice, but can easily break CI for new clippy - # lints getting added. I'd also like to use Github's "inline warnings" - # feature, but https://github.com/actions/runner/issues/2341 means we - # can't have both that *and* colored output. + run: cargo clippy --color=always --verbose --all-targets project-build: strategy: @@ -59,6 +44,7 @@ jobs: toolchain: - nightly-2023-01-13 - nightly + continue-on-error: ${{ matrix.toolchain == 'nightly' }} runs-on: ubuntu-latest container: devkitpro/devkitarm @@ -69,9 +55,6 @@ jobs: - uses: ./.github/actions/setup with: toolchain: ${{ matrix.toolchain }} - - - name: Hide duplicated warnings from lint job - run: echo "::remove-matcher owner=clippy::" - name: Install cargo-3ds uses: actions-rs/cargo@v1 From ea28cbc7880b943d9b3f3863e6f907fd269090a9 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sun, 9 Jul 2023 20:22:45 +0200 Subject: [PATCH 3/7] Newer actions --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 776cda6..fb4b630 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,6 @@ jobs: strategy: matrix: toolchain: - - nightly-2023-01-13 - nightly continue-on-error: ${{ matrix.toolchain == 'nightly' }} @@ -50,7 +49,7 @@ jobs: container: devkitpro/devkitarm steps: - name: Checkout branch - uses: actions/checkout@v2 + uses: actions/checkout@v3 - uses: ./.github/actions/setup with: From 17ce4002e88aa5284ca3376b8ee43ca87ce26a16 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sun, 9 Jul 2023 20:31:22 +0200 Subject: [PATCH 4/7] Check for oldest supported version --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb4b630..1b841d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,8 @@ jobs: strategy: matrix: toolchain: + # Oldest supported nightly + - nightly-2023-05-31 - nightly continue-on-error: ${{ matrix.toolchain == 'nightly' }} From f5bee9a4e5fa792e5ce0992d62a63266f4052641 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Wed, 12 Jul 2023 16:40:49 +0200 Subject: [PATCH 5/7] Slight description change --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 8677534..af88dbe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "cargo-3ds" version = "0.1.0" authors = [ "Rust3DS Org", "Andrea Ciliberti " ] -description = "Cargo wrapper for developing Rust-based Nintendo 3DS homebrew apps" +description = "Cargo wrapper for developing Nintendo 3DS homebrew apps" repository = "https://github.com/Meziu/cargo-3ds" license = "MIT OR Apache-2.0" edition = "2021" From 4560716fcca373a8fde8371e955c406751de8f3d Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Wed, 12 Jul 2023 16:44:44 +0200 Subject: [PATCH 6/7] Fix >= version check --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0af6431..fb94e07 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -136,7 +136,7 @@ pub fn check_rust_version() { } let old_version = MINIMUM_RUSTC_VERSION - > Version { + >= Version { // Remove `-nightly` pre-release tag for comparison. pre: semver::Prerelease::EMPTY, ..rustc_version.semver.clone() @@ -146,7 +146,7 @@ pub fn check_rust_version() { None => false, Some(date) => { MINIMUM_COMMIT_DATE - > CommitDate::parse(&date).expect("could not parse `rustc --version` commit date") + >= CommitDate::parse(&date).expect("could not parse `rustc --version` commit date") } }; From 70d5ec1843d724e076151faf25663b284a6a4414 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Wed, 12 Jul 2023 18:24:05 +0200 Subject: [PATCH 7/7] Undo wrong changes --- .github/workflows/ci.yml | 2 +- src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b841d3..7c8a272 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: matrix: toolchain: # Oldest supported nightly - - nightly-2023-05-31 + - nightly-2023-06-01 - nightly continue-on-error: ${{ matrix.toolchain == 'nightly' }} diff --git a/src/lib.rs b/src/lib.rs index fb94e07..0af6431 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -136,7 +136,7 @@ pub fn check_rust_version() { } let old_version = MINIMUM_RUSTC_VERSION - >= Version { + > Version { // Remove `-nightly` pre-release tag for comparison. pre: semver::Prerelease::EMPTY, ..rustc_version.semver.clone() @@ -146,7 +146,7 @@ pub fn check_rust_version() { None => false, Some(date) => { MINIMUM_COMMIT_DATE - >= CommitDate::parse(&date).expect("could not parse `rustc --version` commit date") + > CommitDate::parse(&date).expect("could not parse `rustc --version` commit date") } };