forked from eventeum/eventeum
-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (52 loc) · 1.47 KB
/
main.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
name: Eventeum CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'corretto'
cache: maven
- name: Build with Maven
run: mvn clean package -DskipTests
- name: Run tests
run: mvn verify
- name: Check Coverage
run: |
COVERAGE=$(cat coverage/target/site/jacoco-aggregate/index.html | grep -o 'Total.*[0-9]\{1,3\}%' | grep -o '[0-9]\{1,3\}%' | head -1 | sed 's/%//')
if [ "$COVERAGE" -lt 25 ]; then
echo "Coverage below 25%: $COVERAGE%"
exit 1
fi
publish:
needs: build
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'corretto'
cache: maven
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Install parent POM
run: mvn install -N
- name: Publish to GitHub Packages
run: mvn deploy -pl core -am -DskipTests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}