Skip to content

Commit

Permalink
Merge pull request #2 from orbinson/feature/add-it-tests
Browse files Browse the repository at this point in the history
Feature/add it tests
  • Loading branch information
royteeuwen authored Aug 2, 2024
2 parents ceed7c6 + 7d69091 commit fec651c
Show file tree
Hide file tree
Showing 15 changed files with 758 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: bdhoine,royteeuwen
39 changes: 39 additions & 0 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Analyse

on: [ push, pull_request ]

jobs:
sonar:
name: SonarCloud
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17

- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on: [ push, pull_request ]

jobs:
build:
name: Maven build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17

- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build
run: mvn --batch-mode --update-snapshots install

- name: Integration Tests
run: mvn install -Pit
107 changes: 107 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Release

on:
workflow_dispatch:
inputs:
central:
description: 'Release to Maven Central'
required: false
default: true
type: boolean
github:
description: 'Create GitHub release'
required: false
default: true
type: boolean
push:
description: 'Push changes'
required: false
default: true
type: boolean

permissions:
contents: write

jobs:
release:
name: Maven and GitHub release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java with Maven Central Repository
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Remove SNAPSHOT from version
run: mvn --batch-mode versions:set -DremoveSnapshot versions:commit

- name: Set RELEASE_VERSION env variable
run: |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Update CHANGELOG.md
if: ${{ inputs.push }}
uses: thomaseizinger/keep-a-changelog-new-release@v1
with:
version: ${{ env.RELEASE_VERSION }}

- name: Get release info
id: changelog
uses: release-flow/keep-a-changelog-action/get-release-info@v1

- name: Deploy package
if: ${{ inputs.central }}
run: mvn --batch-mode deploy --activate-profiles release
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Commit and push release
if: ${{ inputs.push }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Create release ${{ steps.changelog.outputs.release-version }}"
tagging_message: ${{ steps.changelog.outputs.release-version }}

- name: Create release
if: ${{ inputs.github }}
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.update-changelog.outputs.release-version }}
tag_name: ${{ steps.changelog.outputs.release-version }}
files: all/target/aem-groovy-console-all-*.zip
body: ${{ steps.changelog.outputs.release-notes }}

- name: Next SNAPSHOT version
if: ${{ inputs.push }}
run: mvn --batch-mode versions:set -DnextSnapshot versions:commit

- name: Set RELEASE_VERSION env variable
if: ${{ inputs.push }}
run: |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Commit and push development version
if: ${{ inputs.push }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Bump development version to ${{ env.RELEASE_VERSION }}"
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

- Initial release of the log method weaving hook
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ Example, search for your classname, method name and amount of parameters you wan
```json
{
"className": "my.package.MyClass",
"methodName": "doGet",
"amountOfParameters": 2
"methodName": "doGet"
}
```

To make the weaving hook work, either a framework restart of an entire java process restart is required.

## Future

- Add weaving hooks to create custom spans and metrics using OpenTelemetry
- Add weaving hooks to create custom spans and metrics using OpenTelemetry
Loading

0 comments on commit fec651c

Please sign in to comment.