-
Notifications
You must be signed in to change notification settings - Fork 24
134 lines (120 loc) · 6.01 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Run Autotests
on:
workflow_dispatch:
inputs:
environment:
description: Environment to run on. Valid choices are test, production.
default: test
required: false
tags:
description: Tags of test suites to run (as described in [test docs](https://github.com/near-daos/astro-test-framework#tags-test-suites)). Valid choices are all, smoke.
default: smoke
required: false
browser:
description: Browser to run in (as described in [test docs](https://github.com/near-daos/astro-test-framework#tags-test-suites)). Valid choices are chrome, firefox.
default: chrome
required: false
workflow_call:
secrets:
KUBE_CONFIG_DATA:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
TEST_REPO_TOKEN:
required: true
inputs:
environment:
description: Environment to run on. Valid choices are dev, test, production.
default: dev
required: false
type: string
tags:
description: Tags of test suites to run (as described in [test docs](https://github.com/near-daos/astro-test-framework#tags-test-suites)). Valid choices are all, smoke.
default: smoke
required: false
type: string
browser:
description: Browser to run in (as described in [test docs](https://github.com/near-daos/astro-test-framework#tags-test-suites)). Valid choices are chrome, firefox.
default: chrome
required: false
type: string
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
- uses: actions/checkout@v2
with:
repository: near-daos/astro-test-framework
ref: main
token: ${{ secrets.TEST_REPO_TOKEN }}
path: astro-test-framework
- name: Set Environment
id: set_environment
run: |
cat ".github/env.common" | grep -E -v '^\ *#' >>$GITHUB_ENV
cat ".github/env.${{ inputs.environment }}" | grep -E -v '^\ *#' >>$GITHUB_ENV
echo "::set-output name=workflow_name::${GITHUB_WORKFLOW// /-}"
- name: Run Tests
uses: ./.github/actions/tests
with:
env: ${{ env.TEST_ENV_NAME }}
browser: ${{ inputs.browser }}
tags: ${{ inputs.tags }}
- 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 astro-test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}
sudo cp -r astro-test-framework/build/reports/allure-report astro-test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/
#sudo cp -r astro-test-framework/build/swagger-coverage-output astro-test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/
#sudo find astro-test-framework/build -name swagger-coverage-report.html -exec cp '{}' astro-test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/swagger-coverage-output/index.html \;
#sudo find astro-test-framework/build -name swagger-coverage-results.json -exec cp '{}' astro-test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/swagger-coverage-output/ \;
cat .github/actions/tests/reports-site/HEADER.html.template | envsubst | sudo tee astro-test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/HEADER.html
# - uses: actions/upload-artifact@v2
# with:
# name: coverage_report
# path: astro-test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/swagger-coverage-output/**
- uses: Consensys/[email protected]
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: cp -n autotests astro-test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }} ${{ steps.get_pod.outputs.kubectl-out }}:/app/ui-${{ inputs.environment }}
- uses: Consensys/[email protected]
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: cp -n autotests astro-test-framework/build/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/allure-report/history ${{ steps.get_pod.outputs.kubectl-out }}:/app/ui-${{ inputs.environment }}/history
- name: Add Annotation
run: |
echo "::notice title=Allure Report::https://automation-report.app.astrodao.com/ui-${{ inputs.environment }}/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/allure-report/"
#echo "::notice title=Coverage Report::https://automation-report.app.astrodao.com/ui-${{ inputs.environment }}/${{ steps.set_environment.outputs.workflow_name }}-${{ github.run_number }}/swagger-coverage-output/"
echo "::notice title=History for Environment::https://automation-report.app.astrodao.com/ui-${{ inputs.environment }}/"