From 7c9c219b9bb2f92a3cd5ef8c4337b32a4cee2905 Mon Sep 17 00:00:00 2001 From: zaidarain1 Date: Wed, 25 Sep 2024 16:59:50 +1000 Subject: [PATCH] chore: cleanup PR workflow (#2225) --- .github/actions/setup-tests/action.yaml | 9 -- .github/workflows/pr.yaml | 128 +++--------------------- 2 files changed, 15 insertions(+), 122 deletions(-) delete mode 100644 .github/actions/setup-tests/action.yaml diff --git a/.github/actions/setup-tests/action.yaml b/.github/actions/setup-tests/action.yaml deleted file mode 100644 index 78876d1c75..0000000000 --- a/.github/actions/setup-tests/action.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: "Tests setup" -description: "Do necessary setup for tests" - -runs: - using: "composite" - steps: - - name: Prepare tests - shell: bash - run: yarn prepare:tests diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 2d60e61a1b..a6c2c78167 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -21,42 +21,15 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 + - name: setup uses: ./.github/actions/setup - name: Syncpack run: yarn syncpack:check - detect: - name: Detect Node engine version change - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Get Node engine version from package.json - id: get_package_json_node_engine_version - run: | - node_engine_major_version=$(jq -r '.engines.node' ./sdk/package.json | sed 's/^>=//' | cut -d. -f1) - echo "::set-output name=node_engine_major_version::$node_engine_major_version" - - - name: Get Node.js version from .nvmrc - id: get_nvmrc_node_version - run: echo "::set-output name=nvmrc_node_version::$(head -n 1 .nvmrc | cut -d. -f1)" - - - name: Check Node.js engine version change - run: | - package_version_major=$(echo "${{ steps.get_package_json_node_engine_version.outputs.node_engine_major_version }}") - nvmrc_version_major=$(echo "${{ steps.get_nvmrc_node_version.outputs.nvmrc_node_version }}") - if [ "$package_version_major" != "$nvmrc_version_major" ]; then - echo "Node.js engine version has changed" - exit 1 - else - echo "Node.js engine version has not changed" - fi - - build-sdk: - name: Build SDK + build-lint-test-typecheck-sdk: + name: Build, Lint, Test & Typecheck SDK runs-on: ubuntu-latest-8-cores steps: - name: Checkout code @@ -64,65 +37,12 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 - - name: setup - uses: ./.github/actions/setup - - name: Build - run: yarn nx affected --target=build - - typecheck-sdk: - name: Typecheck SDK - runs-on: ubuntu-latest-4-cores - needs: build-sdk - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 0 - - name: setup - uses: ./.github/actions/setup - - - name: Typecheck - run: yarn typecheck - test-sdk: - name: Test SDK - runs-on: ubuntu-latest-8-cores - needs: build-sdk - env: - NODE_OPTIONS: --max-old-space-size=14366 - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 0 - name: setup uses: ./.github/actions/setup - - name: Test - run: yarn test --configuration=ci - - - name: Upload SDK test coverage artifacts - uses: actions/upload-artifact@v4 - with: - name: coverages - path: ./packages/**/coverage/* - - lint-sdk: - name: Lint SDK - runs-on: ubuntu-latest-4-cores - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 0 - - name: setup - uses: ./.github/actions/setup - - - name: Lint - run: yarn lint + - name: Build, Lint, Test & Typecheck + run: yarn nx affected -t build,lint,test,typecheck build-lint-test-examples: name: Build, Lint & Test Examples @@ -152,11 +72,11 @@ jobs: run: yarn test:examples - func-test-imx: - name: imx func tests - runs-on: ubuntu-latest-4-cores - needs: build-sdk + func-tests: + name: Functional tests + runs-on: ubuntu-latest-8-cores env: + # imx envs NETWORK: sepolia TEST_ALCHEMY_API_KEY: ${{ secrets.TEST_ALCHEMY_API_KEY }} PUBLIC_API_URL: "https://api.sandbox.x.immutable.com/v1" @@ -170,26 +90,8 @@ jobs: TEST_WALLET_BANKER_PRIVATE_KEY: ${{ secrets.TEST_WALLET_BANKER_PRIVATE_KEY }} TEST_WALLET_BANKER_STARK_PRIVATE_KEY: ${{ secrets.TEST_WALLET_BANKER_STARK_PRIVATE_KEY }} TEST_STARKEX_BATCH_SIZE: 500 - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 0 - - name: setup - uses: ./.github/actions/setup - - - name: Setup tests - uses: ./.github/actions/setup-tests - - - name: test - run: yarn workspace @tests/func-tests-imx func-test:ci - func-test-zkevm: - name: zkevm func tests - runs-on: ubuntu-latest-8-cores - needs: build-sdk - env: + # zkevm envs ZKEVM_ORDERBOOK_BANKER: ${{ secrets.ZKEVM_ORDERBOOK_BANKER }} ZKEVM_ORDERBOOK_ERC721: "0xBE8B131f39825282Ace9eFf99C0Bb14972417b49" ZKEVM_ORDERBOOK_ERC1155: "0x2efB9B7810B1d1520c0822aa20F1889ABd2c2146" @@ -204,12 +106,12 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 - + - name: setup uses: ./.github/actions/setup - - name: Setup tests - uses: ./.github/actions/setup-tests + - name: Prepare tests + run: yarn prepare:tests - - name: test - run: yarn workspace @tests/func-tests-zkevm func-test:ci + - name: Run functional tests + run: FORCE_COLOR=1 yarn workspaces foreach -Apt --include='@tests/**' run func-test:ci