|
| 1 | +name: main |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + style: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Setup Node |
| 22 | + uses: actions/setup-node@v4 |
| 23 | + with: |
| 24 | + node-version: 20 |
| 25 | + cache: yarn |
| 26 | + |
| 27 | + - name: Install Foundry |
| 28 | + uses: foundry-rs/foundry-toolchain@v1 |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: yarn |
| 32 | + |
| 33 | + - name: Get changed files |
| 34 | + id: changed-files |
| 35 | + uses: tj-actions/changed-files@v44 |
| 36 | + with: |
| 37 | + files_yaml: | |
| 38 | + contracts: |
| 39 | + - packages/contracts/**/*.{js,json,ts,sol} |
| 40 | + docs: |
| 41 | + - apps/docs/**/* |
| 42 | + packages: |
| 43 | + - packages/**/*.{js,json,ts} |
| 44 | + - '!packages/{contracts}/**/*' |
| 45 | + to_format: |
| 46 | + - '**/*.{cjs,js,json,jsx,md,mdx,sol,ts,tsx,yaml,yml}' |
| 47 | + to_lint: |
| 48 | + - '**/*.{cjs,js,jsx,ts,tsx}' |
| 49 | +
|
| 50 | + - if: steps.changed-files.outputs.contracts_any_changed == 'true' |
| 51 | + name: Compile and lint contracts |
| 52 | + run: | |
| 53 | + yarn compile:contracts |
| 54 | + yarn workspace excubiae-contracts lint |
| 55 | +
|
| 56 | + - if: steps.changed-files.outputs.docs_any_changed == 'true' |
| 57 | + name: Build and format docs |
| 58 | + run: | |
| 59 | + yarn workspace excubiae-docs build |
| 60 | + yarn workspace excubiae-docs format |
| 61 | +
|
| 62 | + - if: steps.changed-files.outputs.packages_any_changed == 'true' |
| 63 | + name: Build packages |
| 64 | + run: yarn build:packages |
| 65 | + |
| 66 | + - if: steps.changed-files.outputs.to_format_any_changed == 'true' |
| 67 | + name: Format |
| 68 | + run: yarn run prettier --check --ignore-unknown --no-error-on-unmatched-pattern ${{ steps.changed-files.outputs.to_format_all_changed_files }} |
| 69 | + |
| 70 | + - if: steps.changed-files.outputs.to_lint_any_changed == 'true' |
| 71 | + name: Run Eslint |
| 72 | + run: yarn run eslint ${{ steps.changed-files.outputs.to_lint_all_changed_files }} --ext .cjs,.js,.jsx,.ts,.tsx |
| 73 | + |
| 74 | + test: |
| 75 | + runs-on: ubuntu-latest |
| 76 | + |
| 77 | + steps: |
| 78 | + - name: Checkout |
| 79 | + uses: actions/checkout@v4 |
| 80 | + |
| 81 | + - name: Setup Node |
| 82 | + uses: actions/setup-node@v4 |
| 83 | + with: |
| 84 | + node-version: 20 |
| 85 | + cache: yarn |
| 86 | + |
| 87 | + - name: Install Foundry |
| 88 | + uses: foundry-rs/foundry-toolchain@v1 |
| 89 | + |
| 90 | + - name: Install dependencies |
| 91 | + run: yarn |
| 92 | + |
| 93 | + - name: Get changed files |
| 94 | + id: changed-files |
| 95 | + uses: tj-actions/changed-files@v44 |
| 96 | + with: |
| 97 | + files_yaml: | |
| 98 | + contracts: |
| 99 | + - packages/contracts/**/*.{js,json,ts,sol} |
| 100 | +
|
| 101 | + - if: steps.changed-files.outputs.contracts_any_changed == 'true' |
| 102 | + name: Build and Test contracts |
| 103 | + run: | |
| 104 | + yarn compile:contracts |
| 105 | + yarn test:contracts |
0 commit comments