Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI build using GitHub Actions. #169

Merged
merged 15 commits into from
Oct 24, 2024
Merged
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@sonatype-nexus-community/community-leaders
@guillermo-varela
@shaikhu
9 changes: 9 additions & 0 deletions .github/actions/configure-git/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: configure-git
runs:
using: composite
steps:
- name: Configure GIT with user info for pushing
run: |-
git config user.name "$GITHUB_USERNAME"
git config user.email "$GITHUB_EMAIL"
shell: bash
12 changes: 12 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: setup
description: Setup Java and Gradle
runs:
using: composite
steps:
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
bhamail marked this conversation as resolved.
Show resolved Hide resolved
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
6 changes: 6 additions & 0 deletions .github/workflows/GITHUBACTIONS-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
GitHub Actions Notes
====================

Local Builds
---------------
See: [Running GitHub Actions Locally](https://contribute.sonatype.com/docs/how-to/testing-github-actions-locally/).
70 changes: 70 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# workflow name shown in the Actions tab and PR checks
name: ci-gha

on:
pull_request:
branches:
- main

push:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/setup
- name: Build with Gradle
run: ./gradlew test --no-daemon --debug --max-workers 2

it-test:
strategy:
# might be helpful to limit threads in local builds
# max-parallel: 2
matrix:
it: [it1, it2, it3, it4, it5, it6, it7, it8]
bhamail marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/setup
# might need to setup NDK for local builds
# - uses: nttld/setup-ndk@v1
# with:
# ndk-version: r28-beta1
# link-to-sdk: true
- name: Build with Gradle
run: ./gradlew test --no-daemon --info ${{ matrix.it }}

code_quality:
name: Code Quality
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

- name: Sonatype Lifecycle Evaluation
id: evaluate
uses: sonatype/actions/evaluate@v1.0.1
with:
iq-server-url: ${{ vars.SONATYPE_PLATFORM_URL }}
username: ${{ secrets.SONATYPE_LIFECYCLE_USERNAME }}
password: ${{ secrets.SONATYPE_LIFECYCLE_PASSWORD }}
application-id: 'scan-gradle-plugin'
scan-targets: '.'
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# workflow name shown in the Actions tab and PR checks
name: release

on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
approve-release:
environment:
name: approval
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- run: echo 'approved'
do-release:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs:
- approve-release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/setup
- uses: ./.github/actions/configure-git
- name: Release with Gradle
run: ./gradlew clean release -Dorg.gradle.daemon=false --stacktrace -x test -x integrationTest