forked from neonevm/neon-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (150 loc) · 4.5 KB
/
Copy pathbasic.yml
File metadata and controls
161 lines (150 loc) · 4.5 KB
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
name: "Basic tests"
on:
schedule:
- cron: "0 23,2 * * *"
- cron: "* */4 * * *"
workflow_dispatch:
inputs:
network:
type: choice
default: night-stand
required: true
description: "Stand name"
options:
- night-stand
- release-stand
- devnet-aws
- devnet
- testnet
runner:
type: choice
default: ubuntu-20.04
required: true
description: "Where to run tests (our runner or github)"
options:
- neon-hosted
- aws-hosted
- ubuntu-20.04
env:
NETWORK: night-stand
RUNNER: ubuntu-20.04
BUILD_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
jobs:
prepare-env:
runs-on: ubuntu-20.04
if: always()
steps:
- name: Setup `night-stand` by cron schedule
id: setup_night_stand
if: github.event.schedule=='* 23,2 * * *'
run: |
echo "NETWORK=night-stand" >> $GITHUB_ENV
- name: Setup `devnet` by cron schedule
id: setup_devnet
if: github.event.schedule=='* */4 * * *'
run: |
echo "NETWORK=devnet" >> $GITHUB_ENV
- 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 }}" )
echo "Network: ${NETWORK}"
echo "Runner: ${RUNNER}"
echo "Build url: ${{ env.BUILD_URL }}"
echo "::set-output name=network::${NETWORK}"
echo "::set-output name=runner::${RUNNER}"
echo "::set-output name=jobs::${JOBS_NUMBER}"
outputs:
network: ${{ steps.setup.outputs.network }}
runner: ${{ steps.setup.outputs.runner }}
tests:
name: "Basic tests"
needs:
- prepare-env
runs-on: ${{ needs.prepare-env.outputs.runner }}
env:
NETWORK: ${{ needs.prepare-env.outputs.network }}
RUNNER: ${{ needs.prepare-env.outputs.runner }}
if: always()
steps:
- uses: actions/checkout@v2
- name: "Install deps"
id: requirements
uses: ./.github/actions/requirements
- name: "Run basic tests"
id: basic
run: "./clickfile.py run 'basic' -n ${{ env.NETWORK }}"
- uses: actions/upload-artifact@v2
with:
name: "Allure results"
path: allure-results
- name: "Notify on failure."
if: ${{ failure() }}
run: "./clickfile.py send-notification -u ${{ secrets.SLACK_URL }} -b ${{ env.BUILD_URL }}"
allure:
runs-on: ${{ needs.prepare-env.outputs.runner }}
if: always()
needs:
- prepare-env
- tests
env:
NETWORK: ${{ needs.prepare-env.outputs.network }}
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
with:
name: "Allure results"
path: allure-results
- name: Get Allure history
uses: actions/checkout@v2
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Create a path for report
run: |
path=""
network="${{ env.NETWORK }}"
ref_name="${{ github.ref_name }}"
if [[ "$network" != "night-stand" ]]; then
path="$network"
fi
if [[ "$ref_name" != "develop" ]]; then
if [ ${#path} -gt 0 ]; then
path="$path/$ref_name"
else
path="$ref_name"
fi
fi
echo "ALLURE_SUBDIR=$path" >> $GITHUB_ENV
- name: Allure Report action from marketplace
uses: neonlabsorg/allure-report-action@master
if: always()
with:
allure_results: allure-results
gh_pages: gh-pages
subfolder: ${{ env.ALLURE_SUBDIR }}
allure_report: allure-report
allure_history: allure-history
keep_reports: 50
- name: Deploy report to Github Pages
if: always()
uses: peaceiris/actions-gh-pages@v2
env:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history
outputs:
subdir: ${{ env.ALLURE_SUBDIR }}