Skip to content

Commit 0ccf60a

Browse files
authored
CI build using GitHub Actions. (#169)
* GitHub Actions with manual release job
1 parent 43e71bc commit 0ccf60a

File tree

6 files changed

+132
-0
lines changed

6 files changed

+132
-0
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@sonatype-nexus-community/community-leaders
2+
@guillermo-varela
3+
@shaikhu
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: configure-git
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Configure GIT with user info for pushing
6+
run: |-
7+
git config user.name "$GITHUB_USERNAME"
8+
git config user.email "$GITHUB_EMAIL"
9+
shell: bash

.github/actions/setup/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: setup
2+
description: Setup Java and Gradle
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Setup Java
7+
uses: actions/setup-java@v4
8+
with:
9+
distribution: 'temurin'
10+
# TODO: Update this to Java 11 after branch `version3` is merged
11+
java-version: 8
12+
- name: Setup Gradle
13+
uses: gradle/actions/setup-gradle@v4
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
GitHub Actions Notes
2+
====================
3+
4+
Local Builds
5+
---------------
6+
See: [Running GitHub Actions Locally](https://contribute.sonatype.com/docs/how-to/testing-github-actions-locally/).

.github/workflows/ci.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# workflow name shown in the Actions tab and PR checks
2+
name: ci-gha
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
push:
10+
branches:
11+
- main
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
submodules: recursive
24+
fetch-depth: 0
25+
- uses: ./.github/actions/setup
26+
- name: Build with Gradle
27+
run: ./gradlew test --no-daemon --debug --max-workers 2
28+
29+
it-test:
30+
strategy:
31+
# might be helpful to limit threads in local builds
32+
#max-parallel: 2
33+
# TODO: Update this to remove obsolete itX's after branch `version3` is merged
34+
matrix:
35+
it: [it1, it2, it3, it4, it5, it6, it7, it8]
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
with:
41+
submodules: recursive
42+
fetch-depth: 0
43+
- uses: ./.github/actions/setup
44+
# might need to setup NDK for local builds
45+
# - uses: nttld/setup-ndk@v1
46+
# with:
47+
# ndk-version: r28-beta1
48+
# link-to-sdk: true
49+
- name: Build with Gradle
50+
run: ./gradlew test --no-daemon --info ${{ matrix.it }}
51+
52+
code_quality:
53+
name: Code Quality
54+
runs-on: ubuntu-latest
55+
timeout-minutes: 5
56+
steps:
57+
- name: Checkout Code
58+
uses: actions/checkout@v4
59+
with:
60+
# Disabling shallow clone is recommended for improving relevancy of reporting
61+
fetch-depth: 0
62+
63+
- name: Sonatype Lifecycle Evaluation
64+
id: evaluate
65+
uses: sonatype/actions/evaluate@v1.0.1
66+
with:
67+
iq-server-url: ${{ vars.SONATYPE_PLATFORM_URL }}
68+
username: ${{ secrets.SONATYPE_LIFECYCLE_USERNAME }}
69+
password: ${{ secrets.SONATYPE_LIFECYCLE_PASSWORD }}
70+
application-id: 'scan-gradle-plugin'
71+
scan-targets: '.'

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# workflow name shown in the Actions tab and PR checks
2+
name: release
3+
4+
on:
5+
# Allows you to run this workflow manually from the Actions tab
6+
workflow_dispatch:
7+
8+
jobs:
9+
approve-release:
10+
environment:
11+
name: approval
12+
if: github.ref == 'refs/heads/main'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- run: echo 'approved'
16+
do-release:
17+
if: github.ref == 'refs/heads/main'
18+
runs-on: ubuntu-latest
19+
needs:
20+
- approve-release
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
submodules: recursive
26+
fetch-depth: 0
27+
- uses: ./.github/actions/setup
28+
- uses: ./.github/actions/configure-git
29+
- name: Release with Gradle
30+
run: ./gradlew clean release -Dorg.gradle.daemon=false --stacktrace -x test -x integrationTest

0 commit comments

Comments
 (0)