Skip to content

kie-issues#850: Move Publish jitexecutor native workflow from KIE Tools #3

kie-issues#850: Move Publish jitexecutor native workflow from KIE Tools

kie-issues#850: Move Publish jitexecutor native workflow from KIE Tools #3

name: "Publish jitexecutor-native"
on:
schedule:
- cron: '0 16 * * 0' # Every sunday at 4:00PM
workflow_dispatch:
inputs:
kogito_runtime_version:
description: "Kogito Runtime version"
required: true
pull_request:
paths:
- ".github/supporting-files/publish-jitexecutor-native"
- ".github/workflows/publish-jitexecutor-native.yml"
env:
KOGITO_RUNTIME_VERSION: ${{ github.event.inputs.kogito_runtime_version || '999-YYYYMMDD' }}
jobs:
build_jitexecutor_native_binaries:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Get current date
id: date
run: echo "::set-output name=current_date::$(date +'%Y%m%d')"
shell: bash
- name: Set version
id: version
run: |
version="$(echo '${{ env.KOGITO_RUNTIME_VERSION }}' | sed 's/YYYYMMDD/${{ steps.date.outputs.current_date }}/g')"
echo "::set-output name=version::$version"
shell: bash
- name: "Set long paths for Windows"
if: runner.os == 'Windows'
run: git config --system core.longpaths true
- name: "Checkout kie-kogito-apps"
uses: actions/checkout@v3
with:
repository: apache/incubator-kie-kogito-apps
ref: ${{ steps.version.outputs.version }}
- name: "Set up Maven"
uses: stCarolas/setup-maven@v4.5
with:
maven-version: 3.8.6
- name: "Set up JDK 11"
if: runner.os != 'Windows'
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "zulu"
- name: "Build macOS"
if: runner.os == 'macOS'
run: |
brew install make && \
wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java11-darwin-amd64-22.3.0.tar.gz && \
tar -xzf graalvm-ce-java11-darwin-amd64-22.3.0.tar.gz && \
sudo mv graalvm-ce-java11-22.3.0 /Library/Java/JavaVirtualMachines/graalvm-ce-java11-darwin-amd64-22.3.0
export PATH=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-darwin-amd64-22.3.0/Contents/Home/bin:$PATH && \
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-darwin-amd64-22.3.0/Contents/Home && \
gu install native-image && \
mvn clean package -B -ntp -DskipTests -f ./jitexecutor && mvn clean package -B -ntp -DskipTests -Pnative -am -f ./jitexecutor
- name: "Build Linux"
if: runner.os == 'Linux'
run: |
sudo apt update && \
sudo apt install -y \
build-essential \
libgtk-3-dev \
libappindicator3-dev \
gir1.2-appindicator3-0.1 && \
mvn clean package -B -ntp -DskipTests -f ./jitexecutor && mvn clean package -B -ntp -DskipTests -Pnative -am -f ./jitexecutor
- name: "Configure Pagefile"
if: runner.os == 'Windows'
uses: al-cheb/configure-pagefile-action@86589fd789a4de3e62ba628dda2cb10027b66d67 #v1.3
with:
minimum-size: 16GB
maximum-size: 16GB
disk-root: "C:"
- name: "Setup MSCV"
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: "Setup MSBUILD"
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1
- name: "Setup GraalVM"
if: runner.os == 'Windows'
uses: graalvm/setup-graalvm@babc303d7e5b8f3062a94b90b49c3444cf291633 #v1
with:
version: "22.3.0"
java-version: "11"
components: "native-image"
- name: "Build Windows"
if: runner.os == 'Windows'
shell: cmd
run: |
mvn clean package -B -ntp -DskipTests -f ./jitexecutor && mvn clean package -B -ntp -DskipTests -Pnative -am -f ./jitexecutor
- name: "Upload JIT Executor binary"
uses: actions/upload-artifact@v3
with:
name: jitexecutor_${{ runner.os }}
path: ./jitexecutor/jitexecutor-runner/target/jitexecutor-runner-${{ steps.version.outputs.version }}-run*
outputs:
package_version: ${{ steps.version.outputs.version }}
pack_and_publish:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
needs: [build_jitexecutor_native_binaries]
steps:
- name: "Checkout kie-tools"
uses: actions/checkout@v3
- name: "Download Windows binary"
uses: actions/download-artifact@v2
with:
name: jitexecutor_Windows
path: ./.github/supporting-files/publish_jitexecutor_native/dist/win32
- name: "Download macOS binary"
uses: actions/download-artifact@v2
with:
name: jitexecutor_macOS
path: ./.github/supporting-files/publish_jitexecutor_native/dist/darwin
- name: "Download Linux binary"
uses: actions/download-artifact@v2
with:
name: jitexecutor_Linux
path: ./.github/supporting-files/publish_jitexecutor_native/dist/linux
- name: "Pack and publish"
working-directory: ./.github/supporting-files/publish_jitexecutor_native
env:
NPM_TOKEN: ""
run: |
mv ./dist/linux/jitexecutor-runner-${{ needs.build_jitexecutor_native_binaries.outputs.package_version }}-runner ./dist/linux/jitexecutor
mv ./dist/darwin/jitexecutor-runner-${{ needs.build_jitexecutor_native_binaries.outputs.package_version }}-runner ./dist/darwin/jitexecutor
mv ./dist/win32/jitexecutor-runner-${{ needs.build_jitexecutor_native_binaries.outputs.package_version }}-runner.exe ./dist/win32/jitexecutor.exe
npm version ${{ needs.build_jitexecutor_native_binaries.outputs.package_version }}-SNAPSHOT
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
#npm publish --access public