Ndev 3386 caching build config #3794
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: Deploy image | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, labeled, unlabeled, ready_for_review] | |
repository_dispatch: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- develop | |
- '[vt][0-9].[0-9]+.[0-9x]+*' | |
tags: | |
- "*" | |
env: | |
DHUBU: ${{secrets.DHUBU}} | |
DHUBP: ${{secrets.DHUBP}} | |
PROXY_ENDPOINT: "https://api.github.com/repos/${{ github.repository_owner }}/neon-proxy.py" | |
NEON_TESTS_ENDPOINT: ${{vars.NEON_TESTS_ENDPOINT}} | |
DOCKERHUB_ORG_NAME: ${{vars.DOCKERHUB_ORG_NAME}} | |
RUN_LINK_REPO: "${{ github.repository_owner }}/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-image: | |
runs-on: ["self-hosted", "k8s-prod"] | |
outputs: | |
evm_tag: ${{ steps.tags.outputs.evm_tag }} | |
evm_sha_tag: ${{ steps.tags.outputs.evm_sha_tag }} | |
evm_pr_version_branch: ${{ steps.tags.outputs.evm_pr_version_branch }} | |
is_evm_release: ${{ steps.tags.outputs.is_evm_release }} | |
neon_test_tag: ${{ steps.tags.outputs.neon_test_tag }} | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-python@v5 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: pip install -r ./.github/workflows/requirements.txt | |
- name: Specify image tags | |
run: | | |
python3 ./.github/workflows/deploy.py specify_image_tags \ | |
--git_ref=${{ github.ref }} \ | |
--git_head_ref=${{ github.head_ref }} \ | |
--git_base_ref=${{ github.base_ref }} | |
- name: Set outputs | |
id: tags | |
run: | | |
echo "evm_tag=${{ env.EVM_TAG }}" >> "$GITHUB_OUTPUT" | |
echo "evm_sha_tag=${{ github.sha }}" >> "$GITHUB_OUTPUT" | |
echo "evm_pr_version_branch=${{ env.EVM_PR_VERSION_BRANCH }}" >> "$GITHUB_OUTPUT" | |
echo "is_evm_release=${{ env.IS_EVM_RELEASE }}" >> "$GITHUB_OUTPUT" | |
echo "neon_test_tag=${{ env.NEON_TEST_TAG }}" >> "$GITHUB_OUTPUT" | |
- name: build docker image | |
run: | | |
python3 ./.github/workflows/deploy.py build_docker_image \ | |
--evm_sha_tag=${{ steps.tags.outputs.evm_sha_tag }} | |
- name: publish image | |
run: | | |
python3 ./.github/workflows/deploy.py publish_image \ | |
--evm_sha_tag=${{ steps.tags.outputs.evm_sha_tag }} \ | |
--evm_tag=${{ steps.tags.outputs.evm_tag }} | |
run-evm-tests: | |
runs-on: ["self-hosted", "k8s-prod"] | |
needs: | |
- build-image | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-python@v5 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: pip install -r ./.github/workflows/requirements.txt | |
- name: Run tests | |
run: | | |
python3 ./.github/workflows/deploy.py run_tests \ | |
--evm_sha_tag=${{ needs.build-image.outputs.evm_sha_tag }} \ | |
--neon_test_tag=${{ needs.build-image.outputs.neon_test_tag }} \ | |
--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: ["self-hosted", "k8s-prod"] | |
needs: | |
- build-image | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-python@v5 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: pip install -r ./.github/workflows/requirements.txt | |
- name: Trigger proxy build | |
run: | | |
python3 ./.github/workflows/deploy.py trigger_proxy_action \ | |
--evm_pr_version_branch=${{ needs.build-image.outputs.evm_pr_version_branch }} \ | |
--is_evm_release=${{ needs.build-image.outputs.is_evm_release }} \ | |
--evm_sha_tag=${{ needs.build-image.outputs.evm_sha_tag }} \ | |
--evm_tag=${{ needs.build-image.outputs.evm_tag }} \ | |
--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: ["self-hosted", "k8s-prod"] | |
needs: | |
- build-image | |
- trigger-proxy-tests | |
- run-evm-tests | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-python@v5 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: pip install -r ./.github/workflows/requirements.txt | |
- name: Finalize image | |
run: | | |
python3 ./.github/workflows/deploy.py finalize_image \ | |
--evm_sha_tag=${{ needs.build-image.outputs.evm_sha_tag }} \ | |
--evm_tag=${{ needs.build-image.outputs.evm_tag }} | |
- name: Send notification to slack | |
if: failure() | |
run: | | |
python3 ./.github/workflows/deploy.py send_notification \ | |
--evm_tag=${{ needs.build-image.outputs.evm_tag }} \ | |
--url=${{secrets.SLACK_EVM_CHANNEL_URL}} \ | |
--build_url=${BUILD_URL} |