-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (58 loc) · 2.23 KB
/
Copy pathci-java.yml
File metadata and controls
65 lines (58 loc) · 2.23 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
name: Reusable Java CI
on:
workflow_call:
inputs:
java-version:
description: 'JDK version to use'
type: string
default: '21'
pom-file:
description: 'Path to the POM file (relative to repo root)'
type: string
required: true
extra-steps:
description: 'Whether to run extra steps after verify (e.g. multi-module install+compile)'
type: boolean
default: false
extra-pom-install:
description: 'POM path for mvn install -DskipTests (multi-module repos)'
type: string
default: ''
extra-pom-compile:
description: 'POM path for mvn compile (multi-module repos, e.g. demo module)'
type: string
default: ''
maven-args:
description: 'Extra arguments to pass to mvn verify (e.g. test exclusions)'
type: string
default: ''
# Reusable workflows can only request permissions the *caller* has granted.
# `read-all` here breaks any caller that scopes permissions narrower than
# read-all (e.g. cycles-server's ci.yml grants only `contents: read`), causing
# `startup_failure` with: "workflow is requesting ... but is only allowed ...".
# Match the caller-friendly pattern: declare only what we actually need.
permissions:
contents: read
jobs:
test:
name: Build & Test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up JDK ${{ inputs.java-version }}
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5
with:
distribution: temurin
java-version: ${{ inputs.java-version }}
cache: maven
- name: Run tests and verify coverage
run: mvn -B verify --file ${{ inputs.pom-file }} ${{ inputs.maven-args }}
- name: Install to local repo (multi-module)
if: ${{ inputs.extra-steps && inputs.extra-pom-install != '' }}
run: mvn -B install -DskipTests --file ${{ inputs.extra-pom-install }}
- name: Compile extra module
if: ${{ inputs.extra-steps && inputs.extra-pom-compile != '' }}
run: mvn -B compile --file ${{ inputs.extra-pom-compile }}