-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
85 lines (77 loc) · 2.46 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: "bulloak-toolchain"
description: "Install Bulloak and check that Solidity tests conform to BTT spec"
author: "Sablier Labs Ltd"
branding:
icon: "feather"
color: "green"
inputs:
cache:
default: "true"
description: "Whether to cache Cargo build"
required: false
cache-key:
default: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
description: "A custom key to identify the cache"
required: false
cache-restore-keys:
default: ${{ runner.os }}-cargo-
description: "A custom key to identify the cache to restore"
required: false
save-always:
default: "true"
description: "Save the cache even if a prior step fails"
required: false
skip-modifiers:
default: "false"
description: "Whether to ignore modifiers declaration in the Solidity test contracts"
required: false
test-dir:
description: "The test directory"
required: true
outputs:
bulloak-version:
description: "Version as reported by `bulloak --version`"
value: ${{steps.version.outputs.bulloak-version}}
runs:
using: "composite"
steps:
- name: "Install Rust"
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- id: "cache-cargo"
name: "Setup Rust Caching"
if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v4
with:
key: ${{ inputs.cache-key }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
restore-keys: ${{ inputs.cache-restore-keys }}
save-always: ${{ inputs.save-always }}
- name: "Install bulloak or use the cached version"
if: steps.cache-cargo.outputs.cache-hit != 'true'
shell: bash
run: cargo install bulloak
- id: "version"
name: "Print installed version"
shell: bash
run: |
echo "bulloak-version=$(bulloak --version)" >> $GITHUB_OUTPUT
bulloak --version
- name: "Check that the Solidity tests conform to BTT spec"
env:
SKIP_MODIFIERS: ${{ inputs.skip-modifiers }}
TEST_DIR: ${{ inputs.test-dir }}
shell: bash
run: |
echo "🌳 Checking the Solidity tests using Bulloak"
if [ "$SKIP_MODIFIERS" == "true" ]; then
find $TEST_DIR -name "*.tree" -print0 | xargs -0 -I {} sh -c 'bulloak check "{}" --skip-modifiers'
else
find $TEST_DIR -name "*.tree" -print0 | xargs -0 -I {} sh -c 'bulloak check "{}"'
fi