Skip to content

OpenZeppelin

OpenZeppelin #353

Workflow file for this run

name: "OpenZeppelin"
on:
schedule:
- cron: "0 3 * * 0,1,2,3,4"
workflow_dispatch:
inputs:
network:
type: choice
default: night-stand
required: true
description: "Stand name"
options:
- night-stand
- devnet
- terraform
runner:
type: choice
default: neon-hosted
required: true
description: "Where to run tests (our runner or github)"
options:
- neon-hosted
- aws-hosted
- ubuntu-20.04
jobsNumber:
description: "Count of parallel jobs"
required: true
default: "8"
oz_branch:
description: "Which OZ branch to use (if it is empty 'master', branch will be used)"
required: false
default: master
env:
JOBS_NUMBER: ${{ github.event.inputs.jobsNumber || '8' }}
NETWORK: ${{ github.event.inputs.network || 'night-stand' }}
RUNNER: ${{github.event.inputs.runner || 'neon-hosted' }}
IMAGE: neonlabsorg/neon_tests
CONTAINER: oz-${{ github.run_id }}
BUILD_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
jobs:
dockerize:
if: github.ref_name != 'develop' || github.event.inputs.oz_branch !=''
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: "Dockerize neon tests"
uses: ./.github/actions/dockerize-neon-tests
with:
image_tag: ${{ github.sha }}
docker_username: ${{ secrets.DOCKER_USERNAME }}
docker_password: ${{ secrets.DOCKER_PASSWORD }}
oz_branch: ${{ github.event.inputs.oz_branch || 'master' }}
prepare-env:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: "Prepare stand"
id: prepare_stand
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
HCLOUD_TOKEN: ${{secrets.HCLOUD_TOKEN}}
TFSTATE_BUCKET: ${{vars.TFSTATE_BUCKET}}
TFSTATE_KEY_PREFIX: ${{vars.TFSTATE_KEY_PREFIX}}
TFSTATE_REGION: ${{vars.TFSTATE_REGION}}
uses: ./.github/actions/prepare-stand
with:
network: ${{ env.NETWORK }}
ci_stands_key_hcloud: ${{ secrets.CI_STANDS_KEY_HCLOUD }}
devnet_solana_url: ${{ secrets.SOLANA_URL }}
- name: Set outputs
id: vars
run: |
echo "runner=${{ env.RUNNER }}" >> $GITHUB_OUTPUT
echo "network=${{ env.NETWORK }}" >> $GITHUB_OUTPUT
outputs:
runner: ${{ steps.vars.outputs.runner }}
network: ${{ steps.vars.outputs.network }}
solana_url: ${{ steps.prepare_stand.outputs.solana_url }}
proxy_url: ${{ steps.prepare_stand.outputs.proxy_url }}
faucet_url: ${{ steps.prepare_stand.outputs.faucet_url }}
network_id: ${{ steps.prepare_stand.outputs.network_id }}
proxy_ip: ${{ steps.prepare_stand.outputs.proxy_ip }}
solana_ip: ${{ steps.prepare_stand.outputs.solana_ip }}
tests:
name: OpenZeppelin tests
needs:
- prepare-env
- dockerize
runs-on: ${{ needs.prepare-env.outputs.runner }}
if: always() && contains(fromJSON('["success", "skipped"]'), needs.dockerize.result)
env:
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
steps:
- uses: actions/checkout@v4
- name: Define image tag
id: image_tag
run: |
if [[ "${{ needs.dockerize.result }}" != "skipped" ]]; then
tag=${{ github.sha }}
else
tag='latest'
fi
echo "tag=${tag}"
echo "tag=${tag}" >> $GITHUB_OUTPUT
- name: Pull docker image
run: docker pull ${{ env.IMAGE }}:${{ steps.image_tag.outputs.tag }}
- name: Run docker container
run: |
docker run -i -d --name=${{ env.CONTAINER }} ${{ env.IMAGE }}:${{ steps.image_tag.outputs.tag }} /bin/bash
- name: Run OpenZeppelin tests
timeout-minutes: 150
run: |
env=''
if [ "${{ env.NETWORK }}" == "terraform" ]; then
env="-e PROXY_IP=${{ needs.prepare-env.outputs.proxy_ip }} -e SOLANA_IP=${{ needs.prepare-env.outputs.solana_ip }}"
fi
echo "env=${env}"
docker exec -i -e OZ_BALANCES_REPORT_FLAG=1 ${env} ${{ env.CONTAINER }} python3 ./clickfile.py run oz \
--network ${{ env.NETWORK }} \
--jobs ${{ env.JOBS_NUMBER }} \
--users 10
- name: Print OpenZeppelin report
run: |
docker exec -i ${{ env.CONTAINER }} python3 ./clickfile.py ozreport
- name: "Generate allure report"
uses: ./.github/actions/generate-allure-report
with:
container: ${{ env.CONTAINER }}
network: ${{ env.NETWORK }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
tests_name: oz
- name: Analyze tests results
run: |
docker exec -i ${{ env.CONTAINER }} python3 ./clickfile.py analyze-openzeppelin-results
- name: "Notify on failure."
if: failure()
run: |
docker exec -i ${{ env.CONTAINER }} \
python3 ./clickfile.py send-notification -u ${{ secrets.SLACK_QA_CHANNEL_URL }} \
-b ${{ env.BUILD_URL }} -n ${{ env.NETWORK }}
- name: Remove docker container
if: always()
run: docker rm -f ${{ env.CONTAINER }}
destroy:
runs-on: ubuntu-20.04
needs: [tests, prepare-env]
if: always() && needs.prepare-env.outputs.network == 'terraform'
steps:
- uses: actions/checkout@v4
- name: "Destroy stand"
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
HCLOUD_TOKEN: ${{secrets.HCLOUD_TOKEN}}
TFSTATE_BUCKET: ${{vars.TFSTATE_BUCKET}}
TFSTATE_KEY_PREFIX: ${{vars.TFSTATE_KEY_PREFIX}}
TFSTATE_REGION: ${{vars.TFSTATE_REGION}}
PROXY_IP: ${{ needs.prepare-env.outputs.proxy_ip }}
SOLANA_IP: ${{ needs.prepare-env.outputs.solana_ip }}
uses: ./.github/actions/destroy-tf-stand
with:
ci_stands_key_hcloud: ${{ secrets.CI_STANDS_KEY_HCLOUD }}
devnet_solana_url: ${{ secrets.SOLANA_URL }}