impr: Devcontainers startup time #277
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
lint: | |
name: Lint code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
version: 3.x | |
- name: Install Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Lint the code | |
run: task lint | |
lint-generated-project: | |
name: Lint generated project code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
version: 3.x | |
- name: Install Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Lint the generated project code | |
run: task lint-generated-project | |
analyse: | |
name: Analyse code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
version: 3.x | |
- name: Install Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Analyse the code | |
run: task analyse | |
analyse-generated-project: | |
name: Analyse generated project code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
version: 3.x | |
- name: Install Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Analyse the generated project code | |
run: task analyse-generated-project | |
dependency-check: | |
name: Check dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
version: 3.x | |
- name: Install Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install cargo-audit | |
run: cargo install cargo-audit | |
- name: Run cargo audit | |
run: task audit | |
build: | |
name: Build code | |
needs: | |
- dependency-check | |
- lint | |
- analyse | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-24.04 | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-24.04 | |
target: aarch64-unknown-linux-musl | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install Rust Targets | |
run: | | |
rustup target add ${{ matrix.target }} | |
# Unfortunately, github still don't support managed runners for arm64 :( | |
# It's a sad fact that they only offer it for enterprise customers. | |
# I can run it on my raspberry pi, but it's not ideal | |
# Instead will cross-compile this part for now with musl libc | |
- name: Add tools for cross-compiling with musl libc for linux arm64 | |
if: matrix.target == 'aarch64-unknown-linux-musl' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
pkg-config \ | |
musl-tools | |
rustup target add aarch64-unknown-linux-musl | |
cd && \ | |
wget https://musl.cc/aarch64-linux-musl-cross.tgz && \ | |
tar -xzf aarch64-linux-musl-cross.tgz && \ | |
sudo mv aarch64-linux-musl-cross /opt/ && \ | |
rm -rf aarch64-linux-musl-cross.tgz | |
echo "PATH=/opt/aarch64-linux-musl-cross/bin:$PATH" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
cargo build --release --target ${{ matrix.target }} | |
test: | |
name: Test code | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
version: 3.x | |
- name: Install Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Test the code | |
run: task test |