Skip to content

Commit

Permalink
ISPN-14584 Merge infinispan-quarkus into main Infinispan repository
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanemerson committed Mar 14, 2023
1 parent ff460de commit 45887ba
Show file tree
Hide file tree
Showing 83 changed files with 5,706 additions and 2 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/release_native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Release Native Binaries

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest

outputs:
upload_url: ${{ steps.release.outputs.upload_url }}

steps:
- name: Checkout Source
uses: actions/checkout@v2

- id: release
name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{github.ref_name}}
release_name: ${{github.ref_name}}

build:
needs: release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2022]
include:
- os: ubuntu-latest
asset_name: linux-amd64
gu_binary: gu
- os: macos-latest
asset_name: darwin-amd64
gu_binary: gu
- os: windows-2022
asset_name: windows-amd64
gu_binary: gu.cmd
steps:
- uses: actions/checkout@v2

- if: ${{ matrix.os == 'windows-2022' }}
name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2

- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.0'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout Release Tag
uses: actions/checkout@v2

- if: ${{ matrix.os == 'windows-2022' }}
name: Build native executable
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
mvnw.cmd package -s maven-settings.xml -Pdistribution -Pwindows -Pnative -am -pl cli
shell: cmd

- if: ${{ matrix.os != 'windows-2022' }}
name: Build native executable
run: ./mvnw package -s maven-settings.xml -Pdistribution -Pnative -am -pl cli

- name: Upload CLI native executable
id: upload-cli-native-executable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./cli/target/infinispan-cli-${{github.ref_name}}.zip
asset_name: infinispan-cli-${{github.ref_name}}-${{ matrix.asset_name }}.zip
asset_content_type: application/zip
44 changes: 42 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pipeline {
env.MAVEN_HOME = tool('Maven')
env.MAVEN_OPTS = "-Xmx1g -XX:+HeapDumpOnOutOfMemoryError"
env.JAVA_HOME = tool('JDK 17')
env.GRAALVM_HOME = tool('GraalVM 20')
}

// ISPN-9703 Ensure distribution build works on non-prs
Expand All @@ -50,7 +51,7 @@ pipeline {
stage('Build') {
steps {
configFileProvider([configFile(fileId: 'maven-settings-with-deploy-snapshot', variable: 'MAVEN_SETTINGS')]) {
sh "$MAVEN_HOME/bin/mvn clean install $REPORTS_BUILD -B -V -e -s $MAVEN_SETTINGS -DskipTests $DISTRIBUTION_BUILD"
sh "$MAVEN_HOME/bin/mvn clean install $REPORTS_BUILD -B -V -e -s $MAVEN_SETTINGS -DskipTests -Pnative $DISTRIBUTION_BUILD"
}
}
}
Expand Down Expand Up @@ -94,10 +95,49 @@ pipeline {
}
}

stage('Native Image') {
when {
expression {
return !env.BRANCH_NAME.startsWith("PR-") || pullRequest.labels.contains('Native Image Required')
}
}
steps {
script {
def mvnCmd = '-q -Dexec.executable=echo -Dexec.args=\'${project.version}\' --non-recursive exec:exec'
def SERVER_VERSION = sh(
script: "${MAVEN_HOME}/bin/mvn ${mvnCmd}",
returnStdout: true
).trim()
def REPO = 'quay.io/infinispan-test/server-native'
def TAG = env.BRANCH_NAME
def IMAGE_BRANCH = env.CHANGE_ID ? pullRequest.base : env.BRANCH_NAME

sh "rm -rf infinispan-images"
sh "git clone --single-branch --branch ${IMAGE_BRANCH} --depth 1 https://github.com/infinispan/infinispan-images.git"


dir('infinispan-images') {
sh "cekit -v --descriptor server-dev-native.yaml build --overrides '{\"name\":\"${REPO}\", \"version\":\"${TAG}\"}' --overrides '{\"artifacts\":[{\"name\":\"server\",\"path\":\"../quarkus/server-runner/target/infinispan-quarkus-server-runner-${SERVER_VERSION}-runner\"},{\"name\":\"cli\",\"path\":\"../quarkus/cli/target/infinispan-cli\"}]}' docker\n"

withDockerRegistry(credentialsId: 'Quay-InfinispanTest', url: 'https://quay.io') {
sh "docker push ${REPO}:${TAG}"
}
sh "docker rmi ${REPO}:${TAG}"
deleteDir()
}

// CHANGE_ID is set only for pull requests, so it is safe to access the pullRequest global variable
if (env.CHANGE_ID) {
pullRequest.comment("Image pushed for Jenkins build [#${env.BUILD_NUMBER}](${env.BUILD_URL}):\n```\n${REPO}:${TAG}\n```")
}
}
}
}

stage('Tests') {
steps {
configFileProvider([configFile(fileId: 'maven-settings-with-deploy-snapshot', variable: 'MAVEN_SETTINGS')]) {
sh "$MAVEN_HOME/bin/mvn verify -B -V -e -s $MAVEN_SETTINGS -Dmaven.test.failure.ignore=true -Dansi.strip=true"
sh "$MAVEN_HOME/bin/mvn verify -B -V -e -s $MAVEN_SETTINGS -Dmaven.test.failure.ignore=true -Dansi.strip=true -Pnative"
}
// TODO Add StabilityTestDataPublisher after https://issues.jenkins-ci.org/browse/JENKINS-42610 is fixed
// Capture target/surefire-reports/*.xml, target/failsafe-reports/*.xml,
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<module>cdi/remote-jakarta</module>
<module>lock</module>
<module>jcache</module>
<module>quarkus</module>
<module>wildfly/feature-pack</module>
<module>integrationtests</module>
<module>integrationtests/endpoints-interop-it</module>
Expand Down
12 changes: 12 additions & 0 deletions quarkus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# How to build native

1. Download and extract the Java 17 version of GraalVM (>= 22.3) from
https://github.com/graalvm/graalvm-ce-builds/releases
for your distribution.
2. Install `native-image` in the `bin` directory of the extracted graal
runtime
* `gu install native-image`
3. Set the `GRAALVM_HOME` environment variable to the extracted
graal runtime
4. Build the project
* `mvn clean install -P native -am -pl quarkus`

0 comments on commit 45887ba

Please sign in to comment.