gitbutler/.github/actions/check-crate/action.yaml
Mattias Granlund e2ae098aa1 Change gh actions rust cache key
- different dependencies -> different cache
2024-10-30 14:23:32 +01:00

40 lines
1.2 KiB
YAML

name: check-crate
description: tests a core lib crate
inputs:
features:
description: "the features to enable (can be an array, or '*' for all, '' for defaults, or [] for none)"
required: false
runs:
using: 'composite'
steps:
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.3
with:
shared-key: unix-rust-testing-v2
key: ${{ inputs.features }}
- run: |
printf '%s\n' "$JSON_DOC" > /tmp/features.json
cat /tmp/features.json | jq -r 'if . == "*" then "--all-features" elif . == "" then "" elif type == "array" then if length == 0 then "--no-default-features" else "--no-default-features --features " + join(",") end else . end' > /tmp/features
cat /tmp/features
env:
FEATURES: ${{ inputs.features }}
shell: bash
- run: |
cargo test --workspace $(cat /tmp/features)
env:
GITBUTLER_TESTS_NO_CLEANUP: '1'
CARGO_TERM_COLOR: always
shell: bash
- run: cargo clippy --workspace $(cat /tmp/features) -- -D warnings
env:
CARGO_TERM_COLOR: always
shell: bash
- run: cargo clippy --workspace --tests $(cat /tmp/features) -- -D warnings
env:
CARGO_TERM_COLOR: always
shell: bash