Merge pull request #133 from EmmanuelAR/feat/withdraw_fund #142
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: | |
branches: | |
- dev | |
push: | |
branches: | |
- dev | |
- main | |
jobs: | |
determine-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
contracts_dir: ${{ steps.changes.outputs.contracts_dir }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Check for changes | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
contracts_dir: | |
- 'contracts/src/**' | |
check-lint: | |
runs-on: ubuntu-latest | |
needs: determine-changes | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Scarb | |
uses: software-mansion/setup-scarb@v1 | |
if: needs.determine-changes.outputs.contracts_dir == 'true' | |
with: | |
scarb-version: "2.6.5" | |
- name: Run Scarb formatting | |
if: needs.determine-changes.outputs.contracts_dir == 'true' | |
working-directory: contracts | |
run: scarb fmt | |
- name: No changes detected in contracts directory | |
if: needs.determine-changes.outputs.contracts_dir == 'false' | |
run: echo "No linting perfomed since no changes have been detected in the contracts directory." | |
check-contracts-changes: | |
runs-on: ubuntu-latest | |
needs: determine-changes | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install scarb | |
uses: software-mansion/setup-scarb@v1 | |
if: needs.determine-changes.outputs.contracts_dir == 'true' | |
with: | |
scarb-version: "2.6.5" | |
- name: Run Scarb check | |
if: needs.determine-changes.outputs.contracts_dir == 'true' | |
working-directory: contracts | |
run: scarb check | |
- name: No changes detected in contracts directory | |
if: needs.determine-changes.outputs.contracts_dir == 'false' | |
run: echo "No contracts checks done since no changes have been detected in the contracts directory." | |
run-tests: | |
runs-on: ubuntu-latest | |
needs: determine-changes | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install Scarb | |
uses: software-mansion/setup-scarb@v1 | |
if: needs.determine-changes.outputs.contracts_dir == 'true' | |
with: | |
scarb-version: "2.6.5" | |
- name: Install snfoundry | |
uses: foundry-rs/setup-snfoundry@v3 | |
if: needs.determine-changes.outputs.contracts_dir == 'true' | |
with: | |
starknet-foundry-version: "0.27.0" | |
- name: Run Cairo tests | |
if: needs.determine-changes.outputs.contracts_dir == 'true' | |
id: cairo_tests | |
run: bash scripts/run_tests.sh | |
- name: No changes detected in contracts directory | |
if: needs.determine-changes.outputs.contracts_dir == 'false' | |
run: echo "No tests were run since no changes have been detected in the contracts directory." |