commit 7c9da5cc76a836d2bb4c089fc46d1d19cc4637a5 Author: Ondrej Vlach Date: Sat Dec 9 18:28:15 2023 +0100 initial commit diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..82ec7f6 --- /dev/null +++ b/action.yml @@ -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 }}"