forked from neonevm/neon-evm
-
Notifications
You must be signed in to change notification settings - Fork 9
140 lines (138 loc) · 5.33 KB
/
pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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}