-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ava-labs/ci
Add CI workflows
- Loading branch information
Showing
5 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Soldity Linter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
solhint: | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 2 | ||
steps: | ||
- name: Checkout repository and submodules | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install solhint | ||
run: | | ||
npm install solhint -g | ||
solhint --version | ||
- name: Run Linter | ||
run: ./scripts/lint.sh --sol-lint | ||
|
||
format-solidity: | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 2 | ||
steps: | ||
- name: Checkout repository and submodules | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install Foundry | ||
run: ./scripts/install_foundry.sh | ||
|
||
- name: Check Solidity Formatting | ||
run: | | ||
export PATH=$PATH:$HOME/.foundry/bin | ||
./scripts/lint.sh --sol-format-check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Slither Analyze | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
slither-analyze: | ||
name: Slither Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
steps: | ||
- name: Checkout repository and submodules | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install Slither | ||
run: | | ||
pip install slither-analyzer | ||
- name: Install Foundry | ||
run: ./scripts/install_foundry.sh | ||
|
||
- name: Run Slither | ||
run: | | ||
export PATH=$PATH:$HOME/.foundry/bin | ||
cd contracts | ||
slither ./ --fail-none --sarif ./results.sarif | ||
- name: Upload SARIF file | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: contracts/results.sarif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Solidity Unit Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
solidity-unit-tests: | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Checkout repository and submodules | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install Foundry | ||
run: ./scripts/install_foundry.sh | ||
|
||
- name: Run unit tests | ||
run: | | ||
export PATH=$PATH:$HOME/.foundry/bin | ||
cd contracts/ | ||
forge test -vvv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"filter_paths": "lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (C) 2024, Ava Labs, Inc. All rights reserved. | ||
# See the file LICENSE for licensing terms. | ||
|
||
set -e | ||
|
||
# The foundry install script uses XDG_CONFIG_HOME as the root of the install. | ||
# This can vary for different environments, so it is set to $HOME for consistency. | ||
export XDG_CONFIG_HOME=$HOME | ||
|
||
# This installs from ava-labs fork of the foundry repo. | ||
FOUNDRY_VERSION=v0.1.0 | ||
curl -L https://raw.githubusercontent.com/ava-labs/foundry/${FOUNDRY_VERSION}/foundryup/install > /tmp/foundry-install-script | ||
# Set the foundry version in the install script | ||
# Avoid using sed -i due to macos m1 incompatibility | ||
sed "s/\/ava-labs\/foundry\/master\/foundryup/\/ava-labs\/foundry\/${FOUNDRY_VERSION}\/foundryup/g" /tmp/foundry-install-script | ||
cat /tmp/foundry-install-script | bash | ||
|
||
export PATH=$PATH:$HOME/.foundry/bin:$HOME/.foundry:$HOME/.cargo/bin | ||
foundryup --version ${FOUNDRY_VERSION} |