rust-test/action.yml
2023-12-09 19:09:12 +01:00

47 lines
1.5 KiB
YAML

name: 'Test rust project action'
description: 'Test rust project'
inputs:
repository:
description: 'Repository name'
required: true
cargo_nan_secret:
description: 'Cargo-nan secret'
required: true
outputs:
hash:
description: "Hash of Cargo.lock"
value: ${{ steps.get-hash.outputs.hash }}
runs:
using: "composite"
steps:
- name: Checkout project
uses: https://github.com/actions/checkout.git@v4
- name: Hash of Cargo.lock
id: get-hash
run: |
echo "::set-output name=hash::$(md5sum Cargo.lock | awk '{ print $1; }')"
- name: Restore cache
uses: https://gitea.com/wolfogre/cache/restore@v3
id: cache
with:
key: "${{inputs.repository}}-cache-test-${{ steps.get-hash.outputs.hash }}"
path: |
.cache
target
restore-keys: ${{inputs.repository}}-cache-test
- name: Tests
uses: nanobyte-public/rust-action@v3
with:
args: |
CARGO_HOME=./.cache cargo-nan \"${{inputs.cargo_nan_secret}}\" cargo clippy -- -Dwarnings && \
CARGO_HOME=./.cache cargo-nan \"${{inputs.cargo_nan_secret}}\" cargo clippy --tests -- -Dwarnings && \
CARGO_HOME=./.cache cargo-nan \"${{inputs.cargo_nan_secret}}\" cargo test
- name: Save cache
if: steps.cache.outputs.cache-hit != 'true'
uses: https://gitea.com/wolfogre/cache/save@v3
with:
path: |
.cache
target
key: "${{github.repository}}-cache-test-${{ steps.get-hash.outputs.hash }}"