Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit 9c97205

Browse files
Add support to github actions for CI/CD
1 parent 07c8e5f commit 9c97205

File tree

3 files changed

+305
-36
lines changed

3 files changed

+305
-36
lines changed

.github/workflows/ci.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Java SDK CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
- support/SDK-V3
9+
- feature/**
10+
- bugfix/**
11+
- dependabot/**
12+
13+
jobs:
14+
build:
15+
# Compile the project using the predefined JDK versions in the strategy section
16+
runs-on: ubuntu-latest
17+
name: Build - JDK ${{ matrix.java-version }}
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
java-version: [ 8 ]
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
- name: Setup JDK ${{ matrix.java }}
28+
uses: actions/setup-java@v3
29+
with:
30+
distribution: 'zulu'
31+
java-version: ${{ matrix.java-version }}
32+
33+
- name: Build and Test JDK ${{ matrix.java-version }}
34+
# --batch-mode Run in non-interactive (batch) mode (disables output color)
35+
# --update-snapshots Forces a check for missing releases and updated snapshots on remote repositories
36+
run: mvn --batch-mode --update-snapshots compile
37+
38+
test:
39+
# Perform the unit and integration tests using the predefined JDK versions in the strategy section
40+
needs: [build]
41+
runs-on: ubuntu-latest
42+
name: Test - JDK ${{ matrix.java-version }}
43+
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
java-version: [ 8, 9, 10, 11, 12, 13, 14, 15, 16 ,17, 18 ]
48+
49+
steps:
50+
- uses: actions/checkout@v3
51+
52+
- name: Setup JDK ${{ matrix.java-version }}
53+
uses: actions/setup-java@v3
54+
with:
55+
distribution: 'zulu'
56+
architecture: x64
57+
java-version: ${{ matrix.java-version }}
58+
59+
- name: Run the Maven test phase JDK ${{ matrix.java-version }}
60+
# --batch-mode Run in non-interactive (batch) mode (disables output color)
61+
# --update-snapshots Forces a check for missing releases and updated snapshots on remote repositories
62+
run: mvn --batch-mode --update-snapshots test
63+
64+
code-coverage:
65+
needs: [ test ]
66+
runs-on: ubuntu-latest
67+
68+
name: Report code coverage - JDK ${{ matrix.java-version }}
69+
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
java-version: [ 8 ]
74+
steps:
75+
- uses: actions/checkout@v3
76+
77+
- name: Setup JDK ${{ matrix.java-version }}
78+
uses: actions/setup-java@v3
79+
with:
80+
distribution: 'zulu'
81+
java-version: ${{ matrix.java-version }}
82+
83+
- name: "Report: Coverage via coveralls.io"
84+
env:
85+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
86+
run: |
87+
mvn clean \
88+
cobertura:cobertura \
89+
coveralls:report \
90+
--no-transfer-progress \
91+
-D repoToken=$COVERALLS_REPO_TOKEN

.github/workflows/deploy.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Deploy to Maven Central
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [created]
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Import GPG Key
17+
run: |
18+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
19+
gpg --list-secret-keys --keyid-format LONG || echo "No secret keys found"
20+
env:
21+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
22+
23+
- name: Extract GPG Key ID
24+
run: |
25+
KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/ { print $5 }')
26+
echo "GPG_KEY_ID=$KEY_ID" >> $GITHUB_ENV
27+
shell: bash
28+
29+
- name: Debug GPG Key Import
30+
run: |
31+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
32+
gpg --list-secret-keys --keyid-format LONG || echo "No secret keys found"
33+
env:
34+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
35+
36+
- name: Set Default GPG Key
37+
run: |
38+
echo "default-key ${{ env.GPG_KEY_ID }}" >> ~/.gnupg/gpg.conf
39+
echo "use-agent" >> ~/.gnupg/gpg.conf
40+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
41+
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
42+
echo RELOADAGENT | gpg-connect-agent
43+
44+
- name: Set GPG_TTY
45+
run: echo "GPG_TTY=$(tty)" >> $GITHUB_ENV
46+
47+
- name: Debug GPG Key Import
48+
run: |
49+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
50+
gpg --list-secret-keys --keyid-format LONG || echo "No secret keys found"
51+
env:
52+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
53+
54+
- name: Set up Java
55+
uses: actions/setup-java@v4
56+
with:
57+
distribution: 'temurin'
58+
java-version: '17'
59+
server-id: central
60+
server-username: MAVEN_USERNAME
61+
server-password: MAVEN_PASSWORD
62+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
63+
gpg-passphrase: GPG_PASSPHRASE
64+
65+
- name: Build and Deploy
66+
# run: mvn -P release --batch-mode deploy -DskipTests
67+
run: |
68+
mvn clean -P release deploy -DskipTests -Psign-artifacts \
69+
-Dgpg.passphrase="$GPG_PASSPHRASE" \
70+
-Dgpg.keyname="$GPG_KEY_ID"
71+
env:
72+
GPG_TTY: $(tty)
73+
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
74+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
75+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
76+
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}

0 commit comments

Comments
 (0)