Repository navigation
141 lines (141 loc) · 6.72 KB
/
Copy pathexample-gate.yml
File metadata and controls
141 lines (141 loc) · 6.72 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
name: Example Gate
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
jobs:
examples:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine@sha256:cf78e76683b9ca8c5733cbbdce6c9262b45b6767934dd0a95e671f9a0fc20685
env:
POSTGRES_DB: teaql_rollup_279
POSTGRES_USER: postgres
POSTGRES_PASSWORD: teaql-example-ci-fixture-only
ports:
- 127.0.0.1:5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d teaql_rollup_279"
--health-interval 5s --health-timeout 5s --health-retries 12
permissions:
contents: read
defaults:
run:
working-directory: runtime
env:
TEAQL_CODEGEN_DIR: ${{ github.workspace }}/generator
TEAQL_S3_ENDPOINT: http://127.0.0.1:19010
TEAQL_S3_BUCKET: teaql-java-example-ci
TEAQL_S3_ACCESS_KEY: teaql-java-example-ci
TEAQL_S3_SECRET_KEY: teaql-java-example-ci-fixture-only
TEAQL_TEST_POSTGRES_JDBC_URL: jdbc:postgresql://127.0.0.1:5432/teaql_rollup_279
TEAQL_TEST_POSTGRES_USER: postgres
TEAQL_TEST_POSTGRES_PASSWORD: teaql-example-ci-fixture-only
steps:
- name: Check out runtime under test
uses: actions/checkout@v4
with:
path: runtime
persist-credentials: false
# This key is a read-only deploy key on this one private repository,
# not a personal token. Fork PRs receive no repository secrets.
- name: Check out qualified generator
uses: actions/checkout@v4
with:
repository: teaql/teaql-code-gen
ref: 47a9c444599814aa0b85eea58e88344f7fe3c520
path: generator
ssh-key: ${{ secrets.TEAQL_CODEGEN_READONLY_DEPLOY_KEY }}
persist-credentials: false
- name: Verify pinned generator source
run: |
test "$(git -C "$TEAQL_CODEGEN_DIR" rev-parse HEAD)" = 47a9c444599814aa0b85eea58e88344f7fe3c520
test -z "$(git -C "$TEAQL_CODEGEN_DIR" status --porcelain)"
- name: Install example verification tools
run: sudo apt-get update && sudo apt-get install -y ripgrep
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: maven
- name: Mark dedicated PostgreSQL diagnostics fixture
run: |
docker exec -i -u postgres '${{ job.services.postgres.id }}' \
psql -X -v ON_ERROR_STOP=1 -d teaql_rollup_279 <<'SQL'
COMMENT ON DATABASE teaql_rollup_279 IS 'TeaQL #279 owned layered statistics fixture';
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
SQL
- name: Prime third-party dependencies for offline source-paired probes
# The gate copies third-party downloads into a disposable Maven home
# and explicitly excludes every TeaQL/model artifact from that cache.
# Keep its offline checks; prepare a fresh runner before they start.
run: |
mvn -B -ntp install
# These standalone console dependencies are absent from generated
# library manifests and are used by the offline workspace checks.
for artifact in com.zaxxer:HikariCP:6.3.0 org.mybatis:mybatis:3.5.19 org.codehaus.mojo:exec-maven-plugin:3.5.0; do
mvn -B -ntp org.apache.maven.plugins:maven-dependency-plugin:3.8.1:get "-Dartifact=$artifact"
done
node <<'NODE'
const fs = require('node:fs'), path = require('node:path'), os = require('node:os'), cp = require('node:child_process');
const runtime = process.cwd(), owned = fs.mkdtempSync(path.join(os.tmpdir(), 'teaql-ci-example-dependencies-'));
try {
const poms = cp.execFileSync('git', ['ls-files', '-z', 'examples'], {encoding: 'utf8'})
.split('\0').filter(name => name.endsWith('/lib/pom.xml'));
if (poms.length === 0) throw new Error('No generated library dependency manifests');
for (const relative of poms) {
const selected = path.join(owned, relative);
fs.mkdirSync(path.dirname(selected), {recursive: true});
fs.copyFileSync(path.join(runtime, relative), selected);
require('./scripts/pin-local-example-pom.cjs').pin(selected, runtime, owned);
cp.execFileSync('mvn', ['-B', '-ntp', '-f', selected,
'org.apache.maven.plugins:maven-dependency-plugin:3.8.1:go-offline'], {stdio: 'inherit'});
}
// Resolve the standalone console reactor's actual mediated runtime
// dependencies. Dependency go-offline alone visits a different
// Netty version through this workspace's Spring/AWS dependency graph.
const attachmentSource = path.join(runtime, 'examples/object-storage');
const attachment = path.join(owned, 'order-attachment-workspace');
fs.mkdirSync(attachment);
fs.copyFileSync(path.join(attachmentSource, 'workspace-pom.xml'), path.join(attachment, 'pom.xml'));
for (const role of ['java-lib-core', 'java-app-console']) {
fs.cpSync(path.join(attachmentSource, role), path.join(attachment, role), {
recursive: true, filter: file => path.basename(file) !== 'target',
});
}
cp.execFileSync('mvn', ['-B', '-ntp', '-f', path.join(attachment, 'pom.xml'),
'-DskipTests', 'install'], {stdio: 'inherit'});
} finally {
fs.rmSync(owned, {recursive: true});
}
NODE
# This job created every reactor target above. Retain dependency
# downloads, but return the ephemeral CI checkout to the target-free
# input required by source-paired inheritance verification.
mvn -B -ntp clean
- name: Start dedicated S3 example fixture
run: |
docker run -d --name teaql-java-example-s3 \
-p 127.0.0.1:19010:9000 \
-e RUSTFS_ACCESS_KEY="$TEAQL_S3_ACCESS_KEY" \
-e RUSTFS_SECRET_KEY="$TEAQL_S3_SECRET_KEY" \
-e RUSTFS_CONSOLE_ENABLE=false \
rustfs/rustfs@sha256:41fe89380f4120a337790c02af192c3fe7bb55c3edc2e6e9357b487b47c6ab21 /data
for attempt in {1..30}; do
if curl -sS -o /dev/null --max-time 2 "$TEAQL_S3_ENDPOINT/"; then
exit 0
fi
if [[ "$(docker inspect --format '{{.State.Running}}' teaql-java-example-s3)" != true ]]; then
docker logs teaql-java-example-s3
exit 1
fi
sleep 1
done
docker logs teaql-java-example-s3
exit 1
- run: ./scripts/verify-examples.sh
- name: Stop dedicated S3 example fixture
if: always()
run: docker rm -f teaql-java-example-s3 || true