Skip to content

Commit d8ad625

Browse files
Merge pull request #36 from cloudsufi/githubActions
Github Actions
2 parents 566a873 + c2591dc commit d8ad625

2 files changed

Lines changed: 145 additions & 0 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Copyright © 2022 Cask Data, Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
3+
# use this file except in compliance with the License. You may obtain a copy of
4+
# the License at
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
# Unless required by applicable law or agreed to in writing, software
7+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
9+
# License for the specific language governing permissions and limitations under
10+
# the License.
11+
12+
# This workflow will build a Java project with Maven
13+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
14+
# Note: Any changes to this workflow would be used only after merging into develop
15+
name: Build e2e tests
16+
17+
on:
18+
workflow_run:
19+
workflows:
20+
- Trigger build
21+
types:
22+
- completed
23+
24+
jobs:
25+
build:
26+
runs-on: k8s-runner-e2e
27+
28+
steps:
29+
- uses: haya14busa/action-workflow_run-status@967ed83efa565c257675ed70cfe5231f062ddd94
30+
- uses: actions/checkout@v2.3.4
31+
with:
32+
repository: data-integrations/google-cloud
33+
path: plugin
34+
35+
- name: Checkout e2e test repo
36+
uses: actions/checkout@v2.3.4
37+
with:
38+
repository: cdapio/cdap-e2e-tests
39+
path: e2e
40+
41+
- name: Cache
42+
uses: actions/cache@v2.1.3
43+
with:
44+
path: ~/.m2/repository
45+
key: ${{ runner.os }}-maven-${{ github.workflow }}-${{ hashFiles('**/pom.xml') }}
46+
restore-keys: |
47+
${{ runner.os }}-maven-${{ github.workflow }}
48+
49+
- name: Get Secrets from GCP Secret Manager
50+
id: 'secrets'
51+
uses: 'google-github-actions/get-secretmanager-secrets@v0'
52+
with:
53+
secrets: |-
54+
SERVICE_NOW_CLIENT_ID:cdapio-github-builds/SERVICE_NOW_CLIENT_ID
55+
SERVICE_NOW_CLIENT_SECRET:cdapio-github-builds/SERVICE_NOW_CLIENT_SECRET
56+
SERVICE_NOW_REST_API_ENDPOINT:cdapio-github-builds/SERVICE_NOW_REST_API_ENDPOINT
57+
SERVICE_NOW_USERNAME:cdapio-github-builds/SERVICE_NOW_USERNAME
58+
SERVICE_NOW_PASSWORD:cdapio-github-builds/SERVICE_NOW_PASSWORD
59+
60+
- name: Run tests
61+
run: python3 e2e/src/main/scripts/run_e2e_test.py
62+
env:
63+
SERVICE_NOW_CLIENT_ID: ${{ steps.secrets.outputs.SERVICE_NOW_CLIENT_ID }}
64+
SERVICE_NOW_CLIENT_SECRET: ${{ steps.secrets.outputs.SERVICE_NOW_CLIENT_SECRET }}
65+
SERVICE_NOW_REST_API_ENDPOINT: ${{ steps.secrets.outputs.SERVICE_NOW_REST_API_ENDPOINT }}
66+
SERVICE_NOW_USERNAME: ${{ steps.secrets.outputs.SERVICE_NOW_USERNAME }}
67+
SERVICE_NOW_PASSWORD: ${{ steps.secrets.outputs.SERVICE_NOW_PASSWORD }}
68+
69+
- name: Upload report
70+
uses: actions/upload-artifact@v2.2.4
71+
if: always()
72+
with:
73+
name: Cucumber report
74+
path: ./plugin/target/cucumber-reports
75+
76+
- name: Upload debug files
77+
uses: actions/upload-artifact@v2.2.4
78+
if: always()
79+
with:
80+
name: Debug files
81+
path: ./**/target/e2e-debug
82+
83+
- name: Deploy report
84+
uses: peaceiris/actions-gh-pages@v3
85+
if: always()
86+
with:
87+
github_token: ${{ secrets.AUTH_TOKEN }}
88+
publish_dir: ./plugin/target/cucumber-reports
89+
destination_dir: cucumber-reports/${{ github.ref }}
90+
91+
- name: github-status-action
92+
uses: Sibz/github-status-action@67af1f4042a5a790681aad83c44008ca6cfab83d
93+
if: always()
94+
with:
95+
authToken: ${{ secrets.AUTH_TOKEN }}
96+
state: success
97+
context: Cucumber report
98+
target_url: https://data-integrations.github.io/servicenow-plugins/cucumber-reports/${{ github.ref }}/advanced-reports/cucumber-html-reports/overview-features.html
99+
sha: ${{github.event.pull_request.head.sha || github.sha}}

.github/workflows/trigger.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright © 2022 Cask Data, Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
3+
# use this file except in compliance with the License. You may obtain a copy of
4+
# the License at
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
# Unless required by applicable law or agreed to in writing, software
7+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
9+
# License for the specific language governing permissions and limitations under
10+
# the License.
11+
12+
# This workflow will trigger build.yml only when needed.
13+
# This way we don't flood main workflow run list
14+
# Note that build.yml from develop will be used even for PR builds
15+
# Also it will have access to the proper GITHUB_SECRET
16+
17+
name: Trigger build
18+
19+
on:
20+
push:
21+
branches: [ develop, release/** ]
22+
pull_request:
23+
branches: [ develop, release/** ]
24+
types: [ opened, synchronize, reopened, labeled ]
25+
workflow_dispatch:
26+
27+
jobs:
28+
trigger:
29+
runs-on: k8s-runner-e2e
30+
31+
# We allow builds:
32+
# 1) When triggered manually
33+
# 2) When it's a merge into a branch
34+
# 3) For PRs that are labeled as build and
35+
# - It's a code change
36+
# - A build label was just added
37+
# A bit complex, but prevents builds when other labels are manipulated.
38+
if: >
39+
github.event_name == 'workflow_dispatch'
40+
|| github.event_name == 'push'
41+
|| (contains(github.event.pull_request.labels.*.name, 'build')
42+
&& (github.event.action != 'labeled' || github.event.label.name == 'build')
43+
)
44+
steps:
45+
- name: Trigger build
46+
run: echo Maven build will be triggered now

0 commit comments

Comments
 (0)