From e337a637122b1619d0985a2a578104e77fbcbb2d Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Wed, 5 Jul 2023 20:57:56 +0100 Subject: [PATCH] Bump FG and Loom Also split up CI steps a little, so that it's more clear what failed. --- .github/workflows/main-ci.yml | 39 ++++++++++--------- .../gradle/common/util/runs/RunConfigSetup.kt | 31 +++------------ gradle/libs.versions.toml | 4 +- 3 files changed, 29 insertions(+), 45 deletions(-) diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml index 8baff3d9c..d94091eb9 100644 --- a/.github/workflows/main-ci.yml +++ b/.github/workflows/main-ci.yml @@ -8,16 +8,16 @@ jobs: runs-on: ubuntu-latest steps: - - name: Clone repository + - name: ๐Ÿ“ฅ Clone repository uses: actions/checkout@v3 - - name: Set up Java + - name: ๐Ÿ“ฅ Set up Java uses: actions/setup-java@v3 with: java-version: 17 distribution: 'temurin' - - name: Setup Gradle + - name: ๐Ÿ“ฅ Setup Gradle uses: gradle/gradle-build-action@v2 with: cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/mc-') }} @@ -27,42 +27,45 @@ jobs: mkdir -p ~/.gradle echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties - - name: Build with Gradle + - name: โš’๏ธ Build run: ./gradlew assemble || ./gradlew assemble - - name: Download assets for game tests + - name: ๐Ÿ’ก Lint + uses: pre-commit/action@v3.0.0 + + - name: ๐Ÿงช Run tests + run: ./gradlew test validateMixinNames checkChangelog + + - name: ๐Ÿ“ฅ Download assets for game tests run: ./gradlew downloadAssets || ./gradlew downloadAssets - - name: Run tests and linters - run: ./gradlew build + - name: ๐Ÿงช Run integration tests + run: ./gradlew runGametest - - name: Run client tests + - name: ๐Ÿงช Run client tests run: ./gradlew runGametestClient # Not checkClient, as no point running rendering tests. # These are a little flaky on GH actions: its useful to run them, but don't break the build. continue-on-error: true - - name: Prepare Jars + - name: ๐Ÿงช Parse test reports + run: ./tools/parse-reports.py + if: ${{ failure() }} + + - name: ๐Ÿ“ฆ Prepare Jars run: | # Find the main jar and append the git hash onto it. mkdir -p jars find projects/forge/build/libs projects/fabric/build/libs -type f -regex '.*[0-9.]+\(-SNAPSHOT\)?\.jar$' -exec bash -c 'cp {} "jars/$(basename {} .jar)-$(git rev-parse HEAD).jar"' \; - - name: Upload Jar + - name: ๐Ÿ“ค Upload Jar uses: actions/upload-artifact@v3 with: name: CC-Tweaked path: ./jars - - name: Upload coverage + - name: ๐Ÿ“ค Upload coverage uses: codecov/codecov-action@v3 - - name: Parse test reports - run: ./tools/parse-reports.py - if: ${{ failure() }} - - - name: Run linters - uses: pre-commit/action@v3.0.0 - build-core: strategy: fail-fast: false diff --git a/buildSrc/src/main/kotlin/net/minecraftforge/gradle/common/util/runs/RunConfigSetup.kt b/buildSrc/src/main/kotlin/net/minecraftforge/gradle/common/util/runs/RunConfigSetup.kt index 50e33a84b..a74d0008d 100644 --- a/buildSrc/src/main/kotlin/net/minecraftforge/gradle/common/util/runs/RunConfigSetup.kt +++ b/buildSrc/src/main/kotlin/net/minecraftforge/gradle/common/util/runs/RunConfigSetup.kt @@ -30,41 +30,22 @@ internal fun setRunConfigInternal(project: Project, spec: JavaExecSpec, config: val originalTask = project.tasks.named(config.taskName, MinecraftRunTask::class.java) // Add argument and JVM argument via providers, to be as lazy as possible with fetching artifacts. - fun lazyTokens(): MutableMap> { - return RunConfigGenerator.configureTokensLazy( - project, config, RunConfigGenerator.mapModClassesToGradle(project, config), - originalTask.get().minecraftArtifacts.files, - originalTask.get().runtimeClasspathArtifacts.files, - ) - } + val lazyTokens = RunConfigGenerator.configureTokensLazy( + project, config, RunConfigGenerator.mapModClassesToGradle(project, config), + originalTask.get().minecraftArtifacts, + originalTask.get().runtimeClasspathArtifacts, + ) spec.argumentProviders.add( CommandLineArgumentProvider { - RunConfigGenerator.getArgsStream(config, lazyTokens(), false).toList() + RunConfigGenerator.getArgsStream(config, lazyTokens, false).toList() }, ) spec.jvmArgumentProviders.add( CommandLineArgumentProvider { - val lazyTokens = lazyTokens() (if (config.isClient) config.jvmArgs + originalTask.get().additionalClientArgs.get() else config.jvmArgs).map { config.replace(lazyTokens, it) } + config.properties.map { (k, v) -> "-D${k}=${config.replace(lazyTokens, v)}" } }, ) - // We can't configure environment variables lazily, so we do these now with a more minimal lazyTokens set. - val lazyTokens = mutableMapOf>() - for ((k, v) in config.tokens) lazyTokens[k] = Supplier { v } - for ((k, v) in config.lazyTokens) lazyTokens[k] = v - lazyTokens.compute( - "source_roots", - { _, sourceRoots -> - Supplier { - val modClasses = RunConfigGenerator.mapModClassesToGradle(project, config) - (when (sourceRoots) { - null -> modClasses - else -> Stream.concat(sourceRoots.get().split(File.pathSeparator).stream(), modClasses) - }).distinct().collect(Collectors.joining(File.pathSeparator)) - } - }, - ) for ((key, value) in config.environment) spec.environment(key, config.replace(lazyTokens, value)) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9152cadaa..d3e1f4fc4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -53,8 +53,8 @@ checkstyle = "10.3.4" curseForgeGradle = "1.0.14" errorProne-core = "2.18.0" errorProne-plugin = "3.0.1" -fabric-loom = "1.2.7" -forgeGradle = "6.0.6" +fabric-loom = "1.3.7" +forgeGradle = "6.0.8" githubRelease = "2.2.12" ideaExt = "1.1.6" illuaminate = "0.1.0-28-ga7efd71"