From a53c45aefe471615e7cda57cf4a6fbbbf8a539c7 Mon Sep 17 00:00:00 2001 From: Alois Date: Sun, 28 Jun 2026 17:37:46 +0200 Subject: [PATCH] (fix): ci workflow --- .forgejo/workflows/ci.yml | 178 +++++--------------------------------- 1 file changed, 22 insertions(+), 156 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 4659f4f..5bc0a55 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -7,12 +7,11 @@ on: env: CARGO_TERM_COLOR: always - NIX_CONFIG: experimental-features = nix-command flakes jobs: - fmt: - name: rustfmt + checks: + name: checks runs-on: docker steps: - uses: https://data.forgejo.org/actions/checkout@v4 @@ -22,162 +21,29 @@ jobs: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils curl -L https://nixos.org/nix/install | sh -s -- --daemon - - name: Check formatting + - name: Run checks run: | . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command cargo fmt --all --check + nix develop --command bash -lc ' + set -euo pipefail - clippy: - name: clippy - runs-on: docker - steps: - - uses: https://data.forgejo.org/actions/checkout@v4 + cargo fmt --all --check + cargo clippy --workspace --exclude mtp-wasm --all-targets --all-features -- -D warnings -W unreachable-pub + cargo test --workspace --exclude mtp-wasm --all-features + RUSTFLAGS="--cfg web_sys_unstable_apis" cargo build -p mtp-wasm --target wasm32-unknown-unknown + cargo deny check advisories bans sources + cargo machete - - name: Install Nix - run: | - apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils - curl -L https://nixos.org/nix/install | sh -s -- --daemon + pnpm install --frozen-lockfile + pnpm run dup - - name: Run clippy - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command mtp-clippy + RUSTFLAGS="--cfg web_sys_unstable_apis" wasm-pack build wasm --target web + RUSTFLAGS="--cfg web_sys_unstable_apis" pnpm run build + pnpm --filter mtp-web-client run build - test: - name: test - runs-on: docker - steps: - - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Nix - run: | - apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils - curl -L https://nixos.org/nix/install | sh -s -- --daemon - - - name: Run tests - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command bash -lc 'cargo test --workspace --exclude mtp-wasm --all-features' - - wasm: - name: wasm build - runs-on: docker - steps: - - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Nix - run: | - apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils - curl -L https://nixos.org/nix/install | sh -s -- --daemon - - - name: Build wasm crate - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command bash -lc 'cargo build -p mtp-wasm --target wasm32-unknown-unknown' - env: - RUSTFLAGS: --cfg web_sys_unstable_apis - - example: - name: example - runs-on: docker - steps: - - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Nix - run: | - apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils - curl -L https://nixos.org/nix/install | sh -s -- --daemon - - - name: Check example usage workspace - working-directory: example - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop .. --command bash -lc 'export MTP_TYPE_MAPS="$PWD/type-maps.yaml"; cargo check --workspace --all-targets --all-features' - - deny: - name: cargo-deny - runs-on: docker - steps: - - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Nix - run: | - apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils - curl -L https://nixos.org/nix/install | sh -s -- --daemon - - - name: Run cargo-deny - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command cargo deny check advisories bans sources - - machete: - name: cargo-machete - runs-on: docker - steps: - - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Nix - run: | - apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils - curl -L https://nixos.org/nix/install | sh -s -- --daemon - - - name: Run cargo-machete - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command mtp-machete - - duplicates: - name: duplicate code - runs-on: docker - steps: - - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Nix - run: | - apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils - curl -L https://nixos.org/nix/install | sh -s -- --daemon - - - name: Install dependencies - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command pnpm install --frozen-lockfile - - - name: Run duplicate detector - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command pnpm run dup - - web-client: - name: web client - runs-on: docker - steps: - - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Nix - run: | - apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils - curl -L https://nixos.org/nix/install | sh -s -- --daemon - - - name: Build wasm package - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command wasm-pack build wasm --target web - env: - RUSTFLAGS: --cfg web_sys_unstable_apis - - - name: Install dependencies - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command pnpm install --frozen-lockfile - - - name: Build TypeScript package - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command pnpm run build - env: - RUSTFLAGS: --cfg web_sys_unstable_apis - - - name: Build web client - run: | - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - nix develop --command pnpm --filter mtp-web-client run build + ( + cd example + export MTP_TYPE_MAPS="$PWD/type-maps.yaml" + cargo check --workspace --all-targets --all-features + ) + '