Merge pull request #57 from kcl-lang/nodejs-kcl-lib #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: java-test | |
on: | |
push: | |
branches: | |
- main | |
- master | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "java/**" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
test: | |
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-x86_64 | |
java: 8 | |
root-pom: 'pom.xml' | |
- 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: | |
- name: 'Check out repository' | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
- name: 'Set up JDK ${{ matrix.java }}' | |
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'zulu' | |
cache: 'maven' | |
server-id: sonatype-nexus-snapshots | |
server-username: CI_DEPLOY_USERNAME | |
server-password: CI_DEPLOY_PASSWORD | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install rust nightly toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.74 | |
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: make # && make deploy | |
env: | |
CI_DEPLOY_USERNAME: ${{ secrets.NEXUS_STAGE_DEPLOYER_USER }} | |
CI_DEPLOY_PASSWORD: ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }} | |
- name: 'Upload artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: java-artifact-${{ matrix.classifier }} | |
path: | | |
java/target/*.jar |