Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyuanhust authored Nov 16, 2023
2 parents 1a3714a + 3dbfe5a commit 3ff49e9
Show file tree
Hide file tree
Showing 59 changed files with 744 additions and 1,446 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/axon-start-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
npx zx <<'EOF'
import { waitXBlocksPassed } from './devtools/ci/scripts/helper.js'
await waitXBlocksPassed('http://127.0.0.1:8000', 2);
await retry(3, '6s', () => waitXBlocksPassed('http://127.0.0.1:8000', 2))
EOF
timeout-minutes: 1

Expand Down Expand Up @@ -122,12 +122,12 @@ jobs:
npx zx <<'EOF'
import { waitXBlocksPassed } from './devtools/ci/scripts/helper.js'
await Promise.all([
await retry(3, '6s', () => Promise.all([
waitXBlocksPassed('http://127.0.0.1:8001', 4),
waitXBlocksPassed('http://127.0.0.1:8002', 4),
waitXBlocksPassed('http://127.0.0.1:8003', 4),
waitXBlocksPassed('http://127.0.0.1:8004', 4),
])
]))
EOF
timeout-minutes: 1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_image_ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@ jobs:
npx zx <<'EOF'
import { waitXBlocksPassed } from '../ci/scripts/helper.js'
await waitXBlocksPassed('http://127.0.0.1:8000', 2);
await retry(3, '6s', () => waitXBlocksPassed('http://127.0.0.1:8000', 2))
EOF
timeout-minutes: 2
4 changes: 2 additions & 2 deletions .github/workflows/chaos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Event is dispatch
if: contains(github.event_name, 'workflow_dispatch') &&
github.repository_owner == 'axonweb3' && github.event.inputs.dispatch != 'regression'
uses: actions/github-script@v6
uses: actions/github-script@v7
id: get_sha
with:
github-token: ${{ steps.generate_axon_bot_token.outputs.BOT_TOKEN }}
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
private_key: ${{ secrets.AXON_BOT_PRIVATE_KEY }}
- if: contains(join(needs.*.result, ';'), 'failure') || contains(join(needs.*.result, ';'), 'cancelled')
run: exit 1
- uses: actions/github-script@v6
- uses: actions/github-script@v7
if: ${{ always() }}
with:
github-token: ${{ steps.generate_axon_bot_token.outputs.BOT_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Event is dispatch
if: contains(github.event_name, 'workflow_dispatch') &&
github.repository_owner == 'axonweb3'
uses: actions/github-script@v6
uses: actions/github-script@v7
id: get_sha
with:
github-token: ${{ steps.generate_axon_bot_token.outputs.BOT_TOKEN }}
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
private_key: ${{ secrets.AXON_BOT_PRIVATE_KEY }}
- if: contains(join(needs.*.result, ';'), 'failure') || contains(join(needs.*.result, ';'), 'cancelled')
run: exit 1
- uses: actions/github-script@v6
- uses: actions/github-script@v7
if: ${{ always() }}
with:
github-token: ${{ steps.generate_axon_bot_token.outputs.BOT_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/entry_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Dispatch CIs if the user does have correct permission
if: contains('admin write', fromJson(steps.user_permission.outputs.data).permission)
id: dispatch
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const dispatch = {
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
- name: Post a coment about component information to PR
if: contains('admin write', fromJson(steps.user_permission.outputs.data).permission)
id: post_workflow_run_comment
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
console.log(`${{ steps.escape_multiple_lines_test_inputs.outputs.result }}`);
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/hardfork_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ jobs:
npx zx <<'EOF'
import { waitXBlocksPassed } from './devtools/ci/scripts/helper.js'
await Promise.all([
await retry(3, '6s', () => Promise.all([
waitXBlocksPassed('http://127.0.0.1:8001', 4),
waitXBlocksPassed('http://127.0.0.1:8002', 4),
waitXBlocksPassed('http://127.0.0.1:8003', 4),
waitXBlocksPassed('http://127.0.0.1:8004', 4),
])
]))
EOF
timeout-minutes: 1

- name: Checkout axonweb3/axon-hardfork-test
uses: actions/checkout@v4
with:
repository: axonweb3/axon-hardfork-test
ref: 33eff5b0341097563ad4042dab3c5f72fd0b3abb
ref: 74ff8f164be981ddd0b2819b15ad26a50aace752
path: axon-hardfork-test

- name: Choose network
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue_comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: get assignees
uses: actions/github-script@v6
uses: actions/github-script@v7
id: assignees
with:
script: |
Expand Down
125 changes: 53 additions & 72 deletions .github/workflows/openzeppelin_test_11.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,68 @@
name: OCT 11

on:
push:
branches:
- main
merge_group:
workflow_dispatch:
inputs:
dispatch:
type: string
description: "Dispatch contains pr context that want to trigger OCT 11 test"
description: "'regression' or the JSON of a PR's context"
required: true

jobs:
openzeppelin-contracts-1:
openzeppelin-contracts-3:
strategy:
matrix:
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
outputs:
output-sha: ${{ steps.escape_multiple_lines_test_inputs.outputs.result }}

# When the permissions key is used, all unspecified permissions are set to no access,
# with the exception of the metadata scope, which always gets read access.
# See https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
statuses: write

env:
IS_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }}
IS_REGRESSION: ${{ github.event.inputs.dispatch == 'regression' }}

steps:
- name: Generate axon-bot token
if: contains(github.event_name, 'workflow_dispatch') &&
github.repository_owner == 'axonweb3' && github.event.inputs.dispatch != 'regression'
id: generate_axon_bot_token
uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.AXON_BOT_APP_ID }}
private_key: ${{ secrets.AXON_BOT_PRIVATE_KEY }}
- name: Event is dispatch
if: contains(github.event_name, 'workflow_dispatch') &&
github.repository_owner == 'axonweb3' && github.event.inputs.dispatch != 'regression'
uses: actions/github-script@v6
id: get_sha
- name: Get the git ref of Axon
uses: actions/github-script@v7
id: axon_git_ref
with:
github-token: ${{ steps.generate_axon_bot_token.outputs.BOT_TOKEN }}
script: |
const dispatch = JSON.parse(`${{ github.event.inputs.dispatch }}`);
const pr = (
await github.rest.pulls.get({
owner: dispatch.repo.owner,
repo: dispatch.repo.repo,
pull_number: dispatch.issue.number,
})
).data.head;
github.rest.repos.createCommitStatus({
state: 'pending',
owner: dispatch.repo.owner,
repo: dispatch.repo.repo,
context: '${{ github.workflow }}',
sha: pr.sha,
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})
return pr.sha
- name: Escape multiple lines test inputs
if: contains(github.event_name, 'workflow_dispatch') &&
github.repository_owner == 'axonweb3' && github.event.inputs.dispatch != 'regression'
id: escape_multiple_lines_test_inputs
run: |
inputs=${{ steps.get_sha.outputs.result}}
inputs="${inputs//'%'/'%25'}"
inputs="${inputs//'\n'/'%0A'}"
inputs="${inputs//'\r'/'%0D'}"
echo "result=$inputs" >> $GITHUB_OUTPUT
- name: Git checkout
if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false' && `${{ github.event.inputs.dispatch }}`) {
const dispatch = JSON.parse(`${{ github.event.inputs.dispatch }}`);
const prNum = dispatch.issue.number;
const { data: pullRequest } = await github.rest.pulls.get({
owner: dispatch.repo.owner,
repo: dispatch.repo.repo,
pull_number: dispatch.issue.number,
});
return pullRequest.head.sha;
}
return `${{ github.sha }}`;
result-encoding: string

