Build & Test: aaronmgdr/metadata-timeouts #5295
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: Build & Test | |
| run-name: 'Build & Test: ${{ github.head_ref || github.ref_name }}' | |
| # Dockefile for the self-hosted runner: | |
| # https://github.com/celo-org/infrastructure/blob/master/terraform/root-modules/gcp/integration-tests-gke/files/github-arc/Dockerfile-monorepo | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - prerelease/* | |
| - hotfixes | |
| pull_request: | |
| types: [opened, reopened, synchronize, edited, ready_for_review] | |
| concurrency: | |
| group: dev-tooling-${{ github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash --login -eo pipefail {0} | |
| env: | |
| # Increment these to force cache rebuilding | |
| NODE_MODULE_CACHE_VERSION: 7 | |
| NODE_OPTIONS: '--max-old-space-size=4096' | |
| TERM: dumb | |
| # Supported Foundry version defined at celo-org (GitHub organisation) level, for consistency across workflows. | |
| SUPPORTED_FOUNDRY_VERSION: "v1.2.3" | |
| # EXAMPLE on debug ssh step | |
| # - name: Setup tmate session | |
| # uses: mxschmitt/action-tmate@v3 | |
| # timeout-minutes: 20 | |
| # if: contains(matrix.command, 'common/') && false | |
| # with: | |
| # limit-access-to-actor: true | |
| jobs: | |
| install-dependencies: | |
| name: Install dependencies | |
| outputs: | |
| # Propagate more outputs if you need https://github.com/step-security/changed-files#outputs | |
| # Adding a initial comma so ',<path>' matches also for the first file | |
| all_modified_files: ',${{ steps.changed-files.outputs.all_modified_files }}' | |
| artifacts_to_cache: ${{ steps.get_artifacts_to_cache.outputs.artifacts_to_cache }} | |
| # runs-on: ubuntu-latest | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: 'enable corepack for yarn' | |
| run: sudo corepack enable yarn | |
| - uses: actions/checkout@v4 | |
| # must call twice because of chicken and egg problem with yarn and node | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Restore node cache | |
| uses: actions/cache@v4 | |
| id: cache_node | |
| with: | |
| # We need to cache all the artifacts generated by yarn install+build | |
| # Update this list also in .github/actions/sync-workspace/action.yml with exactly the same list | |
| path: | | |
| ./.yarn/cache | |
| ./.yarn/install-state.gz | |
| node_modules | |
| packages/**/node_modules | |
| key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} | |
| restore-keys: | | |
| node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- | |
| - name: Install yarn dependencies | |
| run: git config --global url."https://".insteadOf ssh:// && yarn install | |
| if: steps.cache_node.outputs.cache-hit != 'true' | |
| - name: Build packages | |
| run: yarn build | |
| - name: Check licenses | |
| if: steps.cache_node.outputs.cache-hit != 'true' | |
| run: | | |
| yarn check-licenses | |
| # Get workdir local changes and fail if there are any change | |
| # - name: Verify Changed files | |
| # id: verify-changed-files | |
| # uses: step-security/verify-changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 | |
| # with: | |
| # path: yarn.lock | |
| # fail-if-changed: 'true' | |
| # fail-message: 'Files changed during build. Please build locally and commit the changes.' | |
| # files: | | |
| # **/* | |
| - run: | | |
| echo "${{ steps.verify-changed-files.outputs.changed_files }}" | |
| - name: Get the artifacts to cache | |
| id: get_artifacts_to_cache | |
| # there are too many files when listed individually. | |
| run: | | |
| artifacts_to_cache="$(git ls-files --others --ignored --exclude-standard | grep -v node_modules | grep -v .js.map | grep -v .d.ts.map | grep -v .yarn/cache)" | |
| echo "artifacts_to_cache<<EOF" >> $GITHUB_OUTPUT | |
| echo "$artifacts_to_cache" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| # We use cache to share the build artifacts between jobs (gh artifacts are too slow...) | |
| # For more context check https://github.com/actions/upload-artifact/issues/199 | |
| - name: Restore build artifacts cache | |
| uses: actions/cache@v4 | |
| id: cache_build_artifacts | |
| with: | |
| # We need to cache all the artifacts generated by yarn install+build | |
| # Update this list also in .github/actions/sync-workspace/action.yml with exactly the same list | |
| path: | | |
| ${{ steps.get_artifacts_to_cache.outputs.artifacts_to_cache }} | |
| key: code-${{ github.sha }} | |
| restore-keys: | | |
| code-${{ github.sha }} | |
| - name: Detect files changed in PR (or commit), and expose as output | |
| id: changed-files | |
| uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 | |
| with: | |
| # Using comma as separator to be able to easily match full paths (using ,<path>) | |
| separator: ',' | |
| # Checking if changed in the last 100 commits in PRs | |
| fetch_depth: '150' | |
| - run: echo ",${{ steps.changed-files.outputs.all_modified_files }}" | |
| lint-checks: | |
| name: Lint code | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| timeout-minutes: 30 | |
| needs: install-dependencies | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - run: yarn run fmt:diff | |
| - run: yarn run lint | |
| size_checks: | |
| name: Size checks | |
| if: github.event_name == 'pull_request' | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| needs: install-dependencies | |
| timeout-minutes: 3 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # We need to run this job for @celo/actions and @celo/core | |
| folder: ["actions", "core"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - uses: andresz1/size-limit-action@v1.8.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| package_manager: yarn | |
| skip_step: 'build' | |
| script: 'yarn check-size --json' | |
| directory: packages/${{ matrix.folder }} | |
| general_test: | |
| name: General jest test | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| permissions: # Must change the job token permissions to use Akeyless JWT auth | |
| id-token: write | |
| contents: read | |
| needs: install-dependencies | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: ${{ env.SUPPORTED_FOUNDRY_VERSION }} | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - name: Run Jest Tests | |
| run: | | |
| mkdir -p test-results/jest | |
| # Skipping packages that are tested in a specific job below | |
| yarn workspaces foreach \ | |
| --all \ | |
| --exclude celo \ | |
| --exclude "@celo/{celocli,contractkit,actions,core,viem-account-ledger,wallet-*}" \ | |
| -p \ | |
| run test --coverage | |
| - name: Upload Jest Test Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Jest Test Results | |
| path: test-results/jest | |
| - uses: ./.github/actions/upload-codecov | |
| name: Upload Code Coverage | |
| with: | |
| report-name: "general_test" | |
| general_vi_test: | |
| name: General vitest | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| permissions: # Must change the job token permissions to use Akeyless JWT auth | |
| id-token: write | |
| contents: read | |
| needs: install-dependencies | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: ${{ env.SUPPORTED_FOUNDRY_VERSION }} | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - name: "View files" | |
| run: | | |
| ls -la $RUNNER_WORKSPACE | |
| ls -la $RUNNER_WORKSPACE/developer-tooling/packages | |
| ls -la $RUNNER_WORKSPACE/developer-tooling/node_modules/@celo | |
| ls -la $RUNNER_WORKSPACE/developer-tooling/node_modules/@celo/devchain-anvil | |
| - name: Run Vi Tests | |
| run: | | |
| mkdir -p test-results/vitest | |
| # Running vitest tests in parallel | |
| yarn workspaces foreach \ | |
| --all \ | |
| --exclude celo \ | |
| --include "@celo/{actions,core,viem-account-ledger}" \ | |
| -vp \ | |
| run test --coverage | |
| - name: Upload ViTest Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ViTest Results | |
| path: test-results/vitest | |
| - uses: ./.github/actions/upload-codecov | |
| name: Upload Code Coverage | |
| with: | |
| report-name: "general_vitest" | |
| wallet-test: | |
| name: Wallet test | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| timeout-minutes: 30 | |
| permissions: # Must change the job token permissions to use Akeyless JWT auth | |
| id-token: write | |
| contents: read | |
| needs: install-dependencies | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - run: sudo corepack enable yarn | |
| - name: Run Wallet tests | |
| run: | | |
| yarn workspaces foreach -ip --all --include '@celo/wallet-*' run test --coverage | |
| - uses: ./.github/actions/upload-codecov | |
| name: Upload Code Coverage | |
| with: | |
| report-name: "wallet" | |
| contractkit-tests-anvil: | |
| name: ContractKit Tests (Anvil) | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| timeout-minutes: 30 | |
| permissions: # Must change the job token permissions to use Akeyless JWT auth | |
| id-token: write | |
| contents: read | |
| needs: [install-dependencies] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - run: sudo corepack enable yarn | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: ${{ env.SUPPORTED_FOUNDRY_VERSION }} | |
| - name: "View files" | |
| run: | | |
| ls -la $RUNNER_WORKSPACE | |
| ls -la $RUNNER_WORKSPACE/developer-tooling/packages | |
| ls -la $RUNNER_WORKSPACE/developer-tooling/node_modules/@celo | |
| ls -la $RUNNER_WORKSPACE/developer-tooling/node_modules/@celo/devchain-anvil | |
| - name: Run tests | |
| run: | | |
| yarn workspace @celo/contractkit test-ci --coverage | |
| - uses: ./.github/actions/upload-codecov | |
| name: Upload Code Coverage | |
| with: | |
| report-name: "contractkit-anvil" | |
| cli-package-verification: | |
| name: CeloCli Package Verification | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| timeout-minutes: 30 | |
| permissions: # Must change the job token permissions to use Akeyless JWT auth | |
| id-token: write | |
| contents: read | |
| needs: [install-dependencies] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - name: Install globally as a package | |
| run: | | |
| npm install -g $RUNNER_WORKSPACE/developer-tooling/packages/cli | |
| - name: Print out the current version | |
| run: | | |
| celocli --version | |
| - name: Test that it prints out contracts | |
| run: | | |
| celocli network:info --node celo | |
| celocli account:new | |
| cli-tests-anvil: | |
| name: CeloCli Tests (Anvil) | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| timeout-minutes: 30 | |
| permissions: # Must change the job token permissions to use Akeyless JWT auth | |
| id-token: write | |
| contents: read | |
| needs: [install-dependencies] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: ${{ env.SUPPORTED_FOUNDRY_VERSION }} | |
| - name: Run tests | |
| run: | | |
| yarn workspace @celo/celocli test-ci --coverage | |
| - name: Verify that a new account can be created | |
| run: | | |
| yarn workspace @celo/celocli run celocli account:new | |
| - name: Test that releasecelo command topic is working | |
| run: | | |
| yarn workspace @celo/celocli run celocli releasecelo --help | |
| - uses: ./.github/actions/upload-codecov | |
| name: Upload Code Coverage | |
| with: | |
| report-name: "celocli-anvil" | |
| docs-tests: | |
| name: Docs tests | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| timeout-minutes: 30 | |
| needs: [install-dependencies] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - run: sudo corepack enable yarn | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - name: Fail if docs cant be generated | |
| run: | | |
| yarn docs | |
| base-test: | |
| name: SDK Base package Tests | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| timeout-minutes: 30 | |
| needs: [install-dependencies] | |
| if: | | |
| github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') || | |
| contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') || | |
| contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') || | |
| contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || | |
| contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || | |
| false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - run: sudo corepack enable yarn | |
| - name: Install and test the npm package | |
| run: | | |
| set -euo pipefail | |
| cd packages/sdk/base | |
| yarn pack | |
| cd $RUNNER_TEMP | |
| npm install $RUNNER_WORKSPACE/developer-tooling/packages/sdk/base/*.tgz | |
| utils-test: | |
| name: SDK Utils package Tests | |
| runs-on: ['self-hosted', 'org', 'ubuntu-22-04'] | |
| timeout-minutes: 30 | |
| needs: [install-dependencies] | |
| if: | | |
| github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') || | |
| contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') || | |
| contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') || | |
| contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || | |
| contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || | |
| false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sync workspace | |
| uses: ./.github/actions/sync-workspace | |
| with: | |
| artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} | |
| - run: sudo corepack enable yarn | |
| - name: Install and test the npm package | |
| run: | | |
| set -euo pipefail | |
| cd packages/sdk/base | |
| yarn pack | |
| cd ../utils | |
| yarn pack | |
| cd $RUNNER_TEMP | |
| npm install $RUNNER_WORKSPACE/developer-tooling/packages/sdk/base/*.tgz | |
| npm install $RUNNER_WORKSPACE/developer-tooling/packages/sdk/utils/*.tgz | |
| validate-renovate-config: | |
| name: Validate Renovate Config | |
| needs: [install-dependencies] | |
| runs-on: ubuntu-latest | |
| if: contains(needs.install-dependencies.outputs.all_modified_files, 'dt-renovate-base.json') || contains(needs.install-dependencies.outputs.all_modified_files, 'renovate.json') | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: "Setup Node" | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Validate Team Config | |
| uses: suzuki-shunsuke/github-action-renovate-config-validator@v1.0.1 | |
| with: | |
| config_file_path: dt-renovate-base.json | |
| strict: "false" | |
| - name: Validate Repo Config | |
| uses: suzuki-shunsuke/github-action-renovate-config-validator@v1.0.1 | |
| with: | |
| config_file_path: renovate.json | |
| strict: "false" | |