Rebase PR#519 to v3 #463
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: linux_build | |
on: | |
push: | |
branches: | |
- master | |
- papyrus | |
- streams/v* | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
- papyrus | |
- streams/v* | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Install Java 8 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' # rebranded adopt OpenJDK. | |
java-version: '8' | |
mvn-toolchain-id: 'JavaSE-1.8' | |
- name: Install Java 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' # rebranded adopt OpenJDK. | |
java-version: '11' | |
mvn-toolchain-id: 'JavaSE-11' | |
- name: Install Java 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' # rebranded adopt OpenJDK. | |
java-version: '17' | |
mvn-toolchain-id: 'JavaSE-17' | |
- name: List toolchains.xml | |
run: | | |
echo "==== .m2/toolchains.xml ====" | |
if [ -f /home/runner/.m2/toolchains.xml ]; then | |
cat /home/runner/.m2/toolchains.xml | |
else | |
echo "File doesn't exist" | |
fi | |
echo "==== .m2/settings.xml ====" | |
if [ -f /home/runner/.m2/settings.xml ]; then | |
cat /home/runner/.m2/settings.xml | |
else | |
echo "File doesn't exist" | |
fi | |
- name: Install RPM | |
run: | | |
sudo apt-get update && sudo apt-get -y install rpm | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Set Variables | |
id: variables | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.info('context.sha = ' + context.sha) | |
core.info('context.ref = ' + context.ref) | |
core.info('context.eventName = ' + context.eventName) | |
const variable_defs = {} | |
const TAG_PREFIX = 'refs/tags/' | |
const short_sha = context.sha.substring(0, 7) | |
let tag = short_sha | |
if( context.ref.startsWith(TAG_PREFIX) ) { | |
tag = context.ref.replace(TAG_PREFIX, '') | |
// sanitize tag for RPM | |
// replaceAll is not available... | |
// tag = tag.replaceAll('-','_') | |
while(tag.includes('-')) { | |
tag = tag.replace('-','_') | |
} | |
} | |
variable_defs['RPM_TAG'] = tag | |
variable_defs['ARTIFACT_RETENTION_DAYS'] = 3 | |
for (const [var_name, value] of Object.entries(variable_defs)) { | |
core.exportVariable(var_name, value) | |
core.info(var_name + ' = ' + value) | |
} | |
- name: Build DDS4CBDDS | |
run: | | |
./mvnw clean verify | |
- name: Located Built archives | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const patterns = { | |
'ATCD': 'releng/com.zeligsoft.dds4ccm.update.atcd/target/dds4ccm_atcd_*.zip', | |
'AXCIOMA': 'releng/com.zeligsoft.dds4ccm.update.axcioma/target/dds4ccm_axcioma_*.zip', | |
'AXCIOMA_RCP': 'releng/com.zeligsoft.papyrus-cx.axcioma.rcp.product/target/products/papyrus-cx-axcioma-*.zip', | |
'DDK': 'releng/com.zeligsoft.ddk.update/target/ddk_*.zip', | |
'PAPYRUS_440_PATCH': 'papyrus-patch/v4.4.0/site-papyrus-patch/target/papyrus_v440_patch_*.zip', | |
'PAPYRUS_480_PATCH': 'papyrus-patch/v4.8.0/site-papyrus-patch/target/papyrus_v480_patch_*.zip' | |
} | |
const variable_defs = {} | |
for (const [var_base, pat] of Object.entries(patterns)) { | |
const globber = await glob.create(pat, {followSymbolicLinks: false}) | |
const files = await globber.glob() | |
if (files.length === 1) { | |
variable_defs[var_base + '_PRESENT'] = 'true' | |
variable_defs[var_base + '_PATH'] = files[0] | |
const path_parts = files[0].split('/') | |
variable_defs[var_base + '_FILE_NAME'] = path_parts[path_parts.length - 1] | |
const version_array = variable_defs[var_base + '_FILE_NAME'].match(/(\d+\.\d+\.\d+).v?(\d+)/) | |
if (version_array !== null && version_array.length === 3) { | |
variable_defs[var_base + '_FULL_VERSION'] = version_array[0] | |
variable_defs[var_base + '_UNQUALIFIED_VERSION'] = version_array[1] | |
variable_defs[var_base + '_BUILD_QUALIFIER'] = version_array[2] | |
} else { | |
variable_defs[var_base + '_FULL_VERSION'] = "unknown" | |
variable_defs[var_base + '_UNQUALIFIED_VERSION'] = "unknown" | |
variable_defs[var_base + '_BUILD_QUALIFIER'] = "unknown" | |
} | |
} else { | |
variable_defs[var_base + '_PRESENT'] = 'false' | |
} | |
} | |
for (const [var_name, value] of Object.entries(variable_defs)) { | |
core.exportVariable(var_name, value) | |
core.info(var_name + '=' + value) | |
} | |
- name: Build ATCD RPM | |
if: ${{ env.ATCD_PRESENT == 'true' }} | |
run: | | |
rpmbuild -ba --clean -vv \ | |
--define "_projectdir $GITHUB_WORKSPACE/releng/com.zeligsoft.dds4ccm.update.atcd" \ | |
--define "_git_tag $RPM_TAG" \ | |
releng/com.zeligsoft.dds4ccm.update.atcd/rpm_build/zeligsoftCX_atcd.spec | |
- name: Build AXCIOMA RPM | |
if: ${{ env.AXCIOMA_PRESENT == 'true' }} | |
run: | | |
rpmbuild -ba --clean -vv \ | |
--define "_projectdir $GITHUB_WORKSPACE/releng/com.zeligsoft.dds4ccm.update.axcioma" \ | |
--define "_git_tag $RPM_TAG" \ | |
releng/com.zeligsoft.dds4ccm.update.axcioma/rpm_build/zeligsoftCX_axcioma.spec | |
- name: Build AXCIOMA RCP RPM | |
if: ${{ env.AXCIOMA_RCP_PRESENT == 'true' }} | |
run: | | |
rpmbuild -ba --clean -vv \ | |
--define "_projectdir $GITHUB_WORKSPACE/releng/com.zeligsoft.papyrus-cx.axcioma.rcp.product" \ | |
--define "_git_tag $RPM_TAG" \ | |
--define "_full_version $AXCIOMA_RCP_FULL_VERSION" \ | |
--define "_unqualified_version $AXCIOMA_RCP_UNQUALIFIED_VERSION" \ | |
--define "_build_qualifier $AXCIOMA_RCP_BUILD_QUALIFIER" \ | |
releng/com.zeligsoft.papyrus-cx.axcioma.rcp.product/rpm_build/papyrus-cx-axcioma.spec | |
- name: Located Built RPMS | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const patterns = { | |
'ATCD_RPM': 'releng/com.zeligsoft.dds4ccm.update.atcd/rpm_build/noarch/*.rpm', | |
'AXCIOMA_RPM': 'releng/com.zeligsoft.dds4ccm.update.axcioma/rpm_build/noarch/*.rpm', | |
'AXCIOMA_RCP_RPM': 'releng/com.zeligsoft.papyrus-cx.axcioma.rcp.product/rpm_build/x86_64/*.rpm' | |
} | |
const variable_defs = {} | |
for (const [var_base, pat] of Object.entries(patterns)) { | |
const globber = await glob.create(pat, {followSymbolicLinks: false}) | |
const files = await globber.glob() | |
if (files.length === 1) { | |
variable_defs[var_base + '_PRESENT'] = 'true' | |
variable_defs[var_base + '_PATH'] = files[0] | |
const path_parts = files[0].split('/') | |
variable_defs[var_base + '_FILE_NAME'] = path_parts[path_parts.length - 1] | |
} else { | |
variable_defs[var_base + '_PRESENT'] = 'false' | |
} | |
} | |
for (const [var_name, value] of Object.entries(variable_defs)) { | |
core.exportVariable(var_name, value) | |
core.info(var_name + '=' + value) | |
} | |
- name: Preserve ATCD Archive | |
if: ${{ env.ATCD_PRESENT == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ATCD_FILE_NAME }} | |
path: ${{ env.ATCD_PATH }} | |
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | |
- name: Preserve AXCIOMA archive | |
if: ${{ env.AXCIOMA_PRESENT == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.AXCIOMA_FILE_NAME }} | |
path: ${{ env.AXCIOMA_PATH }} | |
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | |
- name: Preserve AXCIOMA RCP archive | |
if: ${{ env.AXCIOMA_RCP_PRESENT == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.AXCIOMA_RCP_FILE_NAME }} | |
path: ${{ env.AXCIOMA_RCP_PATH }} | |
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | |
- name: Preserve DDK archive | |
if: ${{ env.DDK_PRESENT == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.DDK_FILE_NAME }} | |
path: ${{ env.DDK_PATH }} | |
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | |
- name: Preserve PAPYRUS_440_PATCH archive | |
if: ${{ env.PAPYRUS_440_PATCH_PRESENT == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PAPYRUS_440_PATCH_FILE_NAME }} | |
path: ${{ env.PAPYRUS_440_PATCH_PATH }} | |
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | |
- name: Preserve PAPYRUS_480_PATCH archive | |
if: ${{ env.PAPYRUS_480_PATCH_PRESENT == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PAPYRUS_480_PATCH_FILE_NAME }} | |
path: ${{ env.PAPYRUS_480_PATCH_PATH }} | |
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | |
- name: Preserve ATCD RPM | |
if: ${{ env.ATCD_RPM_PRESENT == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ATCD_RPM_FILE_NAME }} | |
path: ${{ env.ATCD_RPM_PATH }} | |
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | |
- name: Preserve AXCIOMA_RPM | |
if: ${{ env.AXCIOMA_RPM_PRESENT == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.AXCIOMA_RPM_FILE_NAME }} | |
path: ${{ env.AXCIOMA_RPM_PATH }} | |
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | |
- name: Preserve AXCIOMA_RCP_RPM | |
if: ${{ env.AXCIOMA_RCP_RPM_PRESENT == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.AXCIOMA_RCP_RPM_FILE_NAME }} | |
path: ${{ env.AXCIOMA_RCP_RPM_PATH }} | |
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: github.event_name == 'release' | |
with: | |
files: | | |
releng/com.zeligsoft.dds4ccm.update.axcioma/target/dds4ccm_axcioma_*.zip | |
releng/com.zeligsoft.ddk.update/target/ddk_*.zip | |
releng/com.zeligsoft.dds4ccm.update.axcioma/rpm_build/noarch/*.rpm | |
releng/com.zeligsoft.papyrus-cx.axcioma.rcp.product/target/products/com.zeligsoft.papyrus-cx.axcioma.rcp.product-*.zip | |
releng/com.zeligsoft.papyrus-cx.axcioma.rcp.product/rpm_build/x86_64/*.rpm | |
papyrus-patch/v4.4.0/site-papyrus-patch/target/papyrus_v440_patch_*.zip | |
papyrus-patch/v4.8.0/site-papyrus-patch/target/papyrus_v480_patch_*.zip |