OpenZeppelin #198
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: "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 | |
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" | |
env: | |
JOBS_NUMBER: "8" | |
NETWORK: night-stand | |
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'}} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 }} | |
prepare-env: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Setup env | |
id: setup | |
run: | | |
# $1 - inputs | |
# $2 - env.VAR | |
function setVar { | |
if [ -z "$1" ] | |
then | |
RESULT="$2" | |
else | |
RESULT="$1" | |
fi | |
echo $RESULT | |
} | |
NETWORK=$( setVar "${{ github.event.inputs.network }}" "${{ env.NETWORK }}" ) | |
RUNNER=$( setVar "${{ github.event.inputs.runner }}" "${{ env.RUNNER }}" ) | |
JOBS_NUMBER=$( setVar "${{ github.event.inputs.jobsNumber }}" "${{ env.JOBS_NUMBER }}" ) | |
echo "Network: ${NETWORK}" | |
echo "Runner: ${RUNNER}" | |
echo "Jobs: ${JOBS_NUMBER}" | |
echo "network=${NETWORK}" >> $GITHUB_OUTPUT | |
echo "runner=${RUNNER}" >> $GITHUB_OUTPUT | |
echo "jobs=${JOBS_NUMBER}" >> $GITHUB_OUTPUT | |
outputs: | |
network: ${{ steps.setup.outputs.network }} | |
runner: ${{ steps.setup.outputs.runner }} | |
jobs: ${{ steps.setup.outputs.jobs }} | |
tests: | |
name: OpenZeppelin tests | |
needs: | |
- prepare-env | |
- dockerize | |
if: | | |
always() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') | |
runs-on: ${{ needs.prepare-env.outputs.runner }} | |
env: | |
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}" | |
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Define image tag | |
id: image_tag | |
uses: ./.github/actions/define-image-tag | |
- 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: | | |
docker exec -i -e OZ_BALANCES_REPORT_FLAG=1 ${{ env.CONTAINER }} python3 ./clickfile.py run oz \ | |
--network ${{ needs.prepare-env.outputs.network }} \ | |
--jobs ${{ needs.prepare-env.outputs.jobs }} \ | |
--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 ${{ needs.prepare-env.outputs.network }} | |
- name: Remove docker container | |
if: always() | |
run: docker rm -f ${{ env.CONTAINER }} |