-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub Actions script with config for publishing and codenarc
- Loading branch information
1 parent
cfaef96
commit e2ca954
Showing
3 changed files
with
610 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | ||
|
||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ "**" ] | ||
pull_request: | ||
branches: [ "**" ] | ||
|
||
permissions: | ||
contents: read | ||
actions: read | ||
checks: write | ||
security-events: write | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
env: | ||
GRADLE_OPTS: -Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g -Xmx1024m" | ||
|
||
services: | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_USER: sandbox | ||
POSTGRES_DB: sandbox | ||
POSTGRES_PASSWORD: sandbox | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 1s | ||
--health-timeout 5s | ||
--health-retries 50 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
with: | ||
cache-disabled: true | ||
build-scan-publish: true | ||
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" | ||
build-scan-terms-of-use-agree: "yes" | ||
|
||
- name: Core gradle info | ||
run: | | ||
./gradlew -v | ||
./gradlew jvmArgs sysProps | ||
- name: Grails info | ||
run: | | ||
./grailsw -v | ||
- name: License header check | ||
run: | | ||
./gradlew license | ||
# - name: Unit Tests | ||
# run: ./gradlew test --no-daemon --stacktrace -Duser.language=en -Duser.country=GB | ||
|
||
# - name: Unit Test Report | ||
# uses: dorny/test-reporter@v1 | ||
# if: success() || failure() | ||
# with: | ||
# name: Unit Test Results | ||
# path: '**/build/test-results/**/*.xml' | ||
# reporter: java-junit | ||
# list-tests: 'failed' | ||
|
||
- name: Integration Tests | ||
run: | | ||
./gradlew -Dgradle.integrationTest=true integrationTest | ||
- name: Integration Test Report | ||
uses: dorny/test-reporter@v1 | ||
if: success() || failure() | ||
with: | ||
name: Integration Test Results | ||
path: '**/build/test-results/integrationTest/*.xml' | ||
reporter: java-junit | ||
list-tests: 'failed' | ||
|
||
- name: MegaLinter | ||
uses: oxsecurity/megalinter/flavors/ci_light@v8 | ||
env: | ||
# All available variables are described in documentation | ||
# https://megalinter.io/configuration/ | ||
VALIDATE_ALL_CODEBASE: true | ||
ENABLE_LINTERS: GROOVY_NPM_GROOVY_LINT | ||
LINTER_RULES_PATH: 'config/codenarc' | ||
DISABLE_ERRORS: true #Flag to have the linter complete with exit code 0 even if errors were detected. | ||
SARIF_REPORTER: true | ||
|
||
# This is currently too big for the security tab | ||
# - name: Upload MegaLinter scan results to GitHub Security tab | ||
# if: success() || failure() | ||
# uses: github/codeql-action/upload-sarif@v2 | ||
# with: | ||
# sarif_file: 'megalinter-reports/megalinter-report.sarif' | ||
|
||
|
||
# Upload MegaLinter artifacts | ||
- name: Archive lint reports | ||
if: success() || failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: MegaLinter reports | ||
path: | | ||
megalinter-reports | ||
mega-linter.log | ||
- name: Publish Snapshot to Mauro Snapshot Repository | ||
if: success() && github.ref == 'refs/heads/develop' | ||
run: | | ||
./gradlew --stacktrace -PMauroSnapshotRepositoryUsername=${{secrets.MAURO_SNAPSHOT_REPOSITORY_USERNAME}} -PMauroSnapshotRepositoryPassword=${{secrets.MAURO_SNAPSHOT_REPOSITORY_PASSWORD}} publishAllPublicationsToMauroSnapshotRepositoryRepository | ||
|
||
- name: Send a stream message | ||
if: success() || failure() | ||
uses: zulip/github-actions-zulip/send-message@v1 | ||
with: | ||
api-key: ${{ secrets.ZULIP_API_KEY }} | ||
email: "githubactionsbot-bot@maurodatamapper.zulipchat.com" | ||
organization-url: "https://maurodatamapper.zulipchat.com" | ||
to: "build/github-actions" | ||
type: "stream" | ||
topic: "${{github.repository}}" | ||
content: "${{ job.status == 'success' && ':check_mark:' || ':cross_mark:' }} ${{github.repository}} : **${{github.ref}}**\nGitHub Actions build result: **${{ job.status }}**\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.