forked from gorbadil/LibraryAppSpringBoot
-
Notifications
You must be signed in to change notification settings - Fork 5
88 lines (73 loc) · 2.53 KB
/
Copy pathci.yml
File metadata and controls
88 lines (73 loc) · 2.53 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
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
verify:
runs-on: ubuntu-24.04
timeout-minutes: 15
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: library_app
POSTGRES_PASSWORD: local-ci-password
POSTGRES_DB: library-app
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U library_app -d library-app"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
DBURL: localhost:5432
DBNAME: library-app
DBUSERNAME: library_app
DBPASSWORD: local-ci-password
steps:
- name: Check out fork
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Set up Java 17
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5
with:
distribution: temurin
java-version: "17"
cache: maven
- name: Test and package
run: ./mvnw --batch-mode --no-transfer-progress verify
- name: Validate API proof asset
run: |
test -s docs/library-api-error-proof.jpg
python3 - <<'PY'
from pathlib import Path
proof = Path("docs/library-api-error-proof.jpg").read_bytes()
assert proof[:2] == b"\xff\xd8", "proof asset is not a JPEG"
offset = 2
dimensions = None
start_of_frame = {0xC0, 0xC1, 0xC2, 0xC3, 0xC5, 0xC6, 0xC7, 0xC9, 0xCA, 0xCB, 0xCD, 0xCE, 0xCF}
while offset < len(proof):
assert proof[offset] == 0xFF, "invalid JPEG marker"
marker = proof[offset + 1]
offset += 2
if marker in {0xD8, 0xD9}:
continue
length = int.from_bytes(proof[offset:offset + 2], "big")
if marker in start_of_frame:
height = int.from_bytes(proof[offset + 3:offset + 5], "big")
width = int.from_bytes(proof[offset + 5:offset + 7], "big")
dimensions = (width, height)
break
offset += length
assert dimensions == (1280, 720), "proof asset must be 1280x720"
PY
- name: Validate Compose contract
run: docker compose --env-file .env.example config --quiet
- name: Build Java 17 container
run: docker build --tag library-app-spring-boot:ci .