Move checkstyle testing to testAndGenerateReleaseFile #17
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
# 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: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
# This tests if the application can be built on all platforms (no tests / checkstyle) | |
buildOnAllPlatforms: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
permissions: | |
contents: read | |
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@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | |
- name: Build with Gradle Wrapper | |
run: ./gradlew clean build -x test -x checkstyleMain -x checkStyleTest | |
# This tests if the build, checkstyle and jUnit tests pass, then | |
testAndGenerateReleaseFile: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
permissions: | |
contents: read | |
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@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | |
- name: run checkstyle | |
run: ./gradlew checkstyleTest checkstyleMain | |
- name: run gradle test | |
run: ./gradlew test | |
- name: build Jar file | |
run: ./gradlew shadowJar | |
- name: Release Jar file | |
uses: phuonghuynh/action-ghrelease@v1.1.0 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
# Note-worthy description of changes in release | |
body: This release is automated with github actions. | |
# body_path: ${{ github.workspace }}-CHANGELOG.txt | |
# Gives the release a custom name. Defaults to tag name | |
name: (${{github.ref_name}}) New Jar File Release! | |
# Newline-delimited list of path globs for asset files to upload | |
files: ./build/libs/yappingbot.jar |