Skip to content

Build

Build #971

Workflow file for this run

name: Build
on:
schedule:
- cron: '0 18 * * *'
workflow_dispatch:
inputs:
release:
description: 'Set to True if are running a release'
required: true
type: boolean
default: false
releaseTag:
description: 'Set the release tag'
required: true
default: '9.1.0-SNAPSHOT'
checkoutRef:
description: 'JMC Checkout reference'
required: true
default: 'master'
version:
description: 'If running a release, set the version e.g (9.1.0-SNAPSHOT)'
required: true
default: '9.1.0-SNAPSHOT'
agentVersion:
description: 'If running a release, set the agent version e.g (1.0.1-SNAPSHOT)'
required: true
default: '1.0.1-SNAPSHOT'
permissions:
contents: write
jobs:
release:
name: Update release
runs-on: ubuntu-latest
outputs:
release: ${{ github.event.inputs.release || true }}
releaseTag: ${{ github.event.inputs.releaseTag || '9.1.0-SNAPSHOT' }}
checkoutRef: ${{ github.event.inputs.checkoutRef || 'master' }}
version: ${{ github.event.inputs.version || '9.1.0-SNAPSHOT' }}
agentVersion: ${{ github.event.inputs.agentVersion || '1.0.1-SNAPSHOT' }}
steps:
- name: info
run: echo Initialize outputs...
build:
if: always()
needs: release
name: Build
runs-on: ubuntu-latest
env:
MAVEN_OPTS: -Xmx2048m -Declipse.p2.mirrors=false
steps:
- name: Checkout JMC
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: openjdk/jmc
ref: ${{ needs.release.outputs.checkoutRef }}
- name: Create release.txt
run: git rev-parse HEAD > release-${{ needs.release.outputs.version }}.txt
- name: Checkout JMC Overrides
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: workspace
- name: Create .m2/settings.xml
run: |
mkdir .m2
cp workspace/.github/workflows/settings.xml .m2/settings.xml
- name: Apply overrides
run: cp workspace/overrides/* . -rvf
- name: Change to final version
if: ${{ ! endsWith(needs.release.outputs.version, '-SNAPSHOT') }}
run: |
find . ! -path "*/.git/**" -type f -name "pom.xml" -exec sed -i s/"${{ needs.release.outputs.version }}-SNAPSHOT"/"${{ needs.release.outputs.version }}"/ {} \;
find . ! -path "*/.git/**" -type f \( -name "feature.xml" -o -name "MANIFEST.MF" \) -exec sed -i s/"${{ needs.release.outputs.version }}.qualifier"/"${{ needs.release.outputs.version }}"/ {} \;
echo "MAVEN_OPTS=$MAVEN_OPTS -DskipNexusStagingDeployMojo=true -Dchangelist=" >> $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
java-version: 17
distribution: temurin
cache: 'maven'
mvn-toolchain-id: 'JavaSE-17'
- name: Set up JDK 21
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
java-version: 21
distribution: temurin
cache: 'maven'
mvn-toolchain-id: 'JavaSE-21'
# Manually install Maven 3.9.9 because ubuntu-latest image uses Maven 3.8.8 by default
# https://github.com/actions/setup-java/issues/685#issuecomment-2354724977
- name: Install latest Maven
run: |
MAVEN_VERSION=3.9.9
wget https://downloads.apache.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz
tar xzvf apache-maven-$MAVEN_VERSION-bin.tar.gz
sudo mv apache-maven-$MAVEN_VERSION /opt/maven
sudo rm -f /usr/bin/mvn # Remove existing symbolic link if it exists
sudo ln -s /opt/maven/bin/mvn /usr/bin/mvn # Create new symbolic link
- name: Build & test core libraries
run: |
mvn install
working-directory: core
- name: Deploy core libraries
if: needs.release.outputs.release
run: |
mvn deploy --settings $GITHUB_WORKSPACE/.m2/settings.xml -Dpublish.user=$USERNAME -Dpublish.password=$PASSWORD -Drelease.repo=https://adoptium.jfrog.io/artifactory/jmc-libs -Dsnapshot.repo=https://adoptium.jfrog.io/artifactory/jmc-libs-snapshots -Dgpg.skip=true -DskipTests=true
env:
USERNAME: ${{ secrets.ARTIFACTORY_USER }}
PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
working-directory: core
- name: Build & test agent
run: |
mvn verify
mvn install
working-directory: agent
- name: Deploy agent libraries
if: needs.release.outputs.release
run: |
mvn deploy --settings $GITHUB_WORKSPACE/.m2/settings.xml -Dpublish.user=$USERNAME -Dpublish.password=$PASSWORD -Drelease.repo=https://adoptium.jfrog.io/artifactory/jmc-libs -Dsnapshot.repo=https://adoptium.jfrog.io/artifactory/jmc-libs-snapshots -Dgpg.skip=true -DskipTests=true
env:
USERNAME: ${{ secrets.ARTIFACTORY_USER }}
PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
working-directory: agent
- name: Build & test
run: |
mvn clean
mvn p2:site
mvn jetty:run &
cd ../../
mvn verify
working-directory: releng/third-party
- name: Run UI Tests
# Ignore UI failures for now
continue-on-error: true
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 # v1.0.1
with:
run: mvn verify -P uitests
- name: Deploy update sites
if: needs.release.outputs.release
run: |
curl -X DELETE -u "$USERNAME:$PASSWORD" https://adoptium.jfrog.io/artifactory/jmc-snapshots/ide
find . -type f -exec curl -o /dev/null -s -u "$USERNAME:$PASSWORD" -T \'{}\' https://adoptium.jfrog.io/artifactory/jmc-snapshots/ide/\'{}\' \;
env:
USERNAME: ${{ secrets.ARTIFACTORY_USER }}
PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
working-directory: application/org.openjdk.jmc.updatesite.ide/target/repository
- if: needs.release.outputs.release
name: Delete old linux assets from ${{ needs.release.outputs.releaseTag }}
uses: mknejp/delete-release-assets@ea7ff12c30ef2589fe4311264f3a336d01325030 # v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.release.outputs.releaseTag }}
assets: |
release*
agent-*
org.openjdk.jmc.updatesite.ide-*
org.openjdk.jmc-*.x86_64.*
org.openjdk.jmc-*.aarch64.*
fail-if-no-assets: false
fail-if-no-release: false
- name: Deploy release assets
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v0.1.15
if: needs.release.outputs.release
with:
files: |
release-${{ needs.release.outputs.version }}.txt
agent/target/agent-${{ needs.release.outputs.agentVersion }}.jar
application/org.openjdk.jmc.updatesite.ide/target/org.openjdk.jmc.updatesite.ide-${{ needs.release.outputs.version }}.zip
target/products/org.openjdk.jmc-${{ needs.release.outputs.version }}-linux.gtk.x86_64.tar.gz
target/products/org.openjdk.jmc-${{ needs.release.outputs.version }}-linux.gtk.aarch64.tar.gz
target/products/org.openjdk.jmc-${{ needs.release.outputs.version }}-macosx.cocoa.x86_64.tar.gz
target/products/org.openjdk.jmc-${{ needs.release.outputs.version }}-macosx.cocoa.aarch64.tar.gz
target/products/org.openjdk.jmc-${{ needs.release.outputs.version }}-win32.win32.x86_64.zip
tag_name: ${{ needs.release.outputs.releaseTag }}
token: ${{ secrets.GITHUB_TOKEN }}