Skip to content

Commit

Permalink
feat(ci): add slither to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tamtamchik committed Feb 7, 2024
1 parent a15137a commit 71367e7
Show file tree
Hide file tree
Showing 5 changed files with 1,919 additions and 1 deletion.
73 changes: 73 additions & 0 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Code Analysis

on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]

jobs:
slither:
runs-on: ubuntu-latest

permissions:
contents: read
security-events: write

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

# here and below steps taken from official guide
# https://pnpm.io/continuous-integration#github-actions
- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

# REVIEW: here and below steps taken from official guide
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
- name: Install poetry
run: >
pipx install poetry
# REVIEW:
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-adding-a-system-path
- name: Add poetry to $GITHUB_PATH
run: >
echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'

- name: Install dependencies
run: poetry install --no-root

- name: Run slither
run: >
poetry run slither . --sarif results.sarif --no-fail-pedantic
- name: Check results.sarif presence
id: results
if: always()
shell: bash
run: >
test -f results.sarif &&
echo 'value=present' >> $GITHUB_OUTPUT ||
echo 'value=not' >> $GITHUB_OUTPUT
- name: Upload results.sarif file
uses: github/codeql-action/upload-sarif@v3
if: ${{ always() && steps.results.outputs.value == 'present' }}
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ pnpm test
- eslint
- prettier
- solhint
- slither

## Todos

- anvil
- slither
- readme

## Conventions
Expand Down
Loading

0 comments on commit 71367e7

Please sign in to comment.