Skip to content

Commit 918f2ea

Browse files
committed
ci: improvements
1 parent b0c8b98 commit 918f2ea

File tree

7 files changed

+96
-83
lines changed

7 files changed

+96
-83
lines changed

.github/workflows/build.yml

+31-10
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,48 @@
1-
name: "Build"
2-
on: push
1+
# GitHub Actions workflow to build the project with Gradle.
2+
name: "Gradle"
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
7+
cancel-in-progress: true
38

49
env:
5-
JAVA_VERSION: 17
10+
JAVA_VERSION: 18
611

712
jobs:
813
build:
14+
name: "Build"
15+
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}"
916
strategy:
1017
matrix:
11-
os: ["ubuntu-latest"]
18+
os:
19+
- "ubuntu-latest"
20+
- "windows-latest"
21+
- "macos-latest"
22+
1223
runs-on: "${{ matrix.os }}"
1324
steps:
14-
- uses: actions/checkout@v3
25+
- name: "Checkout repository"
26+
uses: actions/checkout@v3
1527

16-
- name: "Set up JDK ${{ env.JAVA_VERSION }}"
28+
- name: "Set up Java ${{ env.JAVA_VERSION }}"
1729
uses: actions/setup-java@v3
1830
with:
1931
java-version: "${{ env.JAVA_VERSION }}"
2032
distribution: "adopt"
2133

2234
- name: "Gradle build"
23-
uses: "gradle/gradle-build-action@v2"
35+
uses: gradle/gradle-build-action@v2
36+
with:
37+
arguments: "build"
38+
39+
- name: "Upload reports"
40+
if: always()
41+
uses: actions/upload-artifact@v3
2442
with:
25-
cache-read-only: "${{ github.ref != 'refs/heads/main' }}"
26-
gradle-version: "release-nightly"
27-
arguments: "build"
43+
name: "${{ runner.os }}-test-reports"
44+
retention-days: 7
45+
if-no-files-found: ignore
46+
path: |
47+
**/build/reports/tests/test/
48+
**/build/reports/checkstyle/

.github/workflows/codeql-analysis.yml

+23-38
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
1+
# GitHub Action workflow to run CodeQL.
122
name: "CodeQL"
13-
143
on:
154
push:
16-
branches: [ main, development ]
175
pull_request:
18-
# The branches below must be a subset of the branches above
19-
branches: [ main, development ]
206
schedule:
217
- cron: '25 6 * * 5'
228

9+
concurrency:
10+
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
11+
cancel-in-progress: true
12+
13+
env:
14+
JAVA_VERSION: 18
15+
2316
jobs:
2417
analyze:
25-
name: Analyze
26-
runs-on: ubuntu-latest
18+
name: "Analyze"
19+
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}"
20+
runs-on: "ubuntu-latest"
2721
permissions:
2822
actions: read
2923
contents: read
@@ -32,36 +26,27 @@ jobs:
3226
strategy:
3327
fail-fast: false
3428
matrix:
35-
language: [ 'java' ]
36-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37-
# Learn more:
38-
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
29+
language: [ "java" ]
3930

4031
steps:
41-
- name: Checkout repository
32+
- name: "Checkout repository"
4233
uses: actions/checkout@v3
4334

44-
# Initializes the CodeQL tools for scanning.
45-
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v1
35+
- name: "Initialize CodeQL"
36+
uses: github/codeql-action/init@v2
4737
with:
48-
languages: ${{ matrix.language }}
49-
# If you wish to specify custom queries, you can do so here or in a config file.
50-
# By default, queries listed here will override any specified in a config file.
51-
# Prefix the list here with "+" to use these queries and those in the config file.
52-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
38+
languages: "${{ matrix.language }}"
5339

54-
- name: Set up JDK 8
40+
- name: "Set up JDK ${{ env.JAVA_VERSION }}"
5541
uses: actions/setup-java@v3
5642
with:
57-
distribution: 'adopt' # See 'Supported distributions' for available options
58-
java-version: '8'
43+
java-version: "${{ env.JAVA_VERSION }}"
44+
distribution: "adopt"
5945

60-
- name: Build with Gradle
46+
- name: "Build"
6147
uses: gradle/gradle-build-action@v2
6248
with:
63-
gradle-version: "release-nightly"
64-
arguments: build
49+
arguments: "build"
6550

66-
- name: Perform CodeQL Analysis
67-
uses: github/codeql-action/analyze@v1
51+
- name: "Perform CodeQL Analysis"
52+
uses: github/codeql-action/analyze@v2

.github/workflows/publish.yml

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1+
# GitHub Actions workflow to automatically create releases and publish to our maven repository.
12
name: "Publish"
23
on:
34
push:
4-
branches: ["main", "development"]
5+
branches: [ "main" ]
6+
7+
concurrency:
8+
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
9+
cancel-in-progress: true
510

611
env:
7-
JAVA_VERSION: 17
12+
JAVA_VERSION: 18
813

914
jobs:
10-
build:
15+
publish:
16+
name: "Publish"
1117
runs-on: "ubuntu-latest"
1218
steps:
13-
- uses: "actions/checkout@v3"
19+
- name: "Checkout repository"
20+
uses: "actions/checkout@v3"
1421

15-
- name: "Set up JDK ${{ env.JAVA_VERSION }}"
22+
- name: "Set up Java ${{ env.JAVA_VERSION }}"
1623
uses: actions/setup-java@v3
1724
with:
1825
java-version: "${{ env.JAVA_VERSION }}"
1926
distribution: "adopt"
2027

21-
- name: "Gradle build"
22-
uses: "gradle/gradle-build-action@v2"
23-
with:
24-
cache-read-only: "${{ github.ref != 'refs/heads/main' }}"
25-
gradle-version: "release-nightly"
26-
arguments: "build"
27-
2828
- name: "Determine version"
2929
run: |
3030
echo "VERSION=$(./gradlew properties | awk '/^version:/ { print $2; }')" >> $GITHUB_ENV
3131
3232
- name: "Create release"
33-
if: "${{ endsWith(env.VERSION, 'SNAPSHOT') || startsWith(github.ref, 'ref/heads/main/') }}"
34-
uses: "marvinpinto/action-automatic-releases@latest"
33+
uses: marvinpinto/action-automatic-releases@latest
3534
with:
3635
repo_token: "${{ secrets.GITHUB_TOKEN }}"
37-
automatic_release_tag: "${{ endsWith(env.VERSION, 'SNAPSHOT') && 'latest' || format('{0}{1}', 'v', env.VERSION) }}"
36+
automatic_release_tag: "v${{ env.VERSION }}"
3837
prerelease: "${{ endsWith(env.VERSION, 'SNAPSHOT') }}"
39-
title: "${{ endsWith(env.VERSION, 'SNAPSHOT') && 'Development Build' || format('{0}{1}', 'Bear v', env.VERSION) }}"
40-
files: |
41-
**/build/libs/*.jar
42-
!build/libs/*.jar
43-
!build-logic/libs/*.jar
44-
LICENSE
45-
SECURITY.md
46-
AUTHORS
38+
title: "Bear v${{ env.VERSION }}"
39+
40+
- name: "Import GPG key"
41+
uses: crazy-max/[email protected]
42+
with:
43+
gpg_private_key: "${{ secrets.GPG_PRIVATE_KEY }}"
4744

4845
- name: "Publish"
49-
if: "${{ endsWith(env.VERSION, 'SNAPSHOT') || startsWith(github.ref, 'ref/heads/main/') }}"
50-
run: "./gradlew publish"
46+
uses: gradle/gradle-build-action@v2
47+
with:
48+
arguments: "publish"
5149
env:
50+
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
51+
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
5252
ORG_GRADLE_PROJECT_hyperaReleasesUsername: "${{ secrets.HYPERA_RELEASES_USERNAME }}"
5353
ORG_GRADLE_PROJECT_hyperaReleasesPassword: "${{ secrets.HYPERA_RELEASES_PASSWORD }}"
5454
ORG_GRADLE_PROJECT_hyperaSnapshotsUsername: "${{ secrets.HYPERA_SNAPSHOTS_USERNAME }}"
+13-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
# GitHub Actions workflow to validate the Gradle wrappers.
12
name: "Validate Gradle wrapper"
2-
on: push
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
7+
cancel-in-progress: true
38

49
jobs:
510
validate:
11+
name: "Validate"
12+
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}"
613
runs-on: "ubuntu-latest"
714
steps:
8-
- uses: "actions/checkout@v3"
15+
16+
- name: "Checkout repository"
17+
uses: actions/checkout@v3
18+
919
- name: "Validate Gradle wrapper"
10-
uses: "gradle/wrapper-validation-action@v1"
20+
uses: gradle/wrapper-validation-action@v1

.idea/misc.xml

-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Joshua Sing
3+
Copyright (c) 2022-present Joshua Sing.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

renovate.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"extends": [
33
"config:base"
44
],
5-
"baseBranches": ["development"]
5+
"baseBranches": [
6+
"main"
7+
]
68
}

0 commit comments

Comments
 (0)