mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-27 09:47:34 +03:00
45 lines
1.5 KiB
YAML
45 lines
1.5 KiB
YAML
name: check-crate
|
|
description: tests a core lib crate
|
|
inputs:
|
|
crate:
|
|
description: "the name of the crate to check"
|
|
required: true
|
|
features:
|
|
description: "the features to enable (can be an array, or '*' for all, '' for defaults, or [] for none)"
|
|
required: false
|
|
action:
|
|
description: "the action to run"
|
|
required: true
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- uses: ./.github/actions/init-env-rust
|
|
|
|
- run: |
|
|
cargo build --locked -p gitbutler-git --bins
|
|
shell: bash
|
|
|
|
- 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 build -p gitbutler-git --bins
|
|
cargo test --locked -p ${{ inputs.crate }} --all-targets $(cat /tmp/features)
|
|
if: inputs.action == 'test'
|
|
env:
|
|
GITBUTLER_TESTS_NO_CLEANUP: "1"
|
|
shell: bash
|
|
|
|
- run: cargo clippy -p ${{ inputs.crate }} --all-targets $(cat /tmp/features) -- -D warnings
|
|
if: inputs.action == 'check'
|
|
shell: bash
|
|
|
|
- run: cargo clippy -p ${{ inputs.crate }} --all-targets --tests $(cat /tmp/features) -- -D warnings
|
|
if: inputs.action == 'check-tests'
|
|
shell: bash
|