diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 10810f560..09229627e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -37,25 +37,14 @@ See also: **CI Switch** - [ ] Web3 Compatible Tests -- [ ] OCT 1-5 And 12-15 -- [ ] OCT 6-10 -- [ ] OCT 11 -- [ ] OCT 16-19 +- [ ] OpenZeppelin tests - [ ] v3 Core Tests ### **CI Description** -| CI Name | Description | -| ----------------------------------------- | ------------------------------------------------------------------------- | -| *Web3 Compatible Test* | Test the Web3 compatibility of Axon | -| *v3 Core Test* | Run the compatibility tests provided by Uniswap V3 | -| *OCT 1-5 \| 6-10 \| 11 \| 12-15 \| 16-19* | Run the compatibility tests provided by OpenZeppelin | - - +| CI Name | Description | +| ---------------------- | ------------------------------------------------------------------------------------------------------- | +| *Web3 Compatible Test* | Test the Web3 compatibility of Axon | +| *v3 Core Test* | Run the compatibility tests provided by Uniswap V3 | +| *OpenZeppelin tests* | Run the compatibility tests provided by OpenZeppelin, including OCT 1-5 \| 6-10 \| 11 \| 12-15 \| 16-19 | diff --git a/.github/workflows/entry_workflow.yml b/.github/workflows/entry_workflow.yml index ff91c2f61..a9c39ba06 100644 --- a/.github/workflows/entry_workflow.yml +++ b/.github/workflows/entry_workflow.yml @@ -48,124 +48,56 @@ jobs: .replace(/\\t/g, "\\\\t"); // get pr comments body,not issue comments body - const pr = - await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, + const pr = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, }); - let check_list=` + let check_list = ` \### CI test list: `; - // check Coverage Test exist or not - const coverage_match = pr.data.body.includes("[x] Coverage Test"); - if (coverage_match) { - const resp = await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: "coverage.yml", - ref: `main`, - inputs: { - dispatch: jsonDispatch, - } + const dispatchWorkflow = async (workflowId) => { + const resp = await github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: workflowId, + ref: `main`, + inputs: { + dispatch: jsonDispatch, + } }); + core.info(`${JSON.stringify(resp, null, 2)}`); - check_list=`${check_list}\n - Coverage Test`; - } + check_list = `${check_list}\n - ${workflowId}`; + }; - // check OCT 1-5 And 12-15 exist or not - const OCT_match = pr.data.body.includes("[x] OCT 1-5 And 12-15"); + // check if OpenZeppelin tests is required + const OCT_match = pr.data.body.includes("[x] OpenZeppelin tests"); if (OCT_match) { - const resp = await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: "openzeppelin_test_1_5_and_12_15.yml", - ref: `main`, - inputs: { - dispatch: jsonDispatch, - } - }); - core.info(`${JSON.stringify(resp, null, 2)}`); - check_list=`${check_list}\n - OCT 1-5 And 12-15`; - } - // check OCT 6-10 exist or not - const OCT_6_match = pr.data.body.includes("[x] OCT 6-10"); - if (OCT_6_match) { - const resp = await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: "openzeppelin_test_6_10.yml", - ref: `main`, - inputs: { - dispatch: jsonDispatch, - } - }); - core.info(`${JSON.stringify(resp, null, 2)}`); - check_list=`${check_list}\n - OCT 6-10`; - } - // check OCT 11 exist or not - const OCT_11_match = pr.data.body.includes("[x] OCT 11"); - if (OCT_11_match) { - const resp = await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: "openzeppelin_test_11.yml", - ref: `main`, - inputs: { - dispatch: jsonDispatch, - } - }); - core.info(`${JSON.stringify(resp, null, 2)}`); - check_list=`${check_list}\n - OCT 11`; - } - // check OCT 16-19 exist or not - const OCT_16_match = pr.data.body.includes("[x] OCT 16-19"); - if (OCT_16_match) { - const resp = await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: "openzeppelin_test_16_19.yml", - ref: `main`, - inputs: { - dispatch: jsonDispatch, - } - }); - core.info(`${JSON.stringify(resp, null, 2)}`); - check_list=`${check_list}\n - OCT 16-19`; - } + const workflowIds = [ + "openzeppelin_test_1_5_and_12_15.yml", + "openzeppelin_test_6_10.yml", + "openzeppelin_test_11.yml", + "openzeppelin_test_16_19.yml", + ]; + await Promise.all(workflowIds.map(dispatchWorkflow)); + } + // check v3 Core Tests exist or not const v3_match = pr.data.body.includes("[x] v3 Core Tests"); if (v3_match) { - const resp = await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: "v3_core_test.yml", - ref: `main`, - inputs: { - dispatch: jsonDispatch, - } - }); - core.info(`${JSON.stringify(resp, null, 2)}`); - check_list=`${check_list}\n - v3 Core Tests`; - } + await dispatchWorkflow("v3_core_test.yml"); + } + // check Unit Tests exist or not const web3_match = pr.data.body.includes("[x] Web3 Compatible Tests"); if (web3_match) { - const resp = await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: "web3_compatible.yml", - ref: `main`, - inputs: { - dispatch: jsonDispatch, - } - }); - core.info(`${JSON.stringify(resp, null, 2)}`); - check_list=`${check_list}\n - Web3 Compatible Tests`; - }; - return check_list + await dispatchWorkflow("web3_compatible.yml"); + }; + + return check_list - name: Escape check list id: escape_multiple_lines_test_inputs diff --git a/.github/workflows/openzeppelin_test_11.yml b/.github/workflows/openzeppelin_test_11.yml index 08a76f736..65089bd3e 100644 --- a/.github/workflows/openzeppelin_test_11.yml +++ b/.github/workflows/openzeppelin_test_11.yml @@ -48,6 +48,23 @@ jobs: return `${{ github.sha }}`; result-encoding: string + # The `statuses: write` permission is required in this step. + - name: Update the commit Status + if: always() + uses: actions/github-script@v7 + with: + script: | + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: 'pending', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } + - name: Checkout Axon commit ${{ steps.axon_git_ref.outputs.result}} uses: actions/checkout@v4 with: @@ -164,15 +181,17 @@ jobs: # The `statuses: write` permission is required in this step. - name: Update the commit Status - if: always() && env.IS_DISPATCH == 'true' && env.IS_REGRESSION == 'false' + if: always() uses: actions/github-script@v7 with: script: | - github.rest.repos.createCommitStatus({ - state: '${{ job.status }}', - owner: context.repo.owner, - repo: context.repo.repo, - context: '${{ github.workflow }}', - sha: '${{ steps.axon_git_ref.outputs.result}}', - target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' - }) + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: '${{ job.status }}', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } diff --git a/.github/workflows/openzeppelin_test_16_19.yml b/.github/workflows/openzeppelin_test_16_19.yml index 9059fbb4f..6b8b8b8b7 100644 --- a/.github/workflows/openzeppelin_test_16_19.yml +++ b/.github/workflows/openzeppelin_test_16_19.yml @@ -48,6 +48,23 @@ jobs: return `${{ github.sha }}`; result-encoding: string + # The `statuses: write` permission is required in this step. + - name: Update the commit Status + if: always() + uses: actions/github-script@v7 + with: + script: | + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: 'pending', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } + - name: Checkout Axon commit ${{ steps.axon_git_ref.outputs.result}} uses: actions/checkout@v4 with: @@ -175,15 +192,17 @@ jobs: # The `statuses: write` permission is required in this step. - name: Update the commit Status - if: always() && env.IS_DISPATCH == 'true' && env.IS_REGRESSION == 'false' + if: always() uses: actions/github-script@v7 with: script: | - github.rest.repos.createCommitStatus({ - state: '${{ job.status }}', - owner: context.repo.owner, - repo: context.repo.repo, - context: '${{ github.workflow }}', - sha: '${{ steps.axon_git_ref.outputs.result}}', - target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' - }) + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: '${{ job.status }}', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } diff --git a/.github/workflows/openzeppelin_test_1_5_and_12_15.yml b/.github/workflows/openzeppelin_test_1_5_and_12_15.yml index d4cf8787a..b208b8bdc 100644 --- a/.github/workflows/openzeppelin_test_1_5_and_12_15.yml +++ b/.github/workflows/openzeppelin_test_1_5_and_12_15.yml @@ -48,6 +48,23 @@ jobs: return `${{ github.sha }}`; result-encoding: string + # The `statuses: write` permission is required in this step. + - name: Update the commit Status + if: always() + uses: actions/github-script@v7 + with: + script: | + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: 'pending', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } + - name: Checkout Axon commit ${{ steps.axon_git_ref.outputs.result}} uses: actions/checkout@v4 with: @@ -205,15 +222,17 @@ jobs: # The `statuses: write` permission is required in this step. - name: Update the commit Status - if: always() && env.IS_DISPATCH == 'true' && env.IS_REGRESSION == 'false' + if: always() uses: actions/github-script@v7 with: script: | - github.rest.repos.createCommitStatus({ - state: '${{ job.status }}', - owner: context.repo.owner, - repo: context.repo.repo, - context: '${{ github.workflow }}', - sha: '${{ steps.axon_git_ref.outputs.result}}', - target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' - }) + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: '${{ job.status }}', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } diff --git a/.github/workflows/openzeppelin_test_6_10.yml b/.github/workflows/openzeppelin_test_6_10.yml index 03e676bde..fef231d3d 100644 --- a/.github/workflows/openzeppelin_test_6_10.yml +++ b/.github/workflows/openzeppelin_test_6_10.yml @@ -48,6 +48,23 @@ jobs: return `${{ github.sha }}`; result-encoding: string + # The `statuses: write` permission is required in this step. + - name: Update the commit Status + if: always() + uses: actions/github-script@v7 + with: + script: | + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: 'pending', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } + - name: Checkout Axon commit ${{ steps.axon_git_ref.outputs.result}} uses: actions/checkout@v4 with: @@ -181,15 +198,17 @@ jobs: # The `statuses: write` permission is required in this step. - name: Update the commit Status - if: always() && env.IS_DISPATCH == 'true' && env.IS_REGRESSION == 'false' + if: always() uses: actions/github-script@v7 with: script: | - github.rest.repos.createCommitStatus({ - state: '${{ job.status }}', - owner: context.repo.owner, - repo: context.repo.repo, - context: '${{ github.workflow }}', - sha: '${{ steps.axon_git_ref.outputs.result}}', - target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' - }) + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: '${{ job.status }}', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } diff --git a/.github/workflows/v3_core_test.yml b/.github/workflows/v3_core_test.yml index dd19aa6b9..5035e812d 100644 --- a/.github/workflows/v3_core_test.yml +++ b/.github/workflows/v3_core_test.yml @@ -1,10 +1,6 @@ name: v3 Core Tests on: - # TODO: Remove `push` and `pull_request` events after this workflow is stable, - # if the use too much GitHub Action run time. - pull_request: - merge_group: workflow_dispatch: inputs: @@ -52,6 +48,23 @@ jobs: return `${{ github.sha }}`; result-encoding: string + # The `statuses: write` permission is required in this step. + - name: Update the commit Status + if: always() + uses: actions/github-script@v7 + with: + script: | + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: 'pending', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } + - name: Checkout Axon commit ${{ steps.axon_git_ref.outputs.result}} uses: actions/checkout@v4 with: @@ -172,15 +185,17 @@ jobs: # The `statuses: write` permission is required in this step. - name: Update the commit Status - if: always() && env.IS_DISPATCH == 'true' && env.IS_REGRESSION == 'false' + if: always() uses: actions/github-script@v7 with: script: | - github.rest.repos.createCommitStatus({ - state: '${{ job.status }}', - owner: context.repo.owner, - repo: context.repo.repo, - context: '${{ github.workflow }}', - sha: '${{ steps.axon_git_ref.outputs.result}}', - target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' - }) + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: '${{ job.status }}', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } diff --git a/.github/workflows/web3_compatible.yml b/.github/workflows/web3_compatible.yml index e26be3f96..9d39d72f7 100644 --- a/.github/workflows/web3_compatible.yml +++ b/.github/workflows/web3_compatible.yml @@ -47,6 +47,23 @@ jobs: return `${{ github.sha }}`; result-encoding: string + # The `statuses: write` permission is required in this step. + - name: Update the commit Status + if: always() + uses: actions/github-script@v7 + with: + script: | + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: 'pending', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } + - name: Checkout Axon ${{ steps.axon_git_ref.outputs.result}} uses: actions/checkout@v4 with: @@ -152,15 +169,17 @@ jobs: # The `statuses: write` permission is required in this step. - name: Update the commit Status - if: always() && env.IS_DISPATCH == 'true' && env.IS_REGRESSION == 'false' + if: always() uses: actions/github-script@v7 with: script: | - github.rest.repos.createCommitStatus({ - state: '${{ job.status }}', - owner: context.repo.owner, - repo: context.repo.repo, - context: '${{ github.workflow }}', - sha: '${{ steps.axon_git_ref.outputs.result}}', - target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' - }) + if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') { + github.rest.repos.createCommitStatus({ + state: '${{ job.status }}', + owner: context.repo.owner, + repo: context.repo.repo, + context: '${{ github.workflow }}', + sha: '${{ steps.axon_git_ref.outputs.result}}', + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + }); + } diff --git a/tests/e2e/docker-compose.yaml b/tests/e2e/docker-compose.yaml deleted file mode 100644 index da032ea8b..000000000 --- a/tests/e2e/docker-compose.yaml +++ /dev/null @@ -1,11 +0,0 @@ -version: "3" -services: - dev: - image: "node:16-buster" - volumes: - - ".:/root/axon-e2e-tests" - - "axon-e2e-tests-npm-cache:/root/.npm" - working_dir: "/root/axon-e2e-tests" -volumes: - axon-e2e-tests-npm-cache: - external: false