forked from neonevm/neon-tests
-
Notifications
You must be signed in to change notification settings - Fork 3
169 lines (165 loc) · 6.12 KB
/
basic.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: "Basic tests"
run-name: Basic tests / ${{ github.event.pull_request.title || github.event_name }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
schedule:
- cron: "0 1 * * 0,1,2,3,4"
- cron: "0 2 * * 0,1,2,3,4"
pull_request:
types: [ opened, reopened, synchronize ]
workflow_dispatch:
inputs:
network:
type: choice
default: terraform
required: true
description: "Stand name"
options:
- terraform
- night-stand
- devnet
- mainnet
numprocesses:
type: choice
default: 8
required: true
description: "Number of parallel jobs"
options:
- 2
- 4
- 8
- 12
- auto
env:
NETWORK: ${{ github.event.inputs.network || 'terraform' }}
NUMPROCESSES: ${{ github.event.inputs.numprocesses || 8 }}
BUILD_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
SOLANA_URL: "${{ secrets.SOLANA_URL }}"
FAUCET_URL: "${{ secrets.DEVNET_FAUCET_URL }}"
IMAGE: neonlabsorg/neon_tests
CONTAINER: basic-${{ github.run_id }}
jobs:
dockerize:
if: ${{ github.ref_name != 'develop'}}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: "Dockerize neon tests"
id: requirements
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
if: always()
steps:
- name: Setup `terraform` by cron schedule
id: setup_terraform_stand
if: github.event.schedule=='0 1 * * 0,1,2,3,4'
run: |
echo "NETWORK=terraform" >> $GITHUB_ENV
- name: Setup `devnet` by cron schedule
id: setup_devnet
if: github.event.schedule=='0 4 * * 0,1,2,3,4'
run: |
echo "NETWORK=devnet" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: "Prepare terraform stand"
id: prepare_terraform
if: ${{ env.NETWORK == 'terraform' }}
timeout-minutes: 15
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: ${{vars.TFSTATE_KEY_PREFIX}}-${{ github.run_number }}
TFSTATE_REGION: ${{vars.TFSTATE_REGION}}
TF_VAR_ci_pp_solana_url: ${{ secrets.SOLANA_URL }}
uses: ./.github/actions/create-tf-stand
with:
ci_stands_key_hcloud: ${{ secrets.CI_STANDS_KEY_HCLOUD }}
outputs:
proxy_ip: ${{ steps.prepare_terraform.outputs.proxy_ip }}
solana_ip: ${{ steps.prepare_terraform.outputs.solana_ip }}
network: ${{ env.NETWORK }}
tests:
name: "Basic tests"
needs:
- dockerize
- prepare-env
runs-on: neon-hosted
env:
SOLANA_IP: ${{ needs.prepare-env.outputs.solana_ip }}
PROXY_IP: ${{ needs.prepare-env.outputs.proxy_ip }}
NETWORK: ${{ needs.prepare-env.outputs.network }}
if: |
always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
steps:
- uses: actions/checkout@v4
- name: "Define image tag"
id: image_tag
uses: ./.github/actions/define-image-tag
- name: Run docker container
run: |
docker pull ${{ env.IMAGE }}:${{ steps.image_tag.outputs.tag }}
docker run -i -d -e CI -e GITHUB_RUN_ID -e GITHUB_WORKFLOW \
-e ETH_BANK_PRIVATE_KEY_MAINNET=${{ secrets.ETH_BANK_PRIVATE_KEY_MAINNET }} \
-e BANK_PRIVATE_KEY_MAINNET=${{ secrets.BANK_PRIVATE_KEY_MAINNET }} \
-e BANK_PRIVATE_KEY=${{ secrets.BANK_PRIVATE_KEY }} \
-e SOLANA_URL \
-e SOLANA_IP -e PROXY_IP \
--name=${{ env.CONTAINER }} ${{ env.IMAGE }}:${{ steps.image_tag.outputs.tag }} /bin/bash
- name: "Run basic tests"
timeout-minutes: 60
id: basic
run: |
docker exec -i ${{ env.CONTAINER }} \
/bin/bash -c "export DEVNET_FAUCET_URL=${{ env.FAUCET_URL }} && export SOLANA_URL=${{ env.SOLANA_URL }} && \
python3 ./clickfile.py run basic -n ${{ env.NETWORK }} --numprocesses ${{ env.NUMPROCESSES }}"
- 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: "Generate allure report"
if: always()
id: requirements
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: basic
- name: Remove docker container
if: always()
run: docker rm -f ${{ env.CONTAINER }}
destroy:
runs-on: ubuntu-20.04
needs: [ prepare-env, tests ]
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: ${{vars.TFSTATE_KEY_PREFIX}}-${{ github.run_number }}
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 }}