Skip to content

Commit

Permalink
Update dependencies (#8)
Browse files Browse the repository at this point in the history
* Update dependencies

* Configure build with other Java versions

* Add default java version

* Fix javadoc for Java 21

* Add default build

* Add sonar binding

---------

Co-authored-by: kaklakariada <[email protected]>
  • Loading branch information
kaklakariada and kaklakariada authored Jan 28, 2024
1 parent f633529 commit 7a33ce3
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 140 deletions.
54 changes: 32 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,53 @@ name: Build

on:
push:
branches: [ master, develop ]
branches: [ main ]
pull_request:
branches: [ master, develop ]
branches: [ main ]

jobs:
build:

matrix-build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
java: [11, 17, 21]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-java-${{ matrix.java }}
cancel-in-progress: true
env:
DEFAULT_JAVA: 11

steps:
- uses: actions/checkout@v2
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
- uses: actions/setup-java@v1
- uses: actions/checkout@v4
with:
java-version: 11
- name: Cache local Maven repository
uses: actions/cache@v2
fetch-depth: 0
- uses: actions/setup-java@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn --errors --batch-mode clean org.jacoco:jacoco-maven-plugin:prepare-agent install
env:
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
cache: maven
distribution: temurin
java-version: |
11
17
21
- name: Build with Java ${{ matrix.java }}
run: mvn --errors --batch-mode clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Djava.version=${{ matrix.java }}
- name: Sonar
if: ${{ env.SONAR_TOKEN != null }}
run: mvn --errors --batch-mode "-Dsonar.host.url=https://sonarcloud.io" -Dsonar.organization=itsallcode -Dsonar.login=$SONAR_TOKEN sonar:sonar
if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }}
run: mvn --errors --batch-mode -Dsonar.token=$SONAR_TOKEN sonar:sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
- name: Publish Test Report
uses: scacap/action-surefire-report@v1
if: always()
with:
report_paths: '**/target/surefire-reports/TEST-*.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}


build:
needs: matrix-build
runs-on: ubuntu-latest
steps:
- run: echo "Build successful"
30 changes: 12 additions & 18 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: "CodeQL"

on:
push:
branches: [develop, master]
branches: [main]
pull_request:
branches: [develop, master]
schedule:
- cron: '0 4 * * 3'
branches: [main]

jobs:
analyze:
Expand All @@ -18,27 +16,23 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: actions/setup-java@v1
- uses: actions/setup-java@v4
with:
java-version: 11

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
cache: maven
distribution: temurin
java-version: |
11
17
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: java

- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
1 change: 1 addition & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
Expand Down
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "modifications",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.generate.finalModifiers": "explicit",
"source.fixAll": "explicit"
},
"java.saveActions.organizeImports": true,
"java.sources.organizeImports.starThreshold": 3,
"java.sources.organizeImports.staticStarThreshold": 3,
"java.configuration.updateBuildConfiguration": "automatic",
"sonarlint.connectedMode.project": {
"connectionId": "itsallcode",
"projectKey": "org.itsallcode:hamcrest-mutliline-text-matcher"
}
}
69 changes: 0 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,72 +62,3 @@ The Hamcrest Multiline Text Matcher requires Java 11 to run.
| [Maven Surefire Plugin](https://maven.apache.org/surefire/maven-surefire-plugin/) | Unit testing | Apache License 2.0 |
| [OSS Index Maven Plugin](https://sonatype.github.io/ossindex-maven/maven-plugin/) | Checking Dependencies Vulnerability | ASL2 |
| [Versions Maven Plugin](https://www.mojohaus.org/versions-maven-plugin/) | Checking if dependencies updates are available | Apache License 2.0 |

## Development


### Generate / update license file header

```bash
mvn license:update-file-header
```

## Run local sonar analysis

```bash
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.organization=itsallcode \
-Dsonar.login=[token]
```

See analysis results at https://sonarcloud.io/dashboard?id=org.itsallcode%3Ahamcrest-mutliline-text-matcher

## Check for updated dependencies / plugins

```bash
mvn versions:display-dependency-updates
```

```bash
mvn versions:display-plugin-updates
```

### Publishing to JCenter

1. Add the following to your `~/.m2/settings.xml`:

```xml
<settings>
<servers>
<server>
<id>ossrh</id>
<username>your-jira-id</username>
<password>your-jira-pwd</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>the_pass_phrase</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
```

1. Checkout the `master` branch.
1. Update version in `pom.xml`, commit and push.
1. Run command

```bash
mvn -DskipSigningArtifacts=false clean deploy
```

1. Create a [release](https://github.com/itsallcode/hamcrest-mutliline-text-matcher/releases) of the `master` branch on GitHub.
1. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/hamcrest-mutliline-text-matcher/).
66 changes: 51 additions & 15 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,65 @@
# Developer Guide

## Publishing to JCenter
## Generate / update license file header

```bash
mvn license:update-file-header
```

## Run local sonar analysis

```bash
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \
-Dsonar.token=[token]
```

See analysis results at https://sonarcloud.io/dashboard?id=org.itsallcode%3Ahamcrest-mutliline-text-matcher

## Check for updated dependencies / plugins

```bash
mvn versions:display-dependency-updates
```

```bash
mvn versions:display-plugin-updates
```

## Publishing to Maven Central

1. Add the following to your `~/.m2/settings.xml`:

```xml
<servers>
<server>
<id>bintray-maven-repo</id>
<username>[bintray-username]</username>
<password>[bintray-api-key]</password>
</server>
</servers>
<settings>
<servers>
<server>
<id>ossrh</id>
<username>your-jira-id</username>
<password>your-jira-pwd</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>the_pass_phrase</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
```

1. Checkout the `master` branch.
1. Checkout the `main` branch.
1. Update version in `pom.xml`, commit and push.
1. Run command

```bash
mvn deploy
mvn -DskipSigningArtifacts=false clean deploy
```

1. Create a [release](https://github.com/itsallcode/hamcrest-mutliline-text-matcher/releases) on GitHub.
1. Sign in at [bintray.com](https://bintray.com/login?forwardedFrom=%2Fitsallcode%2Fitsallcode%2Fhamcrest-mutliline-text-matcher)
1. Go to the [bintray project page](https://bintray.com/itsallcode/itsallcode/hamcrest-mutliline-text-matcher)
1. There should be a notice saying "You have 16 unpublished item(s) for this package". Click the "Publish" link. Binaries will be available for download at [jcenter](https://jcenter.bintray.com/org/itsallcode/hamcrest-mutliline-text-matcher/)
1. Publish to Maven Central by clicking the "Sync" button at [the project page](https://bintray.com/itsallcode/itsallcode/hamcrest-mutliline-text-matcher#central). After some time the new version will appear at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/hamcrest-mutliline-text-matcher/).
1. Create a [release](https://github.com/itsallcode/hamcrest-mutliline-text-matcher/releases) of the `main` branch on GitHub.
1. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/hamcrest-mutliline-text-matcher/).
Loading

0 comments on commit 7a33ce3

Please sign in to comment.