DOPS-1300 testnet-v2 added #3739
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: Deploy image | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, labeled, unlabeled, ready_for_review] | |
repository_dispatch: | |
push: | |
branches: | |
- master | |
- develop | |
- '[vt][0-9].[0-9]+.[0-9x]+*' | |
- testnet-v2 | |
tags: | |
- "*" | |
env: | |
DHUBU: ${{secrets.DHUBU}} | |
DHUBP: ${{secrets.DHUBP}} | |
IMAGE_NAME: ${{vars.IMAGE_NAME}} | |
PROXY_ENDPOINT: "https://api.github.com/repos/neonlabsorg/neon-proxy.py" | |
NEON_TESTS_ENDPOINT: ${{vars.NEON_TESTS_ENDPOINT}} | |
DOCKERHUB_ORG_NAME: ${{vars.DOCKERHUB_ORG_NAME}} | |
RUN_LINK_REPO: "neonlabsorg/neon-proxy.py" | |
BUILD_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-neon-evm: | |
runs-on: neon-evm-1 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: build docker image | |
run: | | |
python3 ./.github/workflows/deploy.py build_docker_image \ | |
--github_sha=${GITHUB_SHA} | |
- name: publish image | |
run: | | |
python3 ./.github/workflows/deploy.py publish_image \ | |
--github_sha=${GITHUB_SHA} \ | |
--head_ref=${{ github.head_ref }} \ | |
--github_ref_name=${{github.ref_name}} | |
run-neon-evm-tests: | |
runs-on: test-runner | |
needs: | |
- build-neon-evm | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Define base branch if the action is tag creation | |
id: tag_creation | |
if: startsWith(github.ref , 'refs/tags/') | |
run: | | |
base_branch=`echo ${{ github.ref_name }} | sed 's/\.[0-9]*$/\.x/'` | |
echo "base_branch=$base_branch" >> $GITHUB_OUTPUT | |
echo "base_branch=$base_branch" | |
- name: Define neon test branch | |
id: neon_test_branch | |
run: | | |
if [[ "${{ github.ref }}" =~ "refs/heads/"[vt][0-9]+\.[0-9]+\.x ]]; then # version branch | |
tag=${GITHUB_REF/refs\/heads\//} | |
elif [[ "${{ steps.tag_creation.outputs.base_branch }}" != "" ]]; then # tag creation | |
tag=${{ steps.tag_creation.outputs.base_branch }} | |
elif [[ "${{ github.head_ref }}" != "" ]]; then # pr to feature or version branch or develop | |
tag=${{ github.head_ref }} | |
else | |
tag='develop' | |
fi | |
echo "value=${tag}" | |
echo "value=${tag}" >> $GITHUB_OUTPUT | |
- name: Run tests | |
run: | | |
python3 ./.github/workflows/deploy.py run_tests \ | |
--github_sha=${GITHUB_SHA} \ | |
--neon_test_branch=${{ steps.neon_test_branch.outputs.value }} \ | |
--base_ref_branch=${{ github.base_ref }} \ | |
--run_number=${{ github.run_number }} \ | |
--run_attempt=${{ github.run_attempt }} | |
- name: Cancel the build if job failed | |
if: "failure()" | |
uses: "andymckay/[email protected]" | |
trigger-proxy-tests: | |
runs-on: trigger-runner | |
needs: | |
- build-neon-evm | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Trigger proxy build | |
run: | | |
python3 ./.github/workflows/deploy.py trigger_proxy_action \ | |
--github_sha=${GITHUB_SHA} \ | |
--head_ref_branch=${{ github.head_ref }} \ | |
--base_ref_branch=${{ github.base_ref }} \ | |
--github_ref=${{ github.ref }} \ | |
--token=${{secrets.GHTOKEN }} \ | |
--labels='${{ toJson(github.event.pull_request.labels.*.name) }}' \ | |
--pr_url="${{ github.api_url }}/repos/${{ github.repository }}/issues" \ | |
--pr_number="${{ github.event.pull_request.number }}" | |
- name: Cancel the build if job failed | |
if: "failure()" | |
uses: "andymckay/[email protected]" | |
finalize-image: | |
runs-on: neon-evm-1 | |
needs: | |
- trigger-proxy-tests | |
- run-neon-evm-tests | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Finalize image | |
run: | | |
python3 ./.github/workflows/deploy.py finalize_image \ | |
--github_ref=${GITHUB_REF} \ | |
--github_sha=${GITHUB_SHA} | |
- name: Check if it version branch | |
id: is_version_branch | |
run: | | |
if [[ "${{ github.ref }}" =~ "refs/heads/"[vt][0-9]+\.[0-9]+\.x ]]; then | |
echo "value=true" | |
echo "value=true" >> $GITHUB_OUTPUT | |
else | |
echo "value=false" | |
echo "value=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Send notification to slack | |
if: | | |
failure() && | |
(github.ref_name == 'develop' || | |
github.ref_name == 'master' || | |
steps.is_version_branch.outputs.value || | |
startsWith(github.ref , 'refs/tags/')) | |
run: | | |
python3 ./.github/workflows/deploy.py send_notification \ | |
--url=${{secrets.SLACK_EVM_CHANNEL_URL}} \ | |
--build_url=${BUILD_URL} |