-
Notifications
You must be signed in to change notification settings - Fork 4
147 lines (127 loc) · 3.64 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
name: CI
# workflow triggers
on:
# manually
workflow_dispatch:
# PRs on `main`
pull_request:
branches:
- main
# nightly
schedule:
- cron: "0 3 * * *"
jobs:
verify:
name: Verify build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Setup Java and Maven cache
uses: actions/setup-java@v4.5.0
with:
distribution: 'temurin'
java-version: '17'
check-latest: true
cache: 'maven'
- name: Verify build
run: >
./mvnw clean verify
--batch-mode
--update-snapshots
--no-transfer-progress
- name: Stage build results (Unix)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest'
run: mkdir staging-${{ matrix.os }} && find . -path '*/target/*.jar' -exec cp {} staging-${{ matrix.os }}/ \;
- name: Stage build results (Windows)
if: matrix.os == 'windows-latest'
run: mkdir staging-${{ matrix.os }} && gci -Path . -Recurse -Include *.jar |? { $_.FullName -like '*\target\*.jar' } |% { cp $_.FullName staging-${{ matrix.os }} }
- name: Upload build results
uses: actions/upload-artifact@v3.1.3
with:
name: Build Results
path: staging-*/
verify-javadoc:
name: Verify JavaDoc
runs-on: ubuntu-latest
needs: [verify]
strategy:
fail-fast: true
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Setup Java and Maven cache
uses: actions/setup-java@v4.5.0
with:
distribution: 'temurin'
java-version: '17'
check-latest: true
cache: 'maven'
- name: Verify JavaDoc
run: >
./mvnw clean package javadoc:javadoc
-DskipTests
--batch-mode
--update-snapshots
--no-transfer-progress
sonar:
name: SonarQube analysis
runs-on: ubuntu-latest
needs: [verify]
strategy:
fail-fast: true
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Setup Java and Maven cache
uses: actions/setup-java@v4.5.0
with:
distribution: 'temurin'
java-version: '17'
check-latest: true
cache: 'maven'
- name: Run SonarQube analysis
run: >
./mvnw clean verify sonar:sonar -P coverage
--batch-mode
--update-snapshots
--no-transfer-progress
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
deploy-snapshot:
name: Deploy snapshot
runs-on: ubuntu-latest
needs: [verify]
if: github.ref == 'refs/heads/main' && github.repository_owner == 'vitruv-tools'
strategy:
fail-fast: true
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Setup Java and Maven cache
uses: actions/setup-java@v4.5.0
with:
distribution: 'temurin'
java-version: '17'
check-latest: true
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Deploy snapshot
run: >
./mvnw clean deploy -P snapshot
-DskipTests
--batch-mode
--update-snapshots
--no-transfer-progress
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}