initial commit

This commit is contained in:
Ondrej Vlach 2023-12-09 18:28:15 +01:00
commit 7c9da5cc76
Signed by: ovlach
GPG Key ID: 4FF1A23B4914DE70

46
action.yml Normal file
View File

@ -0,0 +1,46 @@
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 }}"