gitbutler/.github/actions/check-crate/action.yaml

40 lines
1.2 KiB
YAML
Raw Normal View History

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:
2024-07-08 21:15:29 +03:00
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.3
with:
2024-07-09 13:35:23 +03:00
shared-key: unix-rust-testing
2024-07-08 21:15:29 +03:00
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: |
2024-07-08 21:15:29 +03:00
cargo test --workspace $(cat /tmp/features)
env:
GITBUTLER_TESTS_NO_CLEANUP: '1'
2024-08-06 13:08:49 +03:00
CARGO_TERM_COLOR: always
shell: bash
2024-07-08 21:15:29 +03:00
- run: cargo clippy --workspace $(cat /tmp/features) -- -D warnings
2024-08-06 13:08:49 +03:00
env:
CARGO_TERM_COLOR: always
shell: bash
2024-07-08 21:15:29 +03:00
- run: cargo clippy --workspace --tests $(cat /tmp/features) -- -D warnings
2024-08-06 13:08:49 +03:00
env:
CARGO_TERM_COLOR: always
shell: bash