Skip to content

fix: license headers and tests #36

fix: license headers and tests

fix: license headers and tests #36

Workflow file for this run

name: Commit
on:
push:
branches: [ 'minecraft/*' ]
jobs:
validate-wrapper:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
initialize:
needs: validate-wrapper
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Cache gradle dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle/loom-cache
key: ${{ runner.os }}-gradle-${{github.ref_name}}-${{ hashFiles('gradle/gradle-wrapper.properties', 'settings.gradle.kts', 'build.gradle.kts', 'gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-${{github.ref_name}}-
${{ runner.os }}-gradle-
- name: Initialize caches
run: ./gradlew --no-daemon
license-headers:
needs: initialize
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Restore gradle cache
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle/loom-cache
key: ${{ runner.os }}-gradle-${{github.ref_name}}-${{ hashFiles('gradle/gradle-wrapper.properties', 'settings.gradle.kts', 'build.gradle.kts', 'gradle.properties') }}
- name: License headers
run: ./gradlew checkLicenses --no-daemon
build:
needs: initialize
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Restore gradle cache
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle/loom-cache
key: ${{ runner.os }}-gradle-${{github.ref_name}}-${{ hashFiles('gradle/gradle-wrapper.properties', 'settings.gradle.kts', 'build.gradle.kts', 'gradle.properties') }}
- name: Build
run: ./gradlew assemble testClasses -x checkLicenses --no-daemon
- name: Cache build output
uses: actions/cache/save@v3
with:
path: |
.gradle/
!.gradle/loom-cache
build/
key: ${{ runner.os }}-build-${{ github.sha }}
analysis:
needs: initialize
runs-on: ubuntu-22.04
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Restore gradle cache
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle/loom-cache
key: ${{ runner.os }}-gradle-${{github.ref_name}}-${{ hashFiles('gradle/gradle-wrapper.properties', 'settings.gradle.kts', 'build.gradle.kts', 'gradle.properties') }}
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: java
- name: Build
run: ./gradlew assemble testClasses -x checkLicenses --no-daemon
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
test:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Restore gradle cache
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle/loom-cache
key: ${{ runner.os }}-gradle-${{github.ref_name}}-${{ hashFiles('gradle/gradle-wrapper.properties', 'settings.gradle.kts', 'build.gradle.kts', 'gradle.properties') }}
- name: Restore cached build output
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: |
.gradle/
!.gradle/loom-cache
build/
key: ${{ runner.os }}-build-${{ github.sha }}
- name: Test
run: ./gradlew test --no-daemon
# gametest:
# needs: build
# runs-on: ubuntu-22.04
#
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
#
# - name: Setup JDK 17
# uses: actions/setup-java@v4
# with:
# java-version: 17
# distribution: temurin
#
# - name: Restore gradle cache
# uses: actions/cache/restore@v3
# with:
# fail-on-cache-miss: true
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# .gradle/loom-cache
# key: ${{ runner.os }}-gradle-${{github.ref_name}}-${{ hashFiles('gradle/gradle-wrapper.properties', 'settings.gradle.kts', 'build.gradle.kts', 'gradle.properties') }}
#
# - name: Restore cached build output
# uses: actions/cache/restore@v3
# with:
# fail-on-cache-miss: true
# path: |
# .gradle/
# !.gradle/loom-cache
# build/
# key: ${{ runner.os }}-build-${{ github.sha }}
#
# - name: Gametest
# run: ./gradlew runGametest --no-daemon
publish:
needs: [test, license-headers, analysis]
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Restore gradle cache
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle/loom-cache
key: ${{ runner.os }}-gradle-${{github.ref_name}}-${{ hashFiles('gradle/gradle-wrapper.properties', 'settings.gradle.kts', 'build.gradle.kts', 'gradle.properties') }}
- name: Restore cached build output
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: |
.gradle/
!.gradle/loom-cache
build/
key: ${{ runner.os }}-build-${{ github.sha }}
- name: Publish
run: ./gradlew publish -x test --no-daemon
env:
BUILD_NUMBER: ${{ github.run_number }}
NEXUS_REPOSITORY_URL: ${{ secrets.NEXUS_RELEASE_URL }}
NEXUS_USER: ${{ secrets.NEXUS_USER }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}