Repository navigation
91 lines (82 loc) · 3.11 KB
/
Copy pathci.yml
File metadata and controls
91 lines (82 loc) · 3.11 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
name: CI
on:
push:
branches: [ main ]
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
env:
BQ_REDIS_URL: redis://localhost:6379
# Fail (not skip) the live Redis conformance cases when Redis is unreachable.
BQ_REQUIRE_REDIS: "1"
BQ_CONFORMANCE_VERSION: 1.6.0
strategy:
fail-fast: false
matrix:
java: [ "17", "21" ]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: maven
# `verify` runs the JUnit 5 suite and the JaCoCo >=90% line-coverage gate. The unit
# tests mock the Redis command seam; the conformance suite's redis_layout behavioural
# cases (Lua scripts, :processing sweep, delayed window) run against the redis:7
# service container above, and BQ_REQUIRE_REDIS makes an unreachable Redis a failure.
- name: Test
run: mvn -B --no-transfer-progress verify
env:
# The conformance runner writes results.json (ADR-0032) when this is set.
BQ_CONFORMANCE_RESULTS: ${{ runner.temp }}/results.json
- uses: actions/setup-python@v6
with:
python-version: "3.12"
# Schema-valid, no `fail` and no `skip` (BQ_REQUIRE_REDIS=1 above, so every behavioural case
# really ran against Redis), and every redis-scope section and case present.
- name: Validate results.json
run: |
python -m pip install --quiet jsonschema==4.23.0
python -I .github/scripts/check-conformance-results.py "$RUNNER_TEMP/results.json" \
src/test/resources/conformance "$BQ_CONFORMANCE_VERSION"
conformance:
name: Conformance suite in sync
runs-on: ubuntu-latest
env:
BQ_CONFORMANCE_VERSION: 1.6.0
# Integrity pin for fetch.sh (sha256 of conformance/fetch.sh at the pinned tag).
BQ_FETCH_SH_SHA256: 8bb6ba567b288fb0ac71a70fd17041b2503df119e01998d76fdad372570bf849
steps:
- uses: actions/checkout@v5
- name: Verify vendored conformance matches the pinned release asset
run: |
curl --fail --silent --show-error --location --output "$RUNNER_TEMP/fetch.sh" \
"https://raw.githubusercontent.com/BabelQueue/conformance/v${BQ_CONFORMANCE_VERSION}/fetch.sh"
echo "${BQ_FETCH_SH_SHA256} $RUNNER_TEMP/fetch.sh" | sha256sum -c -
bash "$RUNNER_TEMP/fetch.sh" --check "$BQ_CONFORMANCE_VERSION" "src/test/resources/conformance"
ci-green:
name: CI green
runs-on: ubuntu-latest
needs: [test, conformance]
if: ${{ always() }}
steps:
- name: Fail if any required job did not pass
run: |
if ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}; then
echo "A required job failed or was cancelled."
exit 1
fi