-
Notifications
You must be signed in to change notification settings - Fork 56
103 lines (101 loc) · 4.15 KB
/
maven.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
name: Java Maven
# https://github.com/laboratoriobridge/metafy/blob/d2f4fd53ef3783140cece9d5f2a57045304266dc/.github/workflows/maven.yml
on:
push:
# Sequence of patterns matched against refs/heads
branches:
- master # Push events on master branch
- master # Push events on main branch
- 'releases/*' # Push events to branches matching refs/heads/releases/*
- 'refs/tags/*' # Push events to branches matching refs/heads/tags/*
- '!refs/pull/*' # Push events on branches that do not match refs/pull/*
pull_request:
branches:
- master
- main
jobs:
test:
name: mvn JDK ${{ matrix.java_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
java_version: ['11', '17', '21']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'adopt' # use Corretto once supported https://github.com/actions/setup-java/issues/68
# https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven#caching-dependencies
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-java${{ matrix.java_version }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-java${{ matrix.java_version }}-m2
- name: Build with Maven
run: |
mvn clean verify --activate-profiles=coverage,pack
- name: Codecov upload
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./dbeam-core/target/site/jacoco/jacoco.xml
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: false # optional (default = false)
verbose: true # optional (default = false)
- name: End to end tests
if: matrix.java_version == '17'
run: ./e2e/e2e.sh
- run: mkdir staging && cp /tmp/debeam_e2e.log ./staging
if: matrix.java_version == '17'
- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && matrix.java_version == '17'
with:
name: Package
path: staging
deploy:
# https://docs.github.com/en/actions/guides/publishing-java-packages-with-maven#publishing-packages-to-github-packages
name: Deploy
runs-on: 'ubuntu-latest'
needs: [test]
environment: main_env
permissions:
contents: read
packages: write
# Disable it, since it was failing on sonatype deploy. TODO: fix
if: false && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
steps:
- uses: actions/checkout@v4
# https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven#caching-dependencies
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: Linux-java11-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: Linux-java11-m2
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt' # use Corretto once supported https://github.com/actions/setup-java/issues/68
- name: Deploy
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USER: ${{ github.actor }}
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
export GPG_TTY=$(tty)
export DISPLAY=:0
gpg --version
echo "$GPG_KEY" | base64 --decode --ignore-garbage | gpg --batch --fast-import -
gpg --list-secret-keys --keyid-format LONG
echo "test" | gpg --batch --clearsign --pinentry-mode loopback || true
mvn --settings ./github-settings.xml -DskipTests deploy
rm -rf ~/.gnupg