Feature/cd ci config #12
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: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 0 * * *" # Run daily at midnight | |
jobs: | |
test-contracts: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get latest Scarb version | |
id: scarb-version | |
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 "version=$version" >> "$GITHUB_OUTPUT" | |
- name: Setup Scarb | |
uses: software-mansion/setup-scarb@v1 | |
with: | |
scarb-version: ${{ steps.scarb-version.outputs.version }} | |
- name: Setup Starknet Foundry | |
uses: foundry-rs/setup-snfoundry@v2 | |
with: | |
version: latest | |
- name: Run tests | |
run: | | |
cd apps/snfoundry | |
snforge test | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get latest Scarb version | |
id: scarb-version | |
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 "version=$version" >> "$GITHUB_OUTPUT" | |
- name: Setup Scarb | |
uses: software-mansion/setup-scarb@v1 | |
with: | |
scarb-version: ${{ steps.scarb-version.outputs.version }} | |
- name: Check formatting | |
run: | | |
cd apps/snfoundry/contracts | |
scarb fmt --check |