Run checks #103
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
name: Run checks | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
# At 16:00 on Wednesday | |
- cron: "0 16 * * 3" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci | |
- name: Check formatting | |
run: npm run fmt:check | |
test-action: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get scarb version | |
id: extractScarbVersion | |
run: | | |
snfoundry_version=$(curl -s https://api.github.com/repos/foundry-rs/starknet-foundry/releases/latest | grep tarball_url | awk -F '/' '{print $8}' | tr -d '",') | |
version=$(curl -s https://raw.githubusercontent.com/foundry-rs/starknet-foundry/$snfoundry_version/.tool-versions | awk '{print $2}') | |
echo "scarbVersion=$version" >> "$GITHUB_OUTPUT" | |
- name: Setup Scarb | |
uses: software-mansion/setup-scarb@v1 | |
with: | |
scarb-version: ${{ steps.extractScarbVersion.outputs.scarbVersion }} | |
- name: Test local action | |
uses: ./ | |
with: | |
starknet-foundry-version: latest | |
- name: Verify universal-sierra-compiler installation | |
run: universal-sierra-compiler --version | |
- name: Create new project | |
run: snforge init myproject | |
- name: Run tests in the project | |
run: snforge test | |
working-directory: myproject | |
test-action-with-tools-file: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Create .tool-versions file" | |
run: echo -en 'scarb 2.5.0 \nstarknet-foundry 0.16.0' > .tool-versions | |
- name: "Setup Scarb using `.tool-versions` file" | |
uses: software-mansion/setup-scarb@v1 | |
- name: "Setup foundry using `.tool-versions` file" | |
uses: ./ | |
- run: snforge --version | grep "snforge 0.16.0" |