- name: Checkout Axon commit ${{ steps.axon_git_ref.outputs.result}}
uses: actions/checkout@v4
with:
ref: ${{ steps.escape_multiple_lines_test_inputs.outputs.result || 'main'}}
- uses: actions/checkout@v4
ref: ${{ steps.axon_git_ref.outputs.result}}

- name: Git checkout axonweb3/openzeppelin-contracts
uses: actions/checkout@v4
with:
repository: axonweb3/openzeppelin-contracts
ref: c2c4b8f591b7bc048dcbcf45dd2a1d2017074107
path: openzeppelin-contracts

- uses: actions/setup-node@v4
with:
# TODO: upgrade node-version
node-version: "16"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down Expand Up @@ -123,7 +109,12 @@ jobs:
--config devtools/chain/config.toml \
>> /tmp/log 2>&1 &
- name: Check Axon Status Before Test
npx zx <<'EOF'
import { waitXBlocksPassed } from './devtools/ci/scripts/helper.js'
await retry(3, '6s', () => waitXBlocksPassed('http://127.0.0.1:8000', 2))
EOF
- name: Check Axon web3_clientVersion Before Test
run: |
MAX_RETRIES=10
for i in $(seq 1 $MAX_RETRIES); do
Expand Down Expand Up @@ -159,39 +150,29 @@ jobs:
- name: Check Axon Status
if: success() || failure()
run: |
curl http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params": [],"id":1}'
npx zx <<'EOF'
import { waitXBlocksPassed } from './devtools/ci/scripts/helper.js'
await retry(3, '6s', () => waitXBlocksPassed('http://127.0.0.1:8000', 2))
EOF
- name: Publish reports
if: always()
uses: actions/upload-artifact@v3
with:
name: jfoa-build-reports-${{ runner.os }}
path: openzeppelin-contracts/mochawesome-report/

finally:
name: Finally
needs: [ openzeppelin-contracts-1 ]
if: always() && contains(github.event_name, 'workflow_dispatch') &&
github.event.inputs.dispatch != 'regression' && github.repository_owner == 'axonweb3'
runs-on: ubuntu-latest
steps:
- name: Generate axon-bot token
id: generate_axon_bot_token
uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.AXON_BOT_APP_ID }}
private_key: ${{ secrets.AXON_BOT_PRIVATE_KEY }}
- if: contains(join(needs.*.result, ';'), 'failure') || contains(join(needs.*.result, ';'), 'cancelled')
run: exit 1
- uses: actions/github-script@v6
if: ${{ always() }}
# The `statuses: write` permission is required in this step.
- name: Update the commit Status
if: always() && env.IS_DISPATCH == 'true' && env.IS_REGRESSION == 'false'
uses: actions/github-script@v7
with:
github-token: ${{ steps.generate_axon_bot_token.outputs.BOT_TOKEN }}
script: |
github.rest.repos.createCommitStatus({
state: '${{ job.status }}',
owner: context.repo.owner,
repo: context.repo.repo,
context: '${{ github.workflow }}',
sha: '${{ needs.openzeppelin-contracts-1.outputs.output-sha }}',
sha: '${{ steps.axon_git_ref.outputs.result}}',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})
Loading

0 comments on commit 3ff49e9

Please sign in to comment.