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
1e364694f9
1 changed files with 22 additions and 26 deletions
|
|
@ -17,57 +17,53 @@ 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 xz-utils nix
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-tags: true
|
fetch-tags: true
|
||||||
|
|
||||||
|
- name: Cleanup checkout action dependencies
|
||||||
|
run: >
|
||||||
|
apt-get purge -y nodejs
|
||||||
|
|
||||||
|
- name: Set up CI user
|
||||||
|
run: |
|
||||||
|
useradd -m ci
|
||||||
|
chown -R ci:ci "$FORGEJO_WORKSPACE" /nix
|
||||||
|
printf '[safe]\ndirectory = %s\n' "$FORGEJO_WORKSPACE" \
|
||||||
|
> /etc/gitconfig
|
||||||
|
|
||||||
- name: Set up Rust toolchain
|
- name: Set up Rust toolchain
|
||||||
run: |
|
run: |
|
||||||
mkdir -p "$RUSTUP_HOME"
|
|
||||||
mkdir -p "$CARGO_HOME"
|
|
||||||
|
|
||||||
rust_version=$(
|
rust_version=$(
|
||||||
grep '^rust-version = "' Cargo.toml \
|
grep '^rust-version = "' Cargo.toml \
|
||||||
| cut -d '"' -f 2
|
| cut -d '"' -f 2
|
||||||
)
|
)
|
||||||
|
|
||||||
rustup default "$rust_version"
|
su ci -c "
|
||||||
rustup toolchain install nightly
|
rustup default '$rust_version'
|
||||||
rustup component add llvm-tools
|
# rustup toolchain install nightly
|
||||||
rustup component add --toolchain nightly rustfmt clippy
|
# rustup component add llvm-tools
|
||||||
rustup target add x86_64-unknown-linux-musl x86_64-unknown-linux-gnu
|
# rustup component add --toolchain nightly rustfmt clippy
|
||||||
|
# rustup target add \
|
||||||
- name: Set up CI user
|
# x86_64-unknown-linux-musl \
|
||||||
run: |
|
# x86_64-unknown-linux-gnu
|
||||||
useradd -m ci
|
"
|
||||||
mkdir /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 Nix
|
||||||
run: |
|
run: |
|
||||||
mkdir /etc/nix
|
|
||||||
echo experimental-features = nix-command flakes \
|
echo experimental-features = nix-command flakes \
|
||||||
>> /etc/nix/nix.conf
|
>> /etc/nix/nix.conf
|
||||||
su ci -c "
|
|
||||||
sh -c 'curl -L https://nixos.org/nix/install |
|
|
||||||
bash -s -- --no-daemon' \
|
|
||||||
"
|
|
||||||
|
|
||||||
- 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 develop path:$FORGEJO_WORKSPACE -c \
|
nix develop path:$FORGEJO_WORKSPACE -c \
|
||||||
just -f $FORGEJO_WORKSPACE/.justfile verify
|
just -f $FORGEJO_WORKSPACE/.justfile verify
|
||||||
"
|
"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue