Skip to content

Commit

Permalink
Merge pull request #108 from noleme/fix/github-flow
Browse files Browse the repository at this point in the history
fix: github workflow
  • Loading branch information
eledhwen authored Dec 26, 2024
2 parents 8ac8f82 + b9d57b1 commit ca2492a
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 31 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,34 @@ on:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '28 7 * * 5'
- cron: '30 1 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java' ]
os: [ ubuntu-latest ]
java: [ 21 ]
fail-fast: false

runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -43,7 +48,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -56,6 +61,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
9 changes: 5 additions & 4 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, macOS-latest ]
java: [ 11, 15 ]
java: [ 11, 17, 21 ]
fail-fast: false

runs-on: ${{ matrix.os }}
timeout-minutes: 120

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Upload surefire artifact
uses: actions/upload-artifact@v2-preview
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ matrix.os }}-surefire
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/maven-checkstyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Maven Checkstyle

on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]

jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest ]
java: [ 21 ]
fail-fast: false

runs-on: ${{ matrix.os }}
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: v0.17.2
- name: Checkstyle with Maven
run: mvn clean checkstyle:check --fail-never
- name: Run reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat target/checkstyle-result.xml | reviewdog -f=checkstyle -reporter=github-pr-review -runners=golint,govet
15 changes: 9 additions & 6 deletions .github/workflows/maven-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
java: [ 15 ]
java: [ 21 ]
fail-fast: false

runs-on: ${{ matrix.os }}
timeout-minutes: 120
timeout-minutes: 30

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- name: Test with Maven
run: mvn clean -B test --file pom.xml
- uses: codecov/codecov-action@v2
run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
17 changes: 5 additions & 12 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
name: Maven Publish

name: Publish package to the Maven Central Repository
on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
server-id: ossrh
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- id: install-secret-key
Expand All @@ -23,12 +21,7 @@ jobs:
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Publish package
run: |
mvn \
--no-transfer-progress \
--batch-mode \
-Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \
clean deploy
run: mvn --batch-mode clean deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/target
/logs
*.iml
*.idea
src/test/java/Throwaway*

0 comments on commit ca2492a

Please sign in to comment.