mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 11:21:24 +00:00
Attempt composite action
This commit is contained in:
parent
825b355917
commit
bfe431f764
2 changed files with 71 additions and 67 deletions
64
.forgejo/actions/prepare-rust/action.yaml
Normal file
64
.forgejo/actions/prepare-rust/action.yaml
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
name: Prepare Rust
|
||||||
|
description: Prepare an environment to build or test rust packages
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
targets:
|
||||||
|
description: "Targets to add to rustup, comma separated"
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Fetch rust cache
|
||||||
|
id: cache
|
||||||
|
uses: https://github.com/actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
paths: |
|
||||||
|
~/.cargo/bin
|
||||||
|
~/.cargo/registry/index
|
||||||
|
~/.cargo/registry/cache
|
||||||
|
~/.cargo/git/db
|
||||||
|
~/.rustup
|
||||||
|
target/
|
||||||
|
key: rust-${{ inputs.targets }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock')}}
|
||||||
|
-
|
||||||
|
name: Install rustup and rust
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
uses: https://github.com/dtolnay/rust-toolchain@1.75.0
|
||||||
|
with:
|
||||||
|
components: clippy
|
||||||
|
targets: x86_64-unknown-linux-musl,armv7-unknown-linux-musleabihf,aarch64-unknown-linux-musl
|
||||||
|
-
|
||||||
|
name: Install cargo-binstall
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
uses: https://github.com/taiki-e/install-action@v2
|
||||||
|
with:
|
||||||
|
tool: cargo-binstall
|
||||||
|
-
|
||||||
|
name: Install cargo-zigbuild
|
||||||
|
run: yes | cargo binstall cargo-zigbuild
|
||||||
|
-
|
||||||
|
name: Fetch dependencies
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: cargo fetch
|
||||||
|
-
|
||||||
|
name: Export path
|
||||||
|
if: steps.cache.outputs.cache-hit == 'true'
|
||||||
|
run: |
|
||||||
|
export PATH=$PATH:$HOME/.cargo/bin
|
||||||
|
export PATH=$PATH:$HOME/.rustup/bin
|
||||||
|
-
|
||||||
|
name: Populate rust cache
|
||||||
|
uses: https://github.com/actions/cache/restore@v4
|
||||||
|
if: steps.cache.ou.cache-hit != 'true'
|
||||||
|
with:
|
||||||
|
paths: |
|
||||||
|
~/.cargo/bin
|
||||||
|
~/.cargo/registry/index
|
||||||
|
~/.cargo/registry/cache
|
||||||
|
~/.cargo/git/db
|
||||||
|
~/.rustup
|
||||||
|
target/
|
||||||
|
key: ${{ steps.cache.outputs.cache-primary-key }}
|
|
@ -5,41 +5,7 @@ on:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cache-rust:
|
|
||||||
runs-on: docker
|
|
||||||
container:
|
|
||||||
image: docker.io/node:20-bookworm
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Install rustup and rust
|
|
||||||
id: rust
|
|
||||||
uses: https://github.com/dtolnay/rust-toolchain@1.75.0
|
|
||||||
with:
|
|
||||||
components: clippy
|
|
||||||
targets: x86_64-unknown-linux-musl,armv7-unknown-linux-musleabihf,aarch64-unknown-linux-musl
|
|
||||||
-
|
|
||||||
name: Install cargo-binstall
|
|
||||||
uses: https://github.com/taiki-e/install-action@v2
|
|
||||||
with:
|
|
||||||
tool: cargo-binstall
|
|
||||||
-
|
|
||||||
name: Install cargo-zigbuild
|
|
||||||
run: yes | cargo binstall cargo-zigbuild
|
|
||||||
-
|
|
||||||
name: Populate rust cache
|
|
||||||
uses: https://github.com/actions/cache/save@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/bin
|
|
||||||
~/.cargo/registry/index
|
|
||||||
~/.cargo/registry/cache
|
|
||||||
~/.cargo/git/db
|
|
||||||
~/.rustup
|
|
||||||
key: ${{ runner.os }}-cargo-${{ steps.rust.outputs.cacheKey }}
|
|
||||||
|
|
||||||
|
|
||||||
clippy:
|
clippy:
|
||||||
needs: [cache-rust]
|
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: docker.io/node:20-bookworm
|
image: docker.io/node:20-bookworm
|
||||||
|
@ -48,16 +14,8 @@ jobs:
|
||||||
name: Checkout pict-rs
|
name: Checkout pict-rs
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Fetch rust cache
|
name: Setup Rust
|
||||||
uses: https://github.com/actions/cache/restore@v4
|
uses: .forgejo/actions/prepare-rust
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/bin
|
|
||||||
~/.cargo/registry/index
|
|
||||||
~/.cargo/registry/cache
|
|
||||||
~/.cargo/git/db
|
|
||||||
~/.rustup
|
|
||||||
key: ${{ runner.os }}-cargo-${{ jobs.cache-rust.steps.rust.outputs.cacheKey }}
|
|
||||||
-
|
-
|
||||||
name: Clippy
|
name: Clippy
|
||||||
run: |
|
run: |
|
||||||
|
@ -65,7 +23,6 @@ jobs:
|
||||||
cargo clippy --no-default-features --features io-uring -- -D warnings
|
cargo clippy --no-default-features --features io-uring -- -D warnings
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
needs: [cache-rust]
|
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: docker.io/node:20-bookworm
|
image: docker.io/node:20-bookworm
|
||||||
|
@ -74,14 +31,13 @@ jobs:
|
||||||
name: Checkout pict-rs
|
name: Checkout pict-rs
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Install rustup and rust
|
name: Setup Rust
|
||||||
uses: https://github.com/dtolnay/rust-toolchain@1.75.0
|
uses: .forgejo/actions/prepare-rust
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
run: cargo test
|
run: cargo test
|
||||||
|
|
||||||
check:
|
check:
|
||||||
needs: [cache-rust]
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target:
|
target:
|
||||||
|
@ -96,26 +52,10 @@ jobs:
|
||||||
name: Checkout pict-rs
|
name: Checkout pict-rs
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Fetch rust cache
|
name: Setup Rust
|
||||||
uses: https://github.com/actions/cache/restore@v4
|
uses: .forgejo/actions/prepare-rust
|
||||||
with:
|
with:
|
||||||
path: |
|
targets: x86_64-unknown-linux-musl,armv7-unknown-linux-musleabihf,aarch64-unknown-linux-musl
|
||||||
~/.cargo/bin
|
|
||||||
~/.cargo/registry/index
|
|
||||||
~/.cargo/registry/cache
|
|
||||||
~/.cargo/git/db
|
|
||||||
~/.rustup
|
|
||||||
key: ${{ runner.os }}-cargo-${{ jobs.cache-rust.steps.rust.outputs.cacheKey }}
|
|
||||||
-
|
|
||||||
name: Install cargo-binstall
|
|
||||||
uses: https://github.com/taiki-e/install-action@v2
|
|
||||||
with:
|
|
||||||
tool: cargo-binstall
|
|
||||||
-
|
|
||||||
name: Install zig
|
|
||||||
uses: https://github.com/goto-bus-stop/setup-zig@v2
|
|
||||||
with:
|
|
||||||
version: 0.11.0
|
|
||||||
-
|
-
|
||||||
name: Debug builds
|
name: Debug builds
|
||||||
run: cargo zigbuild --target ${{ matrix.target }}
|
run: cargo zigbuild --target ${{ matrix.target }}
|
||||||
|
|
Loading…
Reference in a new issue