-
Notifications
You must be signed in to change notification settings - Fork 3
139 lines (124 loc) · 4.17 KB
/
build-all-template.yml
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
#SPDX-FileCopyrightText: 2017-2024 Enedis
#SPDX-License-Identifier: Apache-2.0
name: "Build all template"
on:
workflow_call:
inputs:
skipTests:
default: false
type: boolean
description: "Skip tests if true"
release:
default: false
type: boolean
description: "Release if true"
cache-artifacts:
default: ""
type: string
description: "path of artifacts to be cached"
server-id:
type: string
default: github
description: "DistributionManagement repository id"
secrets:
gpg-private-key:
description: "Chutney gpg private key"
required: false
gpg-passphrase:
description: "Chutney gpg passphrase"
required: false
gpg-key-id:
description: "Chutney gpg key id"
required: false
maven-username:
description: "MAVEN_USERNAME secret"
required: false
maven-password:
description: "MAVEN_PASSWORD secret"
required: false
github-token:
description: "GITHUB_TOKEN secret"
required: false
codecov-token:
description: "CODECOV_TOKEN secret"
required: false
outputs:
PROJECT_VERSION:
description: "Chutney Version"
value: ${{ jobs.all.outputs.PROJECT_VERSION }}
defaults:
run:
working-directory: .
jobs:
all:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'maven'
server-id: ${{inputs.server-id}}
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.gpg-private-key }}
gpg-passphrase: CHUTNEY_GPG_PASSPHRASE
- uses: actions/checkout@v4
- name: Retrieve chutney version from pom.xml
id: get-version
run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT && cd ..
- name: Resolve chutney maven goal from inputs
id: chutney-goals
run: |
skipTestArg=""
mvnGoals="clean install"
if ${{ inputs.skipTests }}; then
skipTestArg="-DskipTests"
fi
if ${{ inputs.release }}; then
mvnGoals="deploy -P ${{inputs.server-id}}"
skipTestArg="-DskipTests"
fi
echo "CHUTNEY_GOALS=$mvnGoals $skipTestArg -V -B" >> $GITHUB_OUTPUT
- name: Build Chutney
id: build-chutney
uses: ./.github/actions/build-chutney
env:
MAVEN_USERNAME: ${{secrets.maven-username}}
MAVEN_PASSWORD: ${{secrets.maven-password}}
CHUTNEY_GPG_PASSPHRASE: ${{ secrets.gpg-passphrase }}
with:
goals: ${{steps.chutney-goals.outputs.CHUTNEY_GOALS}}
cache-artifacts: ${{ inputs.cache-artifacts }}
codecov-token: ${{ secrets.codecov-token }}
- name: Install api-insecure
shell: bash
run: |
mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file \
-Dfile=./chutney/packaging/local-api-unsecure/target/local-api-unsecure-${{steps.get-version.outputs.PROJECT_VERSION}}.jar \
-DgroupId=com.chutneytesting \
-DartifactId=local-api-unsecure \
-Dversion=${{steps.get-version.outputs.PROJECT_VERSION}} \
-Dpackaging=jar
- name: Resolve plugin gradle goal from inputs
if: ${{! inputs.release}}
id: plugin-goals
run: |
skipTestArg=""
if ${{ inputs.skipTests }}; then
skipTestArg="-x test"
fi
echo "PLUGIN_GOALS=clean buildPlugin $skipTestArg" >> $GITHUB_OUTPUT
- name: Build Plugin
if: ${{! inputs.release}}
uses: ./.github/actions/build-plugin
with:
goals: ${{steps.plugin-goals.outputs.PLUGIN_GOALS}}
cache-artifacts: ${{ inputs.cache-artifacts }}
outputs:
PROJECT_VERSION: ${{ steps.get-version.outputs.PROJECT_VERSION }}