CI: Simplify verify action by leveraging packaged defaults
Some checks failed
/ verify (push) Has been cancelled
Some checks failed
/ verify (push) Has been cancelled
This commit is contained in:
parent
27fa6d15eb
commit
7bdc3dfec6
2 changed files with 23 additions and 39 deletions
|
|
@ -4,12 +4,10 @@ on:
|
||||||
- '*'
|
- '*'
|
||||||
paths:
|
paths:
|
||||||
- src/**
|
- src/**
|
||||||
- static/graph*
|
- static/*
|
||||||
- static/welcome.toml
|
|
||||||
- .forgejo/**
|
- .forgejo/**
|
||||||
- .justfile
|
- .justfile
|
||||||
- Cargo.toml
|
- Cargo.*
|
||||||
- Cargo.lock
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
verify:
|
verify:
|
||||||
|
|
@ -17,57 +15,43 @@ jobs:
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
container:
|
container:
|
||||||
image: rust:slim
|
image: rust:slim
|
||||||
env:
|
|
||||||
RUSTUP_HOME: /rust/rustup
|
|
||||||
CARGO_HOME: /rust/cargo
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install action dependencies
|
- name: Install action dependencies
|
||||||
run: >
|
run: |
|
||||||
apt-get install --no-install-recommends --update -y
|
apt-get install --no-install-recommends --update -y \
|
||||||
nodejs git curl xz-utils
|
nodejs git nix
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-tags: true
|
fetch-tags: true
|
||||||
|
|
||||||
- name: Set up Rust toolchain
|
- name: Cleanup checkout action dependencies
|
||||||
run: |
|
run: apt-get purge -y nodejs git
|
||||||
mkdir -p "$RUSTUP_HOME"
|
|
||||||
mkdir -p "$CARGO_HOME"
|
|
||||||
|
|
||||||
rust_version=$(
|
|
||||||
grep '^rust-version = "' Cargo.toml \
|
|
||||||
| cut -d '"' -f 2
|
|
||||||
)
|
|
||||||
|
|
||||||
rustup default "$rust_version"
|
|
||||||
rustup toolchain install nightly
|
|
||||||
rustup component add llvm-tools
|
|
||||||
rustup component add --toolchain nightly rustfmt clippy
|
|
||||||
rustup target add x86_64-unknown-linux-musl x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
- name: Set up CI user
|
- name: Set up CI user
|
||||||
run: |
|
run: |
|
||||||
useradd -m ci
|
useradd -m ci
|
||||||
mkdir /nix
|
chown -R ci:ci /nix .
|
||||||
chown -R ci:ci "$RUSTUP_HOME" "$CARGO_HOME" "$PWD" /nix
|
|
||||||
printf '[safe]\ndirectory = %s\n' "$PWD" > /etc/gitconfig
|
|
||||||
|
|
||||||
- name: Set up Nix
|
- name: Set up Rust toolchain
|
||||||
run: |
|
run: |
|
||||||
mkdir /etc/nix
|
rust_version=$(sed -nE 's/^rust-version = "(.*)"$/\1/p' Cargo.toml)
|
||||||
echo experimental-features = nix-command flakes \
|
|
||||||
>> /etc/nix/nix.conf
|
|
||||||
su ci -c "
|
su ci -c "
|
||||||
sh -c 'curl -L https://nixos.org/nix/install |
|
rustup default '$rust_version'
|
||||||
bash -s -- --no-daemon' \
|
rustup toolchain install nightly
|
||||||
|
rustup component add llvm-tools
|
||||||
|
rustup component add --toolchain nightly rustfmt clippy
|
||||||
|
rustup target add \
|
||||||
|
x86_64-unknown-linux-musl \
|
||||||
|
x86_64-unknown-linux-gnu
|
||||||
"
|
"
|
||||||
|
|
||||||
- name: Assess
|
- name: Assess
|
||||||
run: |
|
run: |
|
||||||
su ci -lc "
|
ENV_PATH=$PATH su ci -c "
|
||||||
export RUSTUP_HOME=$RUSTUP_HOME CARGO_HOME=$CARGO_HOME
|
nix --experimental-features 'nix-command flakes' \
|
||||||
nix develop path:$FORGEJO_WORKSPACE -c \
|
develop path:$PWD \
|
||||||
just -f $FORGEJO_WORKSPACE/.justfile verify
|
-c just -f $PWD/.justfile verify
|
||||||
"
|
"
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@
|
||||||
cargo-deny
|
cargo-deny
|
||||||
cargo-llvm-cov
|
cargo-llvm-cov
|
||||||
cargo-msrv
|
cargo-msrv
|
||||||
|
git
|
||||||
just
|
just
|
||||||
rustup
|
rustup
|
||||||
taplo
|
taplo
|
||||||
|
|
@ -60,7 +61,6 @@
|
||||||
dev = [
|
dev = [
|
||||||
cargo-mutants
|
cargo-mutants
|
||||||
watchexec
|
watchexec
|
||||||
git
|
|
||||||
];
|
];
|
||||||
edit = dev ++ [
|
edit = dev ++ [
|
||||||
neovim
|
neovim
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue