Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEST to look at Gh build vs tip #7247

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4213a98
Added initial GH action support
Vest Nov 22, 2024
4d6772e
Upgraded gradle wrapper to 8.11.1.
Vest Nov 22, 2024
89188be
Added testing to gh-action.
Vest Nov 22, 2024
3d1400a
First attempt to log data in test. It failed in GH actions.
Vest Nov 22, 2024
2cf3d44
Added the logging to all tests.
Vest Nov 22, 2024
0f6b522
Added gradle cache to a github action setup-java.
Vest Nov 22, 2024
3e474f9
Disabled logging, but added the test results upload.
Vest Nov 22, 2024
44a4cd7
Enabled "write" permissions for test results
Vest Nov 22, 2024
ccf45fd
Refactored TestHelper.java
Vest Nov 22, 2024
78968a1
Updated cache-dependency-path.
Vest Nov 25, 2024
797b24f
First attempt to cache build/classes and build/jre
Vest Nov 25, 2024
4b2d667
Corrected a typo in gradle.yml
Vest Nov 25, 2024
38eab4b
Try to clear the cache and fill it with values.
Vest Nov 25, 2024
2af5e06
Merge branch 'master' into gh_build
Vest Dec 20, 2024
5b85e17
First step to remove NSIS from the distro;
Vest Dec 22, 2024
ea32a3a
Performance optimization: the debugPrint (when called frequently) use…
Vest Dec 22, 2024
4effb4f
Refactored Logging.java.
Vest Dec 22, 2024
c8495ca
Upgraded gradle-wrapper from 8.11.1 to 8.12
Vest Dec 24, 2024
505d668
Remove .run/ from git repository, because it tracked by mistake in #7056
Vest Dec 24, 2024
5dfc7e0
Refactored several classes. The main goal was adding the Optional to …
Vest Dec 24, 2024
efd9bd9
Merge pull request #2 from PCGen/master
Vest Dec 24, 2024
e049370
Corrected pf_Cleric test;
Vest Dec 27, 2024
e29ad64
Remove "public" and "abstract" for several interfaces (redundant)
Vest Dec 27, 2024
f6466bf
Merge branch 'master' into gh_build
Vest Jan 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 62 additions & 11 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,70 @@
name: Java CI
# 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

on: [push]
name: Build PCGen with Gradle

on:
push:
branches: [ "gh_build" ] # use current branch for testing purposes only
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write

steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Build with Gradle
run: ./gradlew build
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
cache-dependency-path: |
build.gradle
code/gradle/autobuild.gradle
code/gradle/distribution.gradle
code/gradle/release.gradle
code/gradle/reporting.gradle

# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-disabled: false
cache-read-only: false
cache-overwrite-existing: true

- uses: actions/cache@v4
with:
path: |
build/classes
build/jre
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build with Gradle Wrapper
run: ./gradlew build test slowtest

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
build/test-results/**/*.xml
build/test-results/**/*.trx
build/test-results/**/*.json

# - name: Upload build artifacts
# uses: actions/upload-artifact@v4
# with:
# name: Package
# path: build/libs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ code/build.eclipse/

# IntelliJ IDE
.idea/
.run/
out/
pcgendev.iml
pcgen.iml
Expand Down
11 changes: 0 additions & 11 deletions .run/Main.run.xml

This file was deleted.

6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,10 @@ tasks.named("jre") {
dependsOn downloadJRE, downloadJavaFXModules
}

tasks.withType(Test) {
testLogging.showStandardStreams = false
}

tasks.named("test", Test) {
exclude 'pcgen/testsupport/**'
useJUnitPlatform()
Expand Down Expand Up @@ -951,7 +955,7 @@ apply from: 'code/gradle/reporting.gradle'
apply from: 'code/gradle/release.gradle'

tasks.register("allTasks") {
dependsOn build, slowtest, javadoc, buildNsis, allReports
dependsOn build, slowtest, javadoc, allReports
description = "Runs tasks build, slowtest, javadoc, buildNsis and allReports"
}

Expand Down
5 changes: 1 addition & 4 deletions code/gradle/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ tasks.register("sourcesJar", Jar) {
}

tasks.register("assembleArtifacts", Copy) {
dependsOn build, runtimeZip, sourcesJar, buildNsis
dependsOn build, runtimeZip, sourcesJar

if (Os.isFamily(Os.FAMILY_MAC) || Os.isFamily(Os.FAMILY_UNIX))
{
Expand All @@ -431,9 +431,6 @@ tasks.register("assembleArtifacts", Copy) {
into releaseDir
// buildNsis puts the exe into the release folder directly

from(layout.buildDirectory.dir("nsisRelease")){
include '*.exe'
}
from(layout.buildDirectory.dir("libs")){
include 'pcgen*-sources.jar'
}
Expand Down
3 changes: 1 addition & 2 deletions code/src/java/pcgen/cdom/base/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
@SuppressWarnings("PMD.ConstantsInInterface")
public interface Constants
{

/********************************************************************
* Static definitions of Equipment location strings
********************************************************************/
Expand Down Expand Up @@ -111,7 +110,7 @@ public interface Constants
String INTERNAL_WEAPON_PROF = "PCGENi_WEAPON_PROFICIENCY"; //$NON-NLS-1$

/** Line Separator. */
String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
String LINE_SEPARATOR = System.lineSeparator(); //$NON-NLS-1$

/** The constant string "None". */
String NONE = "None"; //$NON-NLS-1$
Expand Down
12 changes: 6 additions & 6 deletions code/src/java/pcgen/core/Globals.java
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,8 @@ public static void clearCampaignsForRefresh()

/**
* Check if enough data has been loaded to support character creation.
* Will also report to the log the number of items of each of the
* necessary types that are currently loaded.
* Will also report to the log the number of items of each of the
* necessary types that are currently loaded.
* @return true or false
*/
public static boolean displayListsHappy()
Expand Down Expand Up @@ -722,7 +722,7 @@ public static boolean selectPaper(final String paperName)
}

/**
* Apply the user's preferences to the initial state of the Globals.
* Apply the user's preferences to the initial state of the Globals.
*/
public static void initPreferences()
{
Expand Down Expand Up @@ -789,8 +789,8 @@ static List<? extends CDOMObject> sortPObjectList(final List<? extends CDOMObjec

/**
* Sort Pcgen Object list by name
* @param <T>
*
* @param <T>
*
* @param aList
* @return Sorted list of Pcgen Objects
*/
Expand Down Expand Up @@ -1033,7 +1033,7 @@ else if (fType.equals("mac_user"))

private static int bonusParsing(final String l, final int level, int num, final PlayerCharacter aPC)
{
// should be in format levelnum,rangenum[,numchoices]
// should be in format levelnum,rangenum[,numchoices]
final StringTokenizer aTok = new StringTokenizer(l, "|", false);
final int startLevel = Integer.parseInt(aTok.nextToken());
final String rangeLevelFormula = aTok.nextToken();
Expand Down
8 changes: 7 additions & 1 deletion code/src/java/pcgen/core/PlayerCharacter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5477,7 +5477,13 @@ public int processOldMaxDex()
{
final int statBonus = (int) getStatBonusTo("MISC", "MAXDEX");
final Load load = getHouseRuledLoadType();
int bonus = (load == Load.MEDIUM) ? 2 : (load == Load.HEAVY) ? 1 : (load == Load.OVERLOAD) ? 0 : statBonus;
int bonus = switch (load)
{
case MEDIUM -> 3;
case HEAVY -> 1;
case OVERLOAD -> 0;
default -> statBonus;
};

// If this is still true after all the equipment has been
// examined, then we should use the Maximum - Maximum Dex modifier.
Expand Down
8 changes: 3 additions & 5 deletions code/src/java/pcgen/gui2/PCGenFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,7 @@ public void run()
updateTitle();
}

// TODO there are no examples with licenses. Either remove this or add a test.
private void showLicenses()
{
PropertyContext context = PCGenSettings.OPTIONS_CONTEXT;
Expand All @@ -1576,11 +1577,8 @@ private void showLicenses()
{
showLicenseDialog(LanguageBundle.getString("in_specialLicenses"), licenses); //$NON-NLS-1$
}
for (String license : loader.getOtherLicenses())
{
showLicenseDialog(LanguageBundle.getString("in_specialLicenses"), license); //$NON-NLS-1$
}

loader.getOtherLicenses()
.forEach(license -> showLicenseDialog(LanguageBundle.getString("in_specialLicenses"), license)); //$NON-NLS-1$
}
}
if (loader.hasMatureCampaign() && context.initBoolean(PCGenSettings.OPTION_SHOW_MATURE_ON_LOAD, true))
Expand Down
Loading
Loading