forked from cucumber/cucumber-jvm-starter-maven-java
-
Notifications
You must be signed in to change notification settings - Fork 2
118 lines (100 loc) · 3.47 KB
/
Copy pathe2e.yml
File metadata and controls
118 lines (100 loc) · 3.47 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
name: E2E tests
on:
workflow_dispatch:
inputs:
ocis_version:
type: string
required: false
tag:
type: string
required: false
default: 'not @ignore and not @noocis and not @noci'
schedule:
- cron: '30 2 * * 1' # Monday at 02:30 UTC
- cron: '30 2 * * 2-5' # Tuesday to Friday at 2:30AM
permissions:
contents: read
env:
SINCE_REF: ${{ github.event.schedule == '30 2 * * 1' && 'last friday' || 'yesterday' }}
UNTIL_REF: ${{ github.event.schedule == '30 2 * * 1' && 'last saturday' || 'today' }}
jobs:
# Firstly, check if there were changes the day before. If not, aborting
check_repo_changes:
name: Check changes in Android app
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.check.outputs.has_changes }}
steps:
- name: Checkout external repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
repository: owncloud/android
ref: master
fetch-depth: 0
path: android-repo
- name: Check commits from previous day
id: check
shell: bash
run: |
cd android-repo
export TZ="Europe/Madrid"
SINCE=$(date -d "$SINCE_REF" +"%Y-%m-%d 00:00:00")
UNTIL=$(date -d "$UNTIL_REF" +"%Y-%m-%d 00:00:00")
echo "Checking commits in external repo between:"
echo "SINCE=$SINCE"
echo "UNTIL=$UNTIL"
COMMITS=$(git rev-list --count --since="$SINCE" --until="$UNTIL" origin/master)
echo "Commits found: $COMMITS"
if [ "$COMMITS" -gt 0 ]; then
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_changes=false" >> "$GITHUB_OUTPUT"
fi
# Builds apk
build_apk:
needs:
- check_repo_changes
if: github.event_name == 'workflow_dispatch' || needs.check_repo_changes.outputs.has_changes == 'true'
uses: owncloud/android/.github/workflows/build-apk.yml@master
with:
build_variant: qaRelease
version: master
# Creates an oCIS server
create_ocis:
needs:
- check_repo_changes
if: github.event_name == 'workflow_dispatch' || needs.check_repo_changes.outputs.has_changes == 'true'
uses: ./.github/workflows/ocisbackend.yml
with:
ocis_version: ${{ (inputs.ocis_version != '' && inputs.ocis_version) || vars.OCIS_VERSION }}
secrets:
ocis_url: ${{ secrets.OC_SERVER_URL }}
ssh_host: ${{ secrets.SSH_HOST }}
ssh_user: ${{ secrets.SSH_USER }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
ocis_pwd: ${{ secrets.OCIS_PWD }}
# Launches the tests
tests:
if: github.event_name == 'workflow_dispatch' || needs.check_repo_changes.outputs.has_changes == 'true'
needs:
- check_repo_changes
- build_apk
- create_ocis
uses: ./.github/workflows/e2etests.yml
with:
apk: ${{ needs.build_apk.outputs.artifact_name }}
backend: oCIS
tag: ${{ inputs.tag || 'not @ignore and not @noocis and not @noci' }}
secrets:
oc_server_url: ${{ secrets.OC_SERVER_URL }}
# Server clean up
cleanup:
needs:
- check_repo_changes
- tests
if: always() && (github.event_name == 'workflow_dispatch' || needs.check_repo_changes.outputs.has_changes == 'true')
uses: ./.github/workflows/cleanup.yml
secrets:
ssh_host: ${{ secrets.SSH_HOST }}
ssh_user: ${{ secrets.SSH_USER }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}