-
Notifications
You must be signed in to change notification settings - Fork 26
141 lines (136 loc) · 4.25 KB
/
java.yaml
File metadata and controls
141 lines (136 loc) · 4.25 KB
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
name: Java
on:
push:
branches: [main]
tags: ["*"]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
pre-commit:
name: Rerun pre-commit checks
runs-on: ubuntu-slim
steps:
- name: Check out repo
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.14
- name: Install dependencies
run: python -m pip install pre-commit
- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit hooks
run: pre-commit run -a --show-diff-on-failure --color=always
build:
name: Build
needs: pre-commit
runs-on: ${{ matrix.os }}
outputs:
dist-base: ${{ steps.dist.outputs.dist-base }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
java: [22, 25]
include:
- os: ubuntu-latest
java: 22
dist: dist
defaults:
run:
shell: bash
steps:
- name: Check out repo
uses: actions/checkout@v5
- name: Install Java
uses: actions/setup-java@v5
with:
distribution: oracle
java-version: ${{ matrix.java }}
cache: maven
- name: Install dependencies (Linux)
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo add-apt-repository "ppa:openslide/openslide"
sudo apt-get install libopenslide1
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew update
brew install openslide
# allow smoke test to find OpenSlide
echo "DYLD_LIBRARY_PATH=/opt/homebrew/lib" >> $GITHUB_ENV
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p "c:\\openslide"
cd "c:\\openslide"
release=$(gh release list -R openslide/openslide-bin -L 1 \
--json tagName --exclude-drafts --exclude-pre-releases | \
jq -r .[0].tagName | \
tr -d v)
zipname="openslide-bin-${release}-windows-x64"
gh release download -R openslide/openslide-bin "v${release}" \
--pattern "${zipname}.zip"
7z x ${zipname}.zip
# allow smoke test to find OpenSlide
echo "PATH=c:\\openslide\\${zipname}\\bin;$PATH" >> $GITHUB_ENV
- name: Build
run: mvn -Dmaven.compiler.failOnWarning=true
- name: Smoke test
run: |
OPENSLIDE_DEBUG=synthetic java --enable-native-access=ALL-UNNAMED \
-cp target/openslide-java-*.jar org.openslide.TestCLI ""
- name: Dist
id: dist
if: matrix.dist
run: |
dist="openslide-java-dist-$GITHUB_RUN_NUMBER-$(echo $GITHUB_SHA | cut -c-10)"
echo "dist-base=$dist" >> $GITHUB_OUTPUT
mkdir -p "artifacts/$dist"
mv target/openslide-java-*.jar "artifacts/${dist}"
- name: Archive dist
if: matrix.dist
uses: actions/upload-artifact@v7
with:
name: ${{ steps.dist.outputs.dist-base }}
path: artifacts
compression-level: 0
release:
name: Release
if: github.ref_type == 'tag'
needs: build
runs-on: ubuntu-slim
concurrency: release-${{ github.ref }}
permissions:
contents: write
steps:
- name: Check out repo
uses: actions/checkout@v5
- name: Download artifacts
uses: actions/download-artifact@v8
with:
pattern: ${{ needs.build.outputs.dist-base }}
merge-multiple: true
- name: Release to GitHub
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
version=$(echo "${{ github.ref_name }}" | sed "s/^v//")
awk -e '/^## / && ok {exit}' \
-e '/^## / {ok=1; next}' \
-e 'ok {print}' \
CHANGELOG.md > changes
gh release create --prerelease --verify-tag \
--repo "${{ github.repository }}" \
--title "OpenSlide Java $version" \
--notes-file changes \
"${{ github.ref_name }}" \
"${{ needs.build.outputs.dist-base }}/"*