-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bac08ee
commit 882f4c3
Showing
2 changed files
with
40 additions
and
26 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 |
---|---|---|
@@ -1,38 +1,47 @@ | ||
name: Lint and test | ||
# This workflow runs linting and tests on all pull requests and pushes to the main branch. | ||
# It includes Markdown linting, Cairo formatting checks, running tests with coverage, | ||
# and uploading the coverage report to Codecov. | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint_and_test: | ||
name: Lint and test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Extract scarb version | ||
run: | | ||
SCARB_VERSION=$(grep 'scarb-version = ' Scarb.toml | sed 's/scarb-version = "\(.*\)"/\1/') | ||
echo "SCARB_VERSION=$SCARB_VERSION" >> "$GITHUB_ENV" | ||
- uses: software-mansion/setup-scarb@v1 | ||
with: | ||
scarb-version: ${{ env.SCARB_VERSION }} | ||
- name: Extract foundry version | ||
run: | | ||
FOUNDRY_VERSION=$(grep 'snforge_std = ' Scarb.toml | sed 's/snforge_std = "\(.*\)"/\1/') | ||
echo "FOUNDRY_VERSION=$FOUNDRY_VERSION" >> "$GITHUB_ENV" | ||
- uses: foundry-rs/setup-snfoundry@v3 | ||
with: | ||
starknet-foundry-version: ${{ env.FOUNDRY_VERSION }} | ||
- name: Markdown lint | ||
uses: DavidAnson/markdownlint-cli2-action@db43aef879112c3119a410d69f66701e0d530809 # v16 | ||
with: | ||
globs: | | ||
*.md | ||
!PULL_REQUEST_TEMPLATE.md | ||
- name: Cairo lint | ||
run: scarb fmt --check --workspace | ||
- name: Cairo test | ||
run: snforge test --workspace | ||
- uses: actions/checkout@v4 | ||
- name: Extract scarb version | ||
run: | | ||
SCARB_VERSION=$(grep 'scarb-version = ' Scarb.toml | sed 's/scarb-version = "\(.*\)"/\1/') | ||
echo "SCARB_VERSION=$SCARB_VERSION" >> "$GITHUB_ENV" | ||
- uses: software-mansion/setup-scarb@v1 | ||
with: | ||
scarb-version: ${{ env.SCARB_VERSION }} | ||
- name: Extract foundry version | ||
run: | | ||
FOUNDRY_VERSION=$(grep 'snforge_std = ' Scarb.toml | sed 's/snforge_std = "\(.*\)"/\1/') | ||
echo "FOUNDRY_VERSION=$FOUNDRY_VERSION" >> "$GITHUB_ENV" | ||
- uses: foundry-rs/setup-snfoundry@v3 | ||
with: | ||
starknet-foundry-version: ${{ env.FOUNDRY_VERSION }} | ||
- name: Markdown lint | ||
uses: DavidAnson/markdownlint-cli2-action@db43aef879112c3119a410d69f66701e0d530809 # v16 | ||
with: | ||
globs: | | ||
*.md | ||
!PULL_REQUEST_TEMPLATE.md | ||
- name: Cairo lint | ||
run: scarb fmt --check --workspace | ||
- name: Run tests and generate coverage report | ||
run: snforge test --workspace --coverage | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
file: ./coverage.lcov | ||
token: ${{ secrets.CODECOV_TOKEN }} |
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