-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (72 loc) · 3 KB
/
Copy pathci-build.yml
File metadata and controls
76 lines (72 loc) · 3 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
name: Build
on:
workflow_call:
inputs:
should_skip:
description: "Whether to skip the workflow"
required: false
type: string
default: "false"
server_changed:
description: "Whether anything that runs the built server changed"
required: false
type: string
default: "true"
outputs:
server-artifact:
description: "Name of the artifact holding the packaged reactor"
value: ${{ jobs.server-package.outputs.artifact }}
permissions: {}
env:
SERVER_BUILD_ARTIFACT: server-build-${{ github.run_id }}
jobs:
# Compiles and packages the reactor exactly once; every server test tier, the browser E2E suite,
# the API and database contracts and the application image consume this artifact. This workflow
# holds nothing else: a caller's `needs` waits for the whole workflow, so anything added here
# delays every consumer.
server-package:
name: "App Server: Package"
if: inputs.should_skip != 'true' && inputs.server_changed == 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
outputs:
artifact: ${{ env.SERVER_BUILD_ARTIFACT }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-caches
with:
cache-type: application-server-reactor
os: ${{ runner.os }}
- name: Package the reactor
working-directory: server
run: ./mvnw -pl application -am package -DskipTests --batch-mode
- name: Validate the packaged reactor
working-directory: server
run: |
set -euo pipefail
test -d application/target/classes
test -d application/target/test-classes
mapfile -t jars < <(find application/target -maxdepth 1 -name 'hephaestus-application-*.jar' ! -name '*-sources.jar' ! -name '*-javadoc.jar')
mapfile -t clients < <(find generated-clients/target -maxdepth 1 -name 'hephaestus-generated-clients-*.jar' ! -name '*-sources.jar' ! -name '*-javadoc.jar')
(( ${#jars[@]} == 1 )) && (( ${#clients[@]} == 1 ))
unzip -p "${jars[0]}" META-INF/MANIFEST.MF | grep -q '^Main-Class: org.springframework.boot.loader'
- name: Upload the packaged reactor
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.SERVER_BUILD_ARTIFACT }}
path: |
server/application/target/classes
server/application/target/test-classes
server/application/target/hephaestus-application-*.jar
server/generated-clients/target/hephaestus-generated-clients-*.jar
!server/**/*-sources.jar
!server/**/*-javadoc.jar
if-no-files-found: error
retention-days: 1
compression-level: 0
# A re-run of failed jobs keeps this artifact; a re-run of all jobs replaces it.
overwrite: true