-
Notifications
You must be signed in to change notification settings - Fork 12
118 lines (103 loc) · 5 KB
/
run-autotests.yaml
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
name: Run Autotests
on:
workflow_dispatch:
workflow_call:
secrets:
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
NEAR_ACCOUNT_ID:
required: true
NEAR_PUBLIC_KEY:
required: true
NEAR_PRIVATE_KEY:
required: true
KUBE_CONFIG_DATA:
required: true
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
if: env.GITHUB_WORKFLOW == 'Run Autotests'
- uses: actions/checkout@v2
with:
ref: develop
if: env.GITHUB_WORKFLOW != 'Run Autotests'
- name: Set Environment
id: set_environment
run: |
cat ".github/env.common" | grep -E -v '^\ *#' >>$GITHUB_ENV
cat ".github/env.test" | grep -E -v '^\ *#' >>$GITHUB_ENV
echo "::set-output name=workflow_name::${GITHUB_WORKFLOW// /-}"
- name: Execute Tests
uses: ./.github/actions/test
with:
NEAR_ACCOUNT_ID: ${{ secrets.NEAR_ACCOUNT_ID }}
NEAR_PUBLIC_KEY: ${{ secrets.NEAR_PUBLIC_KEY }}
NEAR_PRIVATE_KEY: ${{ secrets.NEAR_PRIVATE_KEY }}
- uses: actions/upload-artifact@v2
with:
name: allure_report
path: test-framework/build/reports/allure-report/**
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- uses: Consensys/[email protected]
id: kubectl
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: -n autotests get pods --selector=app.kubernetes.io/instance=automation-report -o jsonpath='{.items[0].metadata.name}'
- name: Clean Output
id: get_pod
shell: bash
run: |
clean_output=$(printf ${{steps.kubectl.outputs.result}} | tr -t "'" "")
echo "pod name is $clean_output"
echo "::set-output name=kubectl-out::$clean_output"
- name: Generate Upload Bundle
shell: bash
run: |
if [ "${ACTIONS_RUNNER_DEBUG:-}" = "true" ]; then
find ./
set -x
fi
sudo mkdir test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}
sudo cp -r test-framework/build/reports/allure-report test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/
sudo find test-framework/build -name swagger-coverage-api-service.html -exec cp '{}' test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/ \;
sudo find test-framework/build -name swagger-coverage-draft-service.html -exec cp '{}' test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/ \;
cat .github/actions/test/reports-site/HEADER.html.template | envsubst | sudo tee test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/HEADER.html
- uses: actions/upload-artifact@v2
with:
name: coverage_report
path: test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/swagger-coverage-*-service.html
- uses: Consensys/[email protected]
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: cp -n autotests test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }} ${{ steps.get_pod.outputs.kubectl-out }}:/app/test
- uses: Consensys/[email protected]
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: cp -n autotests test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/allure-report/history ${{ steps.get_pod.outputs.kubectl-out }}:/app/test/
- uses: Consensys/[email protected]
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: exec -n autotests ${{ steps.get_pod.outputs.kubectl-out }} -- /app/cleanup.sh
- name: Add Annotation
run: |
echo "::notice title=Allure Report::https://automation-report.app.astrodao.com/test/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/allure-report/"
echo "::notice title=Coverage Report API Service::https://automation-report.app.astrodao.com/test/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/swagger-coverage-api-service.html"
echo "::notice title=Coverage Report Draft Service::https://automation-report.app.astrodao.com/test/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/swagger-coverage-draft-service.html"
echo "::notice title=History for Environment::https://automation-report.app.astrodao.com/test/"