2023-12-09 17:28:15 +00:00
|
|
|
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
|
2024-12-18 12:13:30 +00:00
|
|
|
uses: nanobyte-public/rust-action@v5
|
2023-12-09 17:28:15 +00:00
|
|
|
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 }}"
|
2024-12-18 12:13:30 +00:00
|
|
|
|