Skip to content

Build

Build #897

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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
java-version: 17
distribution: temurin
cache: 'maven'
mvn-toolchain-id: 'JavaSE-17'
- name: Build & test core libraries
run: |
mvn verify
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
run: |
mvn clean
mvn p2:site
mvn jetty:run &
cd ../../
mvn package
working-directory: releng/third-party
- name: Run Unit Tests
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 # v1.0.1
with:
run: mvn verify
- 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@c062e08bd532815e2082a85e87e3ef29c3e6d191 # 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 }}