Repository navigation
127 lines (118 loc) · 4.13 KB
/
Copy pathtest.yml
File metadata and controls
127 lines (118 loc) · 4.13 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
119
120
121
122
123
124
125
126
127
name: Test and build
on:
push:
branches:
- master
- stable-*
tags:
- '*'
pull_request:
jobs:
check-flags:
runs-on: ubuntu-latest
outputs:
full-ci: ${{ steps.full-ci.outputs.full-ci }}
ci-relevant: ${{ steps.paths.outputs.ci-relevant }}
workflows: ${{ steps.paths.outputs.workflows }}
affected-suites: ${{ steps.affected-suites.outputs.suites }}
steps:
- name: Resolve full-ci flag
id: full-ci
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
# non-PR events (push, tag) always run the full matrix
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
echo "full-ci=true" >> $GITHUB_OUTPUT
exit 0
fi
if [[ "${PR_TITLE,,}" == *"full-ci"* ]]; then
echo "full-ci=true" >> $GITHUB_OUTPUT
else
echo "full-ci=false" >> $GITHUB_OUTPUT
fi
- name: Checkout code
if: github.event_name == 'pull_request'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup Node.js
if: github.event_name == 'pull_request'
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.15.0
- name: Detect changed files
id: paths
if: github.event_name == 'pull_request'
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
with:
filters: |
ci-relevant:
- 'packages/**'
- '!packages/web-app-skeleton/**'
- 'polyfills/**'
- 'tests/**'
- '!tests/e2e/**'
- 'vite*.ts'
- 'tsconfig.json'
- 'package.json'
- 'pnpm-lock.yaml'
- 'eslint.config.js'
- 'babel.config.cjs'
- 'index.html'
- 'web.d.ts'
- 'gettext.config.cjs'
- 'vitest.config.ts'
- 'cucumber.mjs'
workflows:
- '.github/workflows/**'
- name: Determine affected test suites
id: affected-suites
if: github.event_name == 'pull_request'
env:
DRONE_TARGET_BRANCH: ${{ github.base_ref }}
DRONE_BUILD_EVENT: pull_request
run: |
all_suites="admin-settings,spaces,navigation,user-settings,app-store,file-action,shares,search,runtime,app-provider,ocm,oidc,smoke,mfa"
node tests/drone/filterTestSuitesToRun.js "$all_suites" || exit_code=$?
if [ "${exit_code:-0}" -eq 78 ]; then
echo "suites=" >> $GITHUB_OUTPUT
elif [ "${exit_code:-0}" -ne 0 ]; then
exit $exit_code
else
source tests/drone/suites.env
echo "suites=$TEST_SUITES" >> $GITHUB_OUTPUT
fi
build:
needs: check-flags
if: |
github.event_name != 'pull_request' ||
needs.check-flags.outputs.full-ci == 'true' ||
needs.check-flags.outputs.ci-relevant == 'true' ||
needs.check-flags.outputs.workflows == 'true' ||
needs.check-flags.outputs.affected-suites != ''
uses: ./.github/workflows/_build.yml
e2e:
needs: [build, check-flags]
if: |
!cancelled() &&
needs.build.result != 'failure' &&
needs.build.result != 'cancelled' &&
(github.event_name != 'pull_request' ||
needs.check-flags.outputs.full-ci == 'true' ||
needs.check-flags.outputs.workflows == 'true' ||
needs.check-flags.outputs.affected-suites != '')
uses: ./.github/workflows/_e2e.yml
with:
full-ci: ${{ needs.check-flags.outputs.full-ci == 'true' || needs.check-flags.outputs.workflows == 'true' }}
affected-suites: ${{ needs.check-flags.outputs.affected-suites }}
check-tests-passed:
needs: [build, e2e]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check all test jobs passed
run: |
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
exit 1
fi