diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..e898918848a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,71 @@ +name: Java CI + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Build Distribution for Launcher + run: ./gradlew extractConfig extractNatives distForLauncher testDist + - name: Unit Tests + run: ./gradlew unitTest + - name: API Documentation + run: ./gradlew javadoc + - name: Publish + run: echo "TODO" + integration-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Integration Tests + run: ./gradlew integrationTest + code-analysis: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Static Code Analysis + run: ./gradlew check -x test + build-with-scan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Build With Gradlew + run: ./gradlew -PacceptGradleBuildScanTermsOfService=yes distForLauncher --scan \ No newline at end of file diff --git a/build-logic/src/main/kotlin/terasology-metrics.gradle.kts b/build-logic/src/main/kotlin/terasology-metrics.gradle.kts index 123664364e4..92e10afa33d 100644 --- a/build-logic/src/main/kotlin/terasology-metrics.gradle.kts +++ b/build-logic/src/main/kotlin/terasology-metrics.gradle.kts @@ -45,7 +45,7 @@ tasks.withType { useJUnitPlatform() // ignoreFailures: Specifies whether the build should break when the verifications performed by this task fail. - ignoreFailures = true + ignoreFailures = false // showStandardStreams: makes the standard streams (err and out) visible at console when running tests // If false, the outputs are still collected and visible in the test report, but they don't spam the console. testLogging.showStandardStreams = false diff --git a/build.gradle b/build.gradle index dff4da47618..998b4e4ec2c 100644 --- a/build.gradle +++ b/build.gradle @@ -281,6 +281,18 @@ cleanIdea.doLast { new File('Terasology.iws').delete() } +if (hasProperty('buildScan') + // allow to programmically accept the Gradle Build Scan terms of service when running in CI + && project.hasProperty('acceptGradleBuildScanTermsOfService') + && project.acceptGradleBuildScanTermsOfService == 'yes') { + gradleEnterprise { + buildScan { + termsOfServiceUrl = "https://gradle.com/terms-of-service" + termsOfServiceAgree = "yes" + } + } +} + // A task to assemble various files into a single zip for distribution as 'build-harness.zip' for module builds task assembleBuildHarness(type: Zip) { description 'Assembles a zip of files useful for module development'