Repository navigation
181 lines (170 loc) · 6.49 KB
/
Copy pathci.yml
File metadata and controls
181 lines (170 loc) · 6.49 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#
# Copyright (c) 2026 devlive-community/pipeforge
#
# Licensed under the MIT License. See the LICENSE file in the
# project root for full license text.
#
# Quick-check stage: format, static analysis, compile, unit tests, dependency and license
# checks. Only the components touched by a change are built; Java builds only the affected
# reactor modules plus their upstream and downstream modules. "ci-ok" is the only required
# status check.
name: CI
on:
pull_request:
push:
branches: [dev, 'release-*']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
java: ${{ steps.detect.outputs.java }}
build-checks: ${{ steps.detect.outputs.build-checks }}
dev-env: ${{ steps.detect.outputs.dev-env }}
web: ${{ steps.detect.outputs.web }}
maven_modules: ${{ steps.modules.outputs.maven_modules }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- id: detect
run: bash .ci/changed-components.sh --github-output -v
- id: modules
env:
FULL_RUN: ${{ github.event_name == 'workflow_dispatch' }}
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
# Fail safe toward running everything when the base is unknown.
if [ "$FULL_RUN" = true ] || [ -z "$BASE_SHA" ] \
|| [ "$BASE_SHA" = 0000000000000000000000000000000000000000 ] \
|| ! git cat-file -e "$BASE_SHA^{commit}" 2>/dev/null; then
echo "maven_modules=:all" | tee -a "$GITHUB_OUTPUT"
elif git diff --name-only --no-renames "$BASE_SHA" HEAD | grep -qE '^(\.ci/|\.github/workflows/ci\.yml$)'; then
echo "maven_modules=:all" | tee -a "$GITHUB_OUTPUT"
else
git diff --name-only --no-renames "$BASE_SHA" HEAD \
| bash .ci/maven-modules.sh --github-output
fi
# Cheap repository-wide checks that need no build: license headers, shell scripts, CI script
# tests and the format of the community files.
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- run: tools/license-header/check.sh
- run: git ls-files -z '*.sh' | xargs -0 shellcheck -S warning
- run: .ci/tests/run.sh
- run: .ci/check-community-files.sh
java:
needs: changes
if: needs.changes.outputs.java == 'true' && needs.changes.outputs.maven_modules != ''
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version-file: .java-version
cache: maven
- env:
MODULES: ${{ needs.changes.outputs.maven_modules }}
run: |
if [ "$MODULES" = ":all" ]; then
./mvnw -B -ntp verify
else
echo "building affected modules: $MODULES"
./mvnw -B -ntp verify -pl "$MODULES" -am -amd
fi
# Local runs start one worker by default; the connector suites must also pass on three
# workers whose tasks exchange rows over TCP (M1 plan, commit 15).
- name: Connector suites on three local workers
env:
MODULES: ${{ needs.changes.outputs.maven_modules }}
run: |
case "$MODULES" in
:all|*engine*|*connector*)
./mvnw -B -ntp verify -Djacoco.skip=true -Dpipeforge.local.workers=3 -am \
-pl pipeforge-connector-testkit,pipeforge-connectors/connector-fake,pipeforge-connectors/connector-console,pipeforge-connectors/connector-blackhole
;;
*) echo "no engine or connector module changed" ;;
esac
build-checks:
needs: changes
if: needs.changes.outputs.build-checks == 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version-file: .java-version
cache: maven
- run: tools/build-checks/selftest.sh
web:
needs: changes
if: needs.changes.outputs.web == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm -r --filter '!@pipeforge/docs' test
# Browser tests of the Web UI against its production build, with the API mocked.
- run: pnpm --filter @pipeforge/ui exec playwright install --with-deps chromium
- run: pnpm --filter @pipeforge/ui e2e
# Starts the docker compose environment (including MinIO) with pipeforge dev, checks every
# service and stops it again; the scripts in dev/ do the same without the command.
dev-env:
needs: changes
if: needs.changes.outputs.dev-env == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version-file: .java-version
cache: maven
- run: ./mvnw -B -ntp package -pl pipeforge-dist -am -DskipTests -Djacoco.skip=true -Dinvoker.skip=true
- run: echo "PIPEFORGE=$(echo "$PWD"/pipeforge-dist/target/pipeforge-*/bin/pipeforge)" >> "$GITHUB_ENV"
# the cluster profile runs the distribution just built: a master and three workers; dev/check.sh
# submits a fake -> blackhole job to them
- run: $PIPEFORGE dev up --s3 --cluster
- run: dev/check.sh
- run: $PIPEFORGE dev status
- if: failure()
run: docker compose -f dev/docker-compose.yaml --profile s3 --profile cluster logs --no-color --tail 200
- if: always()
run: $PIPEFORGE dev down --volumes
- if: always()
run: |
# down must leave nothing running: status exits with 1 and says so.
if $PIPEFORGE dev status; then exit 1; fi
ci-ok:
if: always()
needs: [changes, lint, java, build-checks, dev-env, web]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
echo "job results: $RESULTS"
case " $RESULTS " in
*" failure "*|*" cancelled "*) exit 1 ;;
esac