Skip to content

Commit

Permalink
feat: add caching to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dubfib authored Nov 25, 2024
1 parent 7a6d10f commit 2f1b759
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,31 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: sudo apt-get install -y yara
- run: |

- name: Cache YARA
uses: actions/cache@v2
id: cache-yara
with:
path: "/usr/local/bin/yara"
key: ${{ secrets.YARA_VERSION }}

- name: Install YARA
env:
CACHE_HIT: ${{ steps.cache-yara.outputs.cache-hit }}
YARA_VERSION: ${{ secrets.YARA_VERSION }}
run: |
if [[ "$CACHE_HIT" == 'true' ]]; then
echo "cache found, skipping install"
else
sudo apt-get install -y yara
mkdir -p ~/yara
sudo cp /usr/local/bin/yara ~/yara/
fi
- name: Validate YARA
run: |
output=$(find . -type f -iname "*.yara" -exec yara -w {} /dev/null \; 2>&1)
echo "$output"
if echo "$output" | grep -q 'syntax error'; then
echo "syntax error"
echo "$output"
exit 1
fi

0 comments on commit 2f1b759

Please sign in to comment.