Skip to content

ci: add GitHub Actions workflow for contract build and testing #20

ci: add GitHub Actions workflow for contract build and testing

ci: add GitHub Actions workflow for contract build and testing #20

Workflow file for this run

name: Build and deploy contracts
on: [pull_request]
jobs:
changed-files:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.changed-files.outputs.all_modified_files }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect package changes
id: changed-files
uses: tj-actions/changed-files@v45
with:
matrix: true
since_last_remote_commit: true
include_all_old_new_renamed_files: true
- name: List all changed directories
run: echo '${{ steps.changed-files.outputs.all_modified_files }}'
build-and-test:
name: Build & Test Modified Packages
needs: [changed-files]
runs-on: ubuntu-latest
if: needs.changed-files.outputs.has_changes == 'true'
strategy:
matrix:
directory: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
max-parallel: 4
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies and run tests for ${{ matrix.directory }}
working-directory: ${{ matrix.directory }}
run: |
npm ci
npm run test