Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
ci: use default_jdk and major_jdk ('jdk' from stable.json) instead of…
Browse files Browse the repository at this point in the history
… '11' and '17'
  • Loading branch information
alanivey committed Nov 14, 2023
1 parent fb30ace commit 1427ed8
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/support/matrix/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@

# Initialization

# Default version of Java to use with builds unless specified
default_jdk = 11

# Initialize the full matrix dict
full_matrix={
'dhis2_version': [],
'java_major': ['11'],
'java_major': [str(default_jdk)],
'latest_major': [False],
'latest_overall': [False],
'include': [],
Expand Down Expand Up @@ -44,6 +47,8 @@

major_details = [i for i in stable_json['versions'] if i['name'] == dhis2_major][0]

major_jdk = major_details.get('jdk', default_jdk)

# List of all patch versions within a major release version
patch_versions = major_details['patchVersions']

Expand All @@ -60,13 +65,13 @@
# Add unique and sorted list to dhis2_versions dict
dhis2_versions[dhis2_major] = dhis2_major_versions_sorted

# Add dev version to list of builds; versions v41 and up require Java 17
# Add dev version to list of builds; versions v41 and up may require a newer version Java
if Version(dhis2_major) < Version('41'):
full_matrix['dhis2_version'].append(f"{dhis2_major}-dev")
else:
full_matrix['include'].append({
'dhis2_version': f"{dhis2_major}-dev",
'java_major': '17',
'java_major': major_jdk,
'latest_major': False,
'latest_overall': False,
})
Expand All @@ -77,14 +82,14 @@
# Start item with the same properties as the default builds
matrix_item = {
'dhis2_version': version,
'java_major': '11',
'java_major': str(default_jdk),
'latest_major': False,
'latest_overall': False,
}

# Major versions v41 and up require Java 17
if Version(dhis2_major) >= Version('41'):
matrix_item['java_major'] = '17'
# Use the specified version of Java if greater than the default
if major_jdk > default_jdk:
matrix_item['java_major'] = str(major_jdk)

# If the version is the latest within the major release...
if version == dhis2_major_versions_sorted[-1]:
Expand All @@ -102,14 +107,14 @@
# If the version is not the latest within the major release...
else:

if Version(dhis2_major) >= Version('41'):
# Add a v41+ release to the list of non-default builds
full_matrix['include'].append(matrix_item)

else:
if matrix_item['java_major'] == str(default_jdk):
# Add the release to the list of default builds
full_matrix['dhis2_version'].append(version)

else:
# Add newer Java release to the list of non-default builds
full_matrix['include'].append(matrix_item)

# # Include the dev release for the next major version as a Java 17 build
# # NOTE: Uncomment and/or edit logic once v41 builds are available
# dhis2_major_next = f"{Version(dhis2_majors_sorted[-1]).major+1}"
Expand Down

0 comments on commit 1427ed8

Please sign in to comment.