1+ name : Build e2e tests
2+
3+ on :
4+ push :
5+ branches : [ e2e ]
6+ pull_request :
7+ branches : [ e2e ]
8+ types : [ opened, synchronize, reopened, labeled ]
9+ workflow_dispatch :
10+
11+ jobs :
12+ build :
13+ runs-on : k8s-runner-e2e
14+ # We allow builds:
15+ # 1) When triggered manually
16+ # 2) When it's a merge into a branch
17+ # 3) For PRs that are labeled as build and
18+ # - It's a code change
19+ # - A build label was just added
20+ # A bit complex, but prevents builds when other labels are manipulated
21+ if : >
22+ github.event_name == 'workflow_dispatch'
23+ || github.event_name == 'push'
24+ || (contains(github.event.pull_request.labels.*.name, 'build')
25+ && (github.event.action != 'labeled' || github.event.label.name == 'build')
26+ )
27+ strategy :
28+ fail-fast : false
29+
30+ steps :
31+ # Pinned 1.0.0 version
32+ - uses : actions/checkout@v3
33+ with :
34+ path : plugin
35+ submodules : ' recursive'
36+ ref : ${{ github.event.workflow_run.head_sha }}
37+
38+ - uses : dorny/paths-filter@b2feaf19c27470162a626bd6fa8438ae5b263721
39+ if : github.event_name != 'workflow_dispatch' && github.event_name != 'push'
40+ id : filter
41+ with :
42+ working-directory : plugin
43+ filters : |
44+ e2e-test:
45+ - '**/e2e-test/**'
46+ - name : Checkout e2e test repo
47+ uses : actions/checkout@v3
48+ with :
49+ repository : cdapio/cdap-e2e-tests
50+ path : e2e
51+
52+ - name : Cache
53+ uses : actions/cache@v3
54+ with :
55+ path : ~/.m2/repository
56+ key : ${{ runner.os }}-maven-${{ github.workflow }}-${{ hashFiles('**/pom.xml') }}
57+ restore-keys : |
58+ ${{ runner.os }}-maven-${{ github.workflow }}
59+ - name : Get Secrets from GCP Secret Manager
60+ id : secrets
61+ uses : ' google-github-actions/get-secretmanager-secrets@v0'
62+ with :
63+ secrets : |-
64+ ORACLE_HOST:cdapio-github-builds/ORACLE_HOST
65+ ORACLE_USERNAME:cdapio-github-builds/ORACLE_USERNAME
66+ ORACLE_PASSWORD:cdapio-github-builds/ORACLE_PASSWORD
67+ ORACLE_PORT:cdapio-github-builds/ORACLE_PORT
68+ - name : Run required e2e tests
69+ if : github.event_name != 'workflow_dispatch' && github.event_name != 'push' && steps.filter.outputs.e2e-test == 'false'
70+ run : python3 e2e/src/main/scripts/run_e2e_test.py --testRunner TestRunnerRequired.java
71+ env :
72+ ORACLE_HOST : ${{ steps.secrets.outputs.ORACLE_HOST }}
73+ ORACLE_USERNAME : ${{ steps.secrets.outputs.ORACLE_USERNAME }}
74+ ORACLE_PASSWORD : ${{ steps.secrets.outputs.ORACLE_PASSWORD }}
75+ ORACLE_PORT : ${{ steps.secrets.outputs.ORACLE_PORT }}
76+
77+
78+ - name : Run all e2e tests
79+ if : github.event_name == 'workflow_dispatch' || github.event_name == 'push' || steps.filter.outputs.e2e-test == 'true'
80+ run : python3 e2e/src/main/scripts/run_e2e_test.py --testRunner **/**/TestRunner.java
81+ env :
82+ ORACLE_HOST : ${{ steps.secrets.outputs.ORACLE_HOST }}
83+ ORACLE_USERNAME : ${{ steps.secrets.outputs.ORACLE_USERNAME }}
84+ ORACLE_PASSWORD : ${{ steps.secrets.outputs.ORACLE_PASSWORD }}
85+ ORACLE_PORT : ${{ steps.secrets.outputs.ORACLE_PORT }}
86+
87+
88+ - name : Upload report
89+ uses : actions/upload-artifact@v3
90+ if : always()
91+ with :
92+ name : Cucumber report
93+ path : ./**/target/cucumber-reports
94+
95+ - name : Upload debug files
96+ uses : actions/upload-artifact@v3
97+ if : always()
98+ with :
99+ name : Debug files
100+ path : ./**/target/e2e-debug
101+
102+ - name : Upload files to GCS
103+ uses : google-github-actions/upload-cloud-storage@v0
104+ if : always()
105+ with :
106+ path : ./plugin
107+ destination : e2e-tests-cucumber-reports/${{ github.event.repository.name }}/${{ github.ref }}
108+ glob : ' **/target/cucumber-reports/**'
0 commit comments