Update CI to use SBT action #332
Workflow file for this run
This file contains 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: CI | |
on: | |
pull_request: | |
branches: ['**'] | |
push: | |
branches: ['main'] | |
tags: [v*] | |
workflow_dispatch: | |
# release: | |
# types: [published] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
include: | |
- os: macos-latest | |
arch: arm64 | |
java: [11] | |
distribution: [temurin] | |
pdal: [2.8.1] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: coursier/cache-action@v6 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ matrix.distribution }} | |
java-version: ${{ matrix.java }} | |
- name: Install sbt | |
uses: sbt/setup-sbt@v1 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: pdal-java | |
channels: conda-forge | |
- name: Conda cache config | |
id: cache-config | |
shell: bash | |
run: | | |
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
echo "path=$CONDA/envs/pdal-java" >> $GITHUB_OUTPUT | |
- name: Cache Conda env | |
id: conda-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.cache-config.outputs.path }} | |
key: | |
conda-pdal-java-${{ runner.os }}--${{ runner.arch }}--${{ steps.cache-config.outputs.today }}-${{ matrix.pdal }}-${{ env.CACHE_NUMBER }} | |
env: | |
CACHE_NUMBER: 0 | |
- name: Install PDAL | |
if: steps.conda-cache.outputs.cache-hit != 'true' | |
run: conda install libpdal-core=${{ matrix.pdal }} | |
- name: Set LD_LIBRARY_PATH | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: echo "LD_LIBRARY_PATH=$CONDA/envs/pdal-java/lib:/usr/local/lib:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" | |
- name: Check formatting | |
run: sbt scalafmtCheckAll | |
- name: Build project | |
run: sbt +test | |
- uses: actions/upload-artifact@v4 | |
if: ${{ startsWith(matrix.os, 'macos') }} | |
with: | |
name: ${{ matrix.os }} | |
path: native/target/native/${{ matrix.arch }}-darwin/bin | |
publish: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
java: [11] | |
distribution: [temurin] | |
pdal: [2.8.1] | |
runs-on: ${{ matrix.os }} | |
if: github.event_name != 'pull_request' | |
needs: [build] | |
defaults: | |
run: | |
shell: bash -el {0} | |
env: | |
PDAL_DEPEND_ON_NATIVE: "false" | |
CI_CLEAN: "" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: coursier/cache-action@v6 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ matrix.distribution }} | |
java-version: ${{ matrix.java }} | |
- name: Install sbt | |
uses: sbt/setup-sbt@v1 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: pdal-java | |
channels: conda-forge | |
- name: Conda cache config | |
id: cache-config | |
shell: bash | |
run: | | |
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
echo "path=$CONDA/envs/pdal-java" >> $GITHUB_OUTPUT | |
- name: Cache Conda env | |
id: conda-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.cache-config.outputs.path }} | |
key: | |
conda-pdal-java-${{ runner.os }}--${{ runner.arch }}--${{ steps.cache-config.outputs.today }}-${{ matrix.pdal }}-${{ env.CACHE_NUMBER }} | |
env: | |
CACHE_NUMBER: 0 | |
- name: Install PDAL | |
if: steps.conda-cache.outputs.cache-hit != 'true' | |
run: conda install libpdal-core=${{ matrix.pdal }} | |
- name: Set LD_LIBRARY_PATH | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: echo "LD_LIBRARY_PATH=$CONDA/envs/pdal-java/lib:/usr/local/lib:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: macos-latest | |
path: native/target/native/arm64-darwin/bin | |
- name: Release | |
run: sbt ci-release | |
env: | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
if: ${{ env.SONATYPE_PASSWORD != '' && env.SONATYPE_USERNAME != '' }} |