-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (131 loc) · 4.63 KB
/
ci.yaml
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
162
163
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
compatibility:
strategy:
matrix:
os: [ ubuntu-latest ]
java-distribution:
- temurin
- zulu
- adopt-hotspot
- adopt-openj9
- liberica
- microsoft
- corretto
- semeru
- oracle
- dragonwell
java-version: [ 21 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up ${{ matrix.java-distribution }}-jdk-${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.java-distribution }}
java-version: ${{ matrix.java-version }}
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-${{ runner.os }}
- name: Install PCRE
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install -y libpcre2-8-0
- name: Test
if: ${{ matrix.os == 'ubuntu-latest' }}
run: ./gradlew ffm:test jna:test -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu
package:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- compatibility
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up temurin-jdk-21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Set up Git Hub Pages
uses: actions/configure-pages@v5
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-${{ runner.os }}
- name: Checkstyle
run: ./gradlew checkstyleMain checkstyleTest
- name: Install PCRE
run: sudo apt-get install -y libpcre2-8-0
- name: Build artifacts
run: ./gradlew build jacocoAggregatedTestReport -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu
- name: Build docs
run: |
sudo apt-get install -y pandoc
mkdir -p build/gh-pages
pandoc -f gfm -t html5 -s --shift-heading-level-by=-1 --lua-filter=gh-pages/filter.lua \
-o build/gh-pages/index.html README.md
pandoc -f gfm -t html5 -s --shift-heading-level-by=-1 --lua-filter=gh-pages/filter.lua \
-o build/gh-pages/pcre2-api.html PCRE2_API.md
mkdir -p build/gh-pages/javadoc
pandoc -f markdown -t html5 -s --shift-heading-level-by=-1 --lua-filter=gh-pages/filter.lua \
-o build/gh-pages/javadoc/index.html gh-pages/javadoc/index.md
cp -a api/build/docs/javadoc/. build/gh-pages/javadoc/api
cp -a lib/build/docs/javadoc/. build/gh-pages/javadoc/lib
cp -a jna/build/docs/javadoc/. build/gh-pages/javadoc/jna
cp -a ffm/build/docs/javadoc/. build/gh-pages/javadoc/ffm
cp -a regex/build/docs/javadoc/. build/gh-pages/javadoc/regex
- name: Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: build/reports/jacoco/jacocoAggregatedTestReport/jacoco.xml
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/gh-pages
- name: Publish artifacts
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
run: ./gradlew publish -Ppcre4j.version=${{ github.ref_name }}-SNAPSHOT
publish-github-pages:
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
needs:
- package
environment:
name: github-pages
url: ${{ steps.publish-github-pages.outputs.page_url }}
steps:
- name: Set up Git Hub Pages
uses: actions/configure-pages@v5
- name: Publish GitHub Pages
id: publish-github-pages
uses: actions/deploy-pages@v4