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

Upgrade to Java 21, fix Docker image, add server integration test #112

Merged
merged 10 commits into from
Jul 27, 2024

Conversation

StenAL
Copy link

@StenAL StenAL commented Jul 1, 2024

This PR is a collection of smaller changes:

  • The project is upgraded to the latest Java LTS version, Java 21. Features added since Java 17 include things like pattern matching, unnamed variables, and UTF-8 as the charset.
  • An integration test with a mocked client was added to the server to verify it's working as expected. This will be useful later when upgrading the server to Netty 4.1 to avoid breaking anything.
    • The testing revealed that previously messages sent from the server non-deterministic, i.e. sometimes TrackSets and Tracks were sent in one order and sometimes in another. Now these are sorted in the server to ensure the same message is sent every time and tests pass. This also fixes a bug where championship games did not run in the intended order and the games could start with the hardest tracks in the championship first.
  • The server Docker image was fixed and is now built in CI to ensure it won't break again. I accidentally broke it when upgrading the project to Java 17 earlier.
  • A bunch of dependencies were upgraded and warnings fixed to make build logs more readable.

StenAL added 10 commits July 1, 2024 09:41
This way, championship games run in the intended order, previously the
order tracks were read in was nondeterministic and the games could start
with the hardest track first.
Also, sort the list of TrackSets. This way the same message is sent from
the server to clients every time which makes testing easier.
This will be necessary in tests utilizing the server to prevent resource
leaks.
This test asserts that in a happy path flow where a player
1. starts the client
2. joins the single player lobby
3. starts a championship game
4. exits the game
all the packages match the expected state.
This is the latest Java LTS version, released in September 2023.
Features added since Java 17 include things like pattern matching,
unnamed variables, and UTF-8 as a default charset.
This has been broken ever since the upgrade to Java 11 and moving tracks
to server resources. Now it works again and is tested in CI to ensure it
won't break again.
This was logging a warning:
```
[WARNING] Supported source version 'RELEASE_8' from annotation processor 'org.softsmithy.lib.util.impl.ServiceProviderAnnotationProcessor' less than -source '21'
```

Since it's only used in a single test file and has a built-in
alternative API available it can be removed.
Since the shaded JARs (server, client, editor) are not intended to be
used as libraries, they should not generate a dependency-reduced POM.
See https://stackoverflow.com/a/65842502 for more information
Launch4j was logging warnings and using fallback values for these.
This was logging a warning: "non-varargs call of varargs method with
inexact argument type for last parameter".

Since the parameter was always null, it can be removed from the calls.
This caused a few new warnings to be logged:
- Mockito deprecated `.lenient`, fixed by replacing
  with call to `.strictness`
- Running tests from Intellij caused Mockito to log warnings,
  fixed by adding the "-XX:+EnableDynamicAgentLoading" argument to the
  compiler. See https://stackoverflow.com/a/78056291 for more
  information.
- name: Build Docker image
uses: docker/build-push-action@v5
with:
tags: philippvk/minigolf:latest
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I will have to add the access token as a repo secret?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this pushing to docker.io or https://quay.io/repository/philippvk/minigolf?

Copy link
Author

@StenAL StenAL Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if you want CI to push the image to a Docker repo. In it's current form, CI will just build the image to make sure it doesn't break unexpectedly. It doesn't publish the image anywhere.

@PhilippvK
Copy link
Owner

@StenAL sorry for the delay, I will try to test your changes tomorrow and provide a review!

@PhilippvK
Copy link
Owner

Looks good, thank you for the patches!

@PhilippvK PhilippvK merged commit 1749814 into PhilippvK:master Jul 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants