OCT 1-5 And 12-15 #1378
Workflow file for this run
This file contains 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: OCT 1-5 And 12-15 | |
on: | |
merge_group: | |
workflow_dispatch: | |
inputs: | |
dispatch: | |
type: string | |
description: "'regression' or the JSON of a PR's context" | |
required: true | |
jobs: | |
openzeppelin-contracts-1: | |
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 }} | |
# 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: Get the git ref of Axon | |
uses: actions/github-script@v7 | |
id: axon_git_ref | |
with: | |
script: | | |
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 | |
# 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: | |
ref: ${{ steps.axon_git_ref.outputs.result}} | |
- name: Git checkout axonweb3/openzeppelin-contracts | |
uses: actions/checkout@v4 | |
with: | |
repository: axonweb3/openzeppelin-contracts | |
ref: db3e3f521aedf17e3b12b4f92875bc7c1c745cfb | |
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 | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Node Cache | |
uses: actions/cache@v3 | |
id: npm-and-yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: | | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
~/.npm | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('/home/runner/work/**/package-lock.json', '/home/runner/work/**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node_modules- | |
- name: Cache of Cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build | |
- name: Build Axon in the development profile | |
run: | | |
# check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu` | |
# related issue: https://github.com/axonweb3/axon/issues/1387 | |
lscpu | |
# PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2 | |
PORTABLE=1 USE_SSE=1 cargo build | |
- name: Deploy Local Network of Axon | |
run: | | |
rm -rf ./devtools/chain/data | |
./target/debug/axon init \ | |
--config devtools/chain/config.toml \ | |
--chain-spec devtools/chain/specs/single_node/chain-spec.toml \ | |
> /tmp/log 2>&1 | |
./target/debug/axon run \ | |
--config devtools/chain/config.toml \ | |
>> /tmp/log 2>&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: Check Axon web3_clientVersion Before Test | |
run: | | |
MAX_RETRIES=10 | |
for i in $(seq 1 $MAX_RETRIES); do | |
sleep 10 | |
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}') | |
http_code=$(echo "$response" | tail -n1) | |
response_body=$(echo "$response" | sed '$d') | |
if [[ "$http_code" -eq 200 ]]; then | |
echo "$response_body" | |
exit 0 | |
else | |
echo "Axon status check failed with HTTP status code: $http_code, retrying ($i/$MAX_RETRIES)" | |
if [[ "$i" -eq $MAX_RETRIES ]]; then | |
echo "Axon status check failed after $MAX_RETRIES attempts." | |
exit 1 | |
fi | |
fi | |
done | |
- name: Run prepare | |
if: success() || failure() | |
id: runtest | |
run: | | |
cd /home/runner/work/axon/axon/openzeppelin-contracts | |
npm install | |
npm run test:init | |
- name: Run Pipeline 5-1 | |
if: success() || failure() | |
run: | | |
cd /home/runner/work/axon/axon/openzeppelin-contracts | |
npm run test:pipeline5-1 | |
- name: Run Pipeline 5-2 | |
if: success() || failure() | |
run: | | |
cd /home/runner/work/axon/axon/openzeppelin-contracts | |
npm run test:pipeline5-2 | |
- name: Run Pipeline 5-3 | |
if: success() || failure() | |
run: | | |
cd /home/runner/work/axon/axon/openzeppelin-contracts | |
npm run test:pipeline5-3 | |
- name: Run Pipeline 5-4 | |
if: success() || failure() | |
run: | | |
cd /home/runner/work/axon/axon/openzeppelin-contracts | |
npm run test:pipeline5-4 | |
- name: Run Pipeline 5-5 | |
if: success() || failure() | |
run: | | |
cd /home/runner/work/axon/axon/openzeppelin-contracts | |
npm run test:pipeline5-5 | |
- name: Run Pipeline 5-12 | |
if: success() || failure() | |
run: | | |
cd /home/runner/work/axon/axon/openzeppelin-contracts | |
npm run test:pipeline5-12 | |
- name: Run Pipeline 5-13 | |
if: success() || failure() | |
run: | | |
cd /home/runner/work/axon/axon/openzeppelin-contracts | |
npm run test:pipeline5-13 | |
- name: Run Pipeline 5-14 | |
if: success() || failure() | |
run: | | |
cd /home/runner/work/axon/axon/openzeppelin-contracts | |
npm run test:pipeline5-14 | |
- name: Run Pipeline 5-15 | |
if: success() || failure() | |
run: | | |
cd /home/runner/work/axon/axon/openzeppelin-contracts | |
npm run test:pipeline5-15 | |
- name: Check Axon Status | |
if: success() || failure() | |
run: | | |
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@v4 | |
with: | |
name: jfoa-build-reports-${{ runner.os }} | |
path: openzeppelin-contracts/mochawesome-report/ | |
# 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: '${{ 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 }}' | |
}); | |
} |