[BBND-993] Refactor: Restructure project into monorepo with workspaces #1616
Workflow file for this run
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| detect-changes: | |
| name: Detect Changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| ats_changed: ${{ steps.filter.outputs.ats_changed }} | |
| mass_payout_changed: ${{ steps.filter.outputs.mass_payout_changed }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Detect changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v44 | |
| - name: Filter changes by domain | |
| id: filter | |
| run: | | |
| ATS_CHANGED=false | |
| MASS_PAYOUT_CHANGED=false | |
| for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
| if [[ "$file" == apps/ats/* || "$file" == packages/ats/* ]]; then | |
| ATS_CHANGED=true | |
| fi | |
| if [[ "$file" == apps/mass-payout/* || "$file" == packages/mass-payout/* ]]; then | |
| MASS_PAYOUT_CHANGED=true | |
| fi | |
| done | |
| echo "ats_changed=$ATS_CHANGED" >> $GITHUB_OUTPUT | |
| echo "mass_payout_changed=$MASS_PAYOUT_CHANGED" >> $GITHUB_OUTPUT | |
| test-ats: | |
| name: Test ATS | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.ats_changed == 'true' | |
| runs-on: token-studio-linux-large | |
| env: | |
| NODE_OPTIONS: '--max-old-space-size=32768' | |
| CONTRACT_SIZER_RUN_ON_COMPILE: 'false' | |
| REPORT_GAS: 'false' | |
| CLIENT_PRIVATE_KEY_ECDSA_1: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_1 }} | |
| CLIENT_PUBLIC_KEY_ECDSA_1: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_1 }} | |
| CLIENT_ACCOUNT_ID_ECDSA_1: '0.0.1328' | |
| CLIENT_EVM_ADDRESS_ECDSA_1_CORRECT: '0x97C50bb12E1C6284cF2855cdba95c5D60AEE44CF' | |
| CLIENT_EVM_ADDRESS_ECDSA_1: '0x0000000000000000000000000000000000000530' | |
| CLIENT_PRIVATE_KEY_ECDSA_2: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_2 }} | |
| CLIENT_PUBLIC_KEY_ECDSA_2: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} | |
| CLIENT_ACCOUNT_ID_ECDSA_2: '0.0.2168740' | |
| CLIENT_EVM_ADDRESS_ECDSA_2: '0x00000000000000000000000000000000002117A4' | |
| FACTORY_ADDRESS: '0.0.5480051' | |
| RESOLVER_ADDRESS: '0.0.5479997' | |
| FIREBLOCKS_HEDERA_ACCOUNT_ID: '0.0.2168740' | |
| FIREBLOCKS_HEDERA_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} | |
| DFNS_HEDERA_ACCOUNT_ID: '0.0.2168740' | |
| DFNS_WALLET_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} | |
| AWS_KMS_HEDERA_ACCOUNT_ID: '0.0.4394946' | |
| AWS_KMS_HEDERA_PUBLIC_KEY: '302d300706052b8104000a03220003ee815bb9b5e53f5dbe7264a77e586127dfcb75da8c1246f5aa6ededdb13e6c21' | |
| REACT_APP_MIRROR_NODE: 'https://testnet.mirrornode.hedera.com/api/v1/' | |
| REACT_APP_RPC_NODE: 'https://testnet.hashio.io/api' | |
| REACT_APP_RPC_RESOLVER: '0.0.5479997' | |
| REACT_APP_RPC_FACTORY: '0.0.5480051' | |
| REACT_APP_SHOW_DISCLAIMER: 'true' | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Setup NodeJS Environment | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 20.x | |
| - name: Install monorepo package dependencies (ats/contracts and ats/sdk) | |
| run: npm ci # Change for npm run:install:ats:all:ci | |
| - name: Build ats/contracts | |
| run: npm run build:ats:contracts | |
| - name: Build ats/sdk | |
| run: npm run build:ats:sdk | |
| - name: Install ats/web dependencies | |
| run: npm run install:ats:web:lock | |
| - name: Build ats/web | |
| run: npm run build:ats:web | |
| - name: Run ats/contracts tests | |
| working-directory: packages/ats/contracts | |
| run: npm run test | |
| - name: Run ats/sdk tests | |
| working-directory: packages/ats/sdk | |
| run: npm run test | |
| - name: Run ats/web tests | |
| working-directory: apps/ats/web | |
| run: npm run test | |
| - name: Upload coverage report | |
| if: ${{ !cancelled() && always() }} | |
| uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 | |
| test-mass-payout: | |
| name: Test Mass Payout | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.mass_payout_changed == 'true' | |
| runs-on: token-studio-linux-large | |
| env: | |
| NODE_OPTIONS: '--max-old-space-size=32768' | |
| CONTRACT_SIZER_RUN_ON_COMPILE: 'false' | |
| REPORT_GAS: 'false' | |
| CLIENT_PRIVATE_KEY_ECDSA_1: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_1 }} | |
| CLIENT_PUBLIC_KEY_ECDSA_1: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_1 }} | |
| CLIENT_ACCOUNT_ID_ECDSA_1: '0.0.1328' | |
| CLIENT_EVM_ADDRESS_ECDSA_1_CORRECT: '0x97C50bb12E1C6284cF2855cdba95c5D60AEE44CF' | |
| CLIENT_EVM_ADDRESS_ECDSA_1: '0x0000000000000000000000000000000000000530' | |
| CLIENT_PRIVATE_KEY_ECDSA_2: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_2 }} | |
| CLIENT_PUBLIC_KEY_ECDSA_2: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} | |
| CLIENT_ACCOUNT_ID_ECDSA_2: '0.0.2168740' | |
| CLIENT_EVM_ADDRESS_ECDSA_2: '0x00000000000000000000000000000000002117A4' | |
| FACTORY_ADDRESS: '0.0.5480051' | |
| RESOLVER_ADDRESS: '0.0.5479997' | |
| FIREBLOCKS_HEDERA_ACCOUNT_ID: '0.0.2168740' | |
| FIREBLOCKS_HEDERA_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} | |
| DFNS_HEDERA_ACCOUNT_ID: '0.0.2168740' | |
| DFNS_WALLET_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} | |
| AWS_KMS_HEDERA_ACCOUNT_ID: '0.0.4394946' | |
| AWS_KMS_HEDERA_PUBLIC_KEY: '302d300706052b8104000a03220003ee815bb9b5e53f5dbe7264a77e586127dfcb75da8c1246f5aa6ededdb13e6c21' | |
| REACT_APP_MIRROR_NODE: 'https://testnet.mirrornode.hedera.com/api/v1/' | |
| REACT_APP_RPC_NODE: 'https://testnet.hashio.io/api' | |
| REACT_APP_RPC_RESOLVER: '0.0.5479997' | |
| REACT_APP_RPC_FACTORY: '0.0.5480051' | |
| REACT_APP_SHOW_DISCLAIMER: 'true' | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Setup NodeJS Environment | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 20.x | |
| - name: Install monorepo package dependencies (ats/contracts and ats/sdk) | |
| run: npm ci # Change for npm run:install:ats:all:ci | |
| - name: Build ats/contracts | |
| run: npm run build:ats:contracts | |
| - name: Build ats/sdk | |
| run: npm run build:ats:sdk | |
| - name: Install ats/web dependencies | |
| run: npm run install:ats:web:lock | |
| - name: Build ats/web | |
| run: npm run build:ats:web | |
| - name: Run ats/contracts tests | |
| working-directory: packages/ats/contracts | |
| run: npm run test | |
| testing: | |
| name: testing | |
| runs-on: ubuntu-latest | |
| needs: [ detect-changes, test-ats, test-mass-payout ] | |
| if: always() | |
| steps: | |
| - name: Check result propagation | |
| run: | | |
| echo "🎯 ATS changed: ${{ needs.detect-changes.outputs.ats_changed }}" | |
| echo "🎯 Mass Payout changed: ${{ needs.detect-changes.outputs.mass_payout_changed }}" | |
| echo "Propagating job results..." | |
| ATS_RESULT="${{ needs.test-ats.result }}" | |
| MP_RESULT="${{ needs.test-mass-payout.result }}" | |
| if [[ "$ATS_RESULT" == "failure" || "$MP_RESULT" == "failure" ]]; then | |
| echo "❌ One of the test jobs failed." | |
| exit 1 | |
| fi | |
| echo "✅ All required tests passed or were skipped." |