-
Notifications
You must be signed in to change notification settings - Fork 456
139 lines (125 loc) · 4.18 KB
/
build.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
name: Build Project
on:
push:
branches-ignore:
- 'dependabot/**'
tags:
- '*'
workflow_dispatch:
jobs:
CodeAudits:
uses: evanchooly/workflows/.github/workflows/code-audits.yml@master
Build:
uses: evanchooly/workflows/.github/workflows/build.yml@master
with:
java: 20
saveBuild: true
Matrix:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
server-id: central
cache: maven
- name: Setup JBang
uses: jbangdev/setup-jbang@main
- name: Find MongoDB versions
id: mongo-versions
run: |
echo "mongo_versions=$( jbang .github/BuildMatrix.java )" >> $GITHUB_OUTPUT
- name: Find Latest Driver version
id: latest-driver-version
run: |
echo "latest_driver_version=$( jbang .github/DriverVersions.java latest)" >> $GITHUB_OUTPUT
- name: Find Driver versions
id: driver-versions
run: |
echo "driver_versions=$( jbang .github/DriverVersions.java all)" >> $GITHUB_OUTPUT
- name: Is releasable branch
id: releasable
run: |
if [ "${{ github.event.ref }}" == 'refs/heads/master' ] \
|| [ "${{ github.event.ref }}" == 'refs/heads/main' ] \
|| [[ "${{ github.event.ref }}" =~ ^refs/heads/[0-9]+\.[0-9]+\.x$ ]] \
|| [[ "${{ github.event.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+.[0-9]+$ ]]
then
echo "releasable=true" >> $GITHUB_OUTPUT
else
echo "releasable=false" >> $GITHUB_OUTPUT
fi
outputs:
driver_latest: ${{ steps.latest-driver-version.outputs.latest_driver_version }}
driver_matrix: ${{ steps.driver-versions.outputs.driver_versions }}
version_matrix: ${{ steps.mongo-versions.outputs.mongo_versions }}
releasable: ${{ steps.releasable.outputs.releasable }}
ServerTests:
name: Server
needs:
- Build
- Matrix
strategy:
fail-fast: false
matrix:
mongo: ${{ fromJson(needs.matrix.outputs.version_matrix) }}
driver: ${{ fromJson(needs.matrix.outputs.driver_latest) }}
java: [ 11 ]
uses: evanchooly/workflows/.github/workflows/build.yml@master
with:
java: ${{ matrix.java }}
reuseBuild: true
archive-name: "${{matrix.mongo}}-${{matrix.driver}}-${{matrix.java}}-${{github.run_id}}"
maven-flags: "-e -Dmongodb=${{ matrix.mongo }} -Ddriver.version=${{ matrix.driver }}"
DriversTests:
name: Driver
needs:
- Build
- Matrix
strategy:
fail-fast: false
matrix:
driver: ${{ fromJson(needs.matrix.outputs.driver_matrix) }}
java: [ 11 ]
mongo: [ 7 ]
include:
- java: 21
mongo: 7
driver: ${{ fromJson(needs.matrix.outputs.driver_latest)[0] }}
uses: evanchooly/workflows/.github/workflows/build.yml@master
with:
java: ${{ matrix.java }}
reuseBuild: true
archive-name: "${{matrix.mongo}}-${{matrix.driver}}-${{matrix.java}}-${{github.run_id}}"
maven-flags: "-e -Dmongodb=${{ matrix.mongo }} -Ddriver.version=${{ matrix.driver }}"
Release:
needs:
- Matrix
- CodeAudits
- ServerTests
- DriversTests
if: needs.Matrix.outputs.releasable == 'true'
uses: evanchooly/workflows/.github/workflows/jreleaser.yml@master
secrets:
GH_PUSH_TOKEN : ${{ secrets.GH_PUSH_TOKEN }}
GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
GPG_PUBLIC_KEY : ${{ secrets.GPG_PUBLIC_KEY }}
GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
SONATYPE_USERNAME : ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD : ${{ secrets.SONATYPE_PASSWORD }}
Docs:
name: Update Documentation
runs-on: ubuntu-latest
needs:
- Release
steps:
- name: Invoke antora build
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Docs
repo: MorphiaOrg/morphia-docs
token: ${{ secrets.GH_PUSH_TOKEN }}
ref: refs/heads/master