-
Notifications
You must be signed in to change notification settings - Fork 10
161 lines (139 loc) · 4.5 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: CI
on:
pull_request:
branches: ['**']
push:
branches: ['main']
tags: [v*]
workflow_dispatch:
# release:
# types: [published]
jobs:
build:
strategy:
matrix:
# Specifying `macos-14` is the way to get aarch64
os: [ubuntu-latest, macos-12, macos-14]
include:
- os: macos-12
arch: x86_64
- os: macos-14
arch: arm64
java: [11]
distribution: [temurin]
pdal: [2.7.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 }}
- run: brew install sbt
if: ${{ matrix.os == 'macos-14' }}
- 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 pdal=${{ 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.7.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 }}
- 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 pdal=${{ 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-12
path: native/target/native/x86_64-darwin/bin
- uses: actions/download-artifact@v4
with:
name: macos-14
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 != '' }}