Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic CI with lints and cargo-new #37

Merged
merged 7 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -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
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
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:
- stable

runs-on: ubuntu-latest
container: devkitpro/devkitarm
steps:
- name: Checkout branch
uses: actions/checkout@v2

- uses: ./.github/actions/setup
with:
toolchain: ${{ matrix.toolchain }}

- name: Check formatting
run: cargo fmt --all --verbose -- --check

- name: Cargo check
run: cargo clippy --color=always --verbose --all-targets

project-build:
strategy:
matrix:
toolchain:
# Oldest supported nightly
- nightly-2023-06-01
- nightly

continue-on-error: ${{ matrix.toolchain == 'nightly' }}
runs-on: ubuntu-latest
container: devkitpro/devkitarm
steps:
- name: Checkout branch
uses: actions/checkout@v3

- uses: ./.github/actions/setup
with:
toolchain: ${{ matrix.toolchain }}

- 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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "cargo-3ds"
version = "0.1.0"
authors = [ "Rust3DS Org", "Andrea Ciliberti <[email protected]>" ]
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"
Expand Down