forked from logfellow/logstash-logback-encoder
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (83 loc) · 2.94 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
name: build
on:
- push
- pull_request
jobs:
build:
name: build
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
java: [ '11', '17', '21' ]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup JAVA
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: ${{ matrix.java }}
- uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.m2/wrapper
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '.mvn/wrapper/maven-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build
run: ./mvnw --batch-mode --no-transfer-progress --show-version --settings .github/maven/settings.xml verify
# Run tests against Jackson 2.12 to ensure runtime compatibility (do not recompile)
- name: Test Jackson 2.12.x
run: ./mvnw --batch-mode --no-transfer-progress --show-version --settings .github/maven/settings.xml -Pcompat-jackson surefire:test
- name: Upload Test Reports to Github
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: test-reports-${{ matrix.java }}
path: '**/target/surefire-reports/**'
if-no-files-found: ignore
- name: Upload Test Coverage to Codecov
uses: codecov/codecov-action@v3
if: matrix.java == '21'
with:
files: target/site/jacoco/jacoco.xml
release:
name: release
runs-on: ubuntu-22.04
needs: [build]
if: github.event_name == 'push' && github.repository == 'logfellow/logstash-logback-encoder' && github.ref == 'refs/heads/main' && startsWith(github.event.commits[0].message, '[release]')
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: main
- name: Setup JAVA
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 21
- name: Setup GPG
run: .github/workflows/steps/setup-gpg.sh
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup GIT
run: |
.github/workflows/steps/setup-git.sh
git switch main
- uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.m2/wrapper
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '.mvn/wrapper/maven-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Release
run: ./mvnw --batch-mode --no-transfer-progress --show-version --settings .github/maven/settings.xml --activate-profiles ossrh release:prepare release:perform
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}