Skip to content

Commit 55fa19e

Browse files
authored
Updated manual CI test-flows
1 parent f430678 commit 55fa19e

File tree

5 files changed

+102
-46
lines changed

5 files changed

+102
-46
lines changed

.github/actions/build-and-test/action.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ inputs:
66
description: "Crypto type to use. This should either be bouncycastle or gnu"
77
required: false
88
default: gnu
9-
use-server-rc:
10-
required: false
11-
default: "false"
12-
description: "Test against server release candidate?"
139
server-tag:
1410
required: false
1511
default: "latest"
@@ -48,7 +44,6 @@ runs:
4844
if: ${{ inputs.run-tests == 'true' }}
4945
uses: ./.github/actions/run-ee-server
5046
with:
51-
use-server-rc: ${{ inputs.use-server-rc }}
5247
server-tag: ${{ inputs.server-tag }}
5348
server-type: ${{ inputs.server-type }}
5449
oidc-provider: ${{ inputs.oidc-provider }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Make Matrix from JSON or File
2+
description: Builds a matrix array from a repo file (if present) or default JSON string.
3+
4+
inputs:
5+
default_json:
6+
description: JSON string used if file is missing/empty (e.g. org/environment variable).
7+
required: true
8+
test_servers_file_path:
9+
description: Repo-relative path to JSON file to prefer when present (e.g. server matrix file).
10+
required: false
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- id: build
16+
shell: bash
17+
env:
18+
DEFAULT_JSON: ${{ inputs.default_json }}
19+
TEST_SERVERS_FILE_PATH: ${{ inputs.test_servers_file_path }}
20+
run: |
21+
set -euo pipefail
22+
23+
FILE="${TEST_SERVERS_FILE_PATH:-}"
24+
25+
if [[ -n "${FILE}" && -s "${FILE}" ]]; then
26+
echo "Using ${FILE} from repository"
27+
JSON="$(cat "${FILE}")"
28+
else
29+
echo "${FILE:-<unset>} missing or empty – using default_json input"
30+
JSON="${DEFAULT_JSON}"
31+
fi
32+
33+
# Validate JSON early to give a clear error
34+
echo "${JSON}" | jq . >/dev/null
35+
36+
# Convert: { "stable": {...}, "release": {...} }
37+
MATRIX="$(echo "${JSON}" | jq -c "[to_entries[] | { server: .key } + .value ]")"
38+
39+
# Safely write multi-line output
40+
{
41+
echo "input-matrix<<__JSON__"
42+
echo "${MATRIX}"
43+
echo "__JSON__"
44+
} >> "$GITHUB_OUTPUT"
45+
46+
outputs:
47+
input-matrix:
48+
description: Compact JSON array suitable for fromJson() (e.g. `[{"server":"stable",...}, ...]`)
49+
value: ${{ steps.build.outputs.input-matrix }}

.github/workflows/pull-request-open.yaml

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,18 @@ jobs:
2424
make-matrix:
2525
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
2626
outputs:
27-
input-matrix: ${{ steps.set.outputs.input-matrix }}
27+
input-matrix: ${{ steps.create-server-matrix.outputs.input-matrix }}
2828
java-version: ${{ steps.get-java-version.outputs.java-version }}
2929
steps:
3030
- uses: actions/checkout@v4 # brings versions.json into the workspace
3131
with:
3232
ref: ${{ github.ref }}
3333

34-
- id: set # create the matrix (compact JSON string)
35-
shell: bash
36-
env:
37-
DEFAULT_JSON: ${{ vars.DEFAULT_SERVER_VERSIONS }}
38-
TEST_SERVERS_FILE_PATH: ${{ vars.TEST_SERVERS_FILE_PATH }}
39-
run: |
40-
FILE=${TEST_SERVERS_FILE_PATH}
41-
42-
if [[ -s "$FILE" ]]; then
43-
echo "Using $FILE from repository"
44-
JSON=$(cat "$FILE")
45-
else
46-
echo "$FILE missing or empty – using DEFAULT_SERVER_VERSIONS"
47-
JSON="$DEFAULT_JSON"
48-
fi
49-
50-
MATRIX=$(echo "$JSON" | jq -c '
51-
to_entries
52-
| map({
53-
server: .key,
54-
version: .value.version,
55-
type: .value.type,
56-
})
57-
')
58-
59-
echo input-matrix="$MATRIX" >> $GITHUB_OUTPUT
34+
- id: create-server-matrix
35+
uses: ./.github/actions/make-server-matrix
36+
with:
37+
default_json: ${{ vars.DEFAULT_SERVER_VERSIONS }}
38+
test_servers_file_path: ${{ vars.TEST_SERVERS_FILE_PATH }}
6039

6140
- name: Get java version
6241
id: get-java-version
@@ -66,7 +45,7 @@ jobs:
6645
- name: debug - print input variables
6746
run: |
6847
echo ${{ steps.get-java-version.outputs.java-version }}
69-
echo ${{ steps.set.outputs.input-matrix }}
48+
echo ${{ steps.create-server-matrix.outputs.input-matrix }}
7049
7150
build:
7251
uses: ./.github/workflows/build-pr.yaml

.github/workflows/test-branch-runner.yaml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,46 @@ on:
99
description: Branch to run test against
1010

1111
jobs:
12+
make-matrix:
13+
name: make input matrix
14+
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
15+
outputs:
16+
input-matrix: ${{ steps.create-server-matrix.outputs.input-matrix }}
17+
java-version: ${{ steps.get-java-version.outputs.java-version }}
18+
steps:
19+
- uses: actions/checkout@v4 # brings versions.json into the workspace
20+
with:
21+
ref: ${{ github.ref }}
22+
- id: create-server-matrix
23+
uses: ./.github/actions/make-server-matrix
24+
with:
25+
default_json: ${{ vars.DEFAULT_SERVER_VERSIONS }}
26+
test_servers_file_path: ${{ vars.TEST_SERVERS_FILE_PATH }}
27+
28+
- name: Get java version
29+
id: get-java-version
30+
run: |
31+
echo java-version="$(grep '<java.version>' pom.xml | sed -e 's/<[^>]*>//g' | awk '{$1=$1};1' | sed 's/^1\.8$/8/')" >> $GITHUB_OUTPUT
32+
33+
- name: debug - print input variables
34+
run: |
35+
echo ${{ steps.get-java-version.outputs.java-version }}
36+
echo ${{ steps.create-server-matrix.outputs.input-matrix }}
37+
1238
build-and-test:
1339
uses: ./.github/workflows/test-branch.yaml
40+
needs: make-matrix
1441
strategy:
1542
matrix:
43+
entry: ${{ fromJson(needs.make-matrix.outputs.input-matrix) }}
1644
crypto-type: [bouncycastle, gnu]
17-
use-server-rc: [true, false]
18-
fail-fast: false
45+
name: build-${{ matrix.entry.type }}-${{ matrix.entry.version }}
1946
with:
20-
source-branch: ${{ inputs.source-branch }}
47+
java-version: ${{ needs.make-matrix.outputs.java-version }}
2148
crypto-type: ${{ matrix.crypto-type }}
22-
use-server-rc: ${{ matrix.use-server-rc }}
23-
server-tag: latest
49+
source-branch: ${{ inputs.source-branch }}
50+
run-tests: true
51+
server-tag: ${{ matrix.entry.version }}
52+
server-type: ${{ matrix.entry.type }}
2453
secrets: inherit
54+

.github/workflows/test-branch.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@ on:
1212
crypto-type:
1313
type: string
1414
required: true
15-
use-server-rc:
15+
java-version:
16+
type: string
17+
required: true
18+
run-tests:
1619
type: boolean
1720
required: true
1821
server-tag:
1922
type: string
2023
required: true
24+
server-type:
25+
type: string
26+
required: true
2127
secrets:
2228
JFROG_OIDC_PROVIDER:
2329
required: true
@@ -26,6 +32,7 @@ on:
2632

2733
jobs:
2834
build:
35+
name: '${{ inputs.crypto-type }} build ${{inputs.source-branch}} using java-version ${{ inputs.java-version }} on ${{ inputs.server-type}}:${{ inputs.server-tag }}'
2936
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
3037
steps:
3138
- name: Checkout code
@@ -34,25 +41,21 @@ jobs:
3441
fetch-depth: 0
3542
ref: ${{ inputs.source-branch }}
3643

37-
- name: Get java version
38-
id: get-java-version
39-
run: |
40-
echo java-version="$(grep '<java.version>' pom.xml | sed -e 's/<[^>]*>//g' | awk '{$1=$1};1' | sed 's/^1\.8$/8/')" >> $GITHUB_OUTPUT
41-
4244
# Java plugin will setup gpg but we are not using maven to deploy do JFrog.
4345
# - jf mvn clean install on publish does not publish POM we would like to publish
4446
- name: Setup Java
4547
uses: actions/setup-java@v4
4648
with:
4749
distribution: "semeru"
48-
java-version: ${{ steps.get-java-version.outputs.java-version }}
50+
java-version: ${{ inputs.java-version }}
4951

5052
# Running build followed by tests
5153
- name: Build and test
5254
uses: ./.github/actions/build-and-test
5355
with:
5456
crypto-type: ${{ inputs.crypto-type }}
5557
server-tag: ${{ inputs.server-tag }}
56-
use-server-rc: ${{ inputs.use-server-rc }}
58+
server-type: ${{ inputs.server-type }}
59+
run-tests: ${{ inputs.run-tests }}
5760
oidc-provider: ${{ secrets.JFROG_OIDC_PROVIDER }}
5861
oidc-audience: ${{ secrets.JFROG_OIDC_AUDIENCE }}

0 commit comments

Comments
 (0)