Skip to content

chore: bump kcl lib version to v0.10.0-rc.1 #238

chore: bump kcl lib version to v0.10.0-rc.1

chore: bump kcl lib version to v0.10.0-rc.1 #238

Workflow file for this run

name: java-test
on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
branches:
- main
paths:
- "java/**"
- ".github/workflows/java-test.yaml"
workflow_dispatch:
jobs:
test-and-build:
permissions:
actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows
contents: read # for actions/checkout to fetch code
name: "${{ matrix.root-pom }} on JDK ${{ matrix.java }} for the classifier ${{ matrix.classifier }}"
strategy:
matrix:
include:
- os: ubuntu-latest
classifier: linux-aarch_64
java: 8
root-pom: 'pom.xml'
- os: windows-latest
classifier: windows-x86_64
java: 8
root-pom: 'pom.xml'
- os: macos-latest
classifier: osx-x86_64
java: 8
root-pom: 'pom.xml'
- os: macos-latest
classifier: osx-aarch_64
java: 8
root-pom: 'pom.xml'
runs-on: ${{ matrix.os }}
env:
ROOT_POM: ${{ matrix.root-pom }}
steps:
- uses: actions/checkout@v4
- name: 'Set up JDK ${{ matrix.java }}'
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
cache: 'maven'
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79
override: true
components: clippy, rustfmt
- name: Setup linux-aarch_64 rust target
if: "contains(matrix.classifier, 'linux-aarch_64')"
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
# Setup for cargo
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: 'Test'
shell: bash
working-directory: java
run: make test
- name: 'Build and Deploy'
shell: bash
working-directory: java
run: mvn clean package -DskipTests=true -Djni.classifier=${{ matrix.classifier }} -Dcargo-build.profile=release
- name: 'Upload artifact'
uses: actions/upload-artifact@v3
with:
name: kcl-lib-${{ matrix.classifier }}
path: |
java/target/classes/native
build-centos7:
runs-on: ubuntu-latest
container:
image: "kcllang/kcl-java-builder-centos7:0.1.0"
permissions:
contents: read
packages: write
needs: [ test-and-build ]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download windows x86_64 lib
uses: actions/download-artifact@v3
with:
name: kcl-lib-windows-x86_64
path: java/native
- name: Download linux aarch_64 lib
uses: actions/download-artifact@v3
with:
name: kcl-lib-linux-aarch_64
path: java/native
- name: Download darwin x86_64 lib
uses: actions/download-artifact@v3
with:
name: kcl-lib-osx-x86_64
path: java/native
- name: Download darwin aarch_64 lib
uses: actions/download-artifact@v3
with:
name: kcl-lib-osx-aarch_64
path: java/native
- name: Package Java artifact
working-directory: java
run: |
rustup default stable && mvn package -DskipTests=true -Dcargo-build.profile=release
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: kcl-lib
path: java/target/*.jar
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [ test-and-build, build-centos7 ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Download Jar
uses: actions/download-artifact@v3
with:
name: kcl-lib
path: java/release
- name: Release to Github Packages
if: "startsWith(github.ref, 'refs/tags/')"
working-directory: java
run: |
JAR_FILE=$(find ./release -name "*.jar" ! -name "*sources.jar")
echo "Deploying $JAR_FILE"
mvn deploy:deploy-file \
-Dfile=$JAR_FILE \
-DpomFile=./pom.xml \
-DrepositoryId=github \
-Durl=https://maven.pkg.github.com/kcl-lang/lib \
-s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}