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

feat(datasource/unity3d): Use Unity Releases API #33240

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

bdovaz
Copy link
Contributor

@bdovaz bdovaz commented Dec 22, 2024

Changes

The API has been changed to use the new Unity Releases API instead of the "old RSS system".

The new API is richer in metadata, allows more granularity by having queries (number of results, stream, os, architecture, version, ...). Example: https://services.api.unity.com/unity/editor/release/v1/releases?stream=LTS&platform=WINDOWS&architecture=X86_64

I have removed many tests that no longer make sense and were there before because of the inconsistencies of the RSS system. This new API has filters and these inconsistencies no longer occur.

I have also aligned the Unity terminology of streams (lts, tech, alpha, beta).

Context

Unity Releases API: https://services.docs.unity.com/release/v1/#tag/Release/operation/getUnityReleases

Example call: https://services.api.unity.com/unity/editor/release/v1/releases?stream=LTS

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

lib/modules/datasource/unity3d/types.ts Outdated Show resolved Hide resolved
lib/modules/datasource/unity3d/index.ts Show resolved Hide resolved
lib/modules/datasource/unity3d/index.ts Show resolved Hide resolved
@viceice viceice added the breaking Breaking change, requires major version bump label Dec 22, 2024
@rarkins rarkins requested a review from viceice January 7, 2025 10:31
@bdovaz
Copy link
Contributor Author

bdovaz commented Jan 8, 2025

@viceice apparently there is nothing pending, can you merge now? Thanks!

@rarkins rarkins enabled auto-merge January 8, 2025 10:03
@bdovaz
Copy link
Contributor Author

bdovaz commented Jan 26, 2025

@rarkins @viceice ping! Merge please! I want to work on #28189 next

auto-merge was automatically disabled January 26, 2025 12:55

Head branch was pushed to by a user without write access

@bdovaz
Copy link
Contributor Author

bdovaz commented Jan 26, 2025

Also, you can remove the breaking tag because as you already asked me, I made it backwards compatible. There are tests for it.

@rarkins rarkins removed the breaking Breaking change, requires major version bump label Jan 27, 2025
rarkins
rarkins previously approved these changes Jan 27, 2025
httpMock.scope(uri.origin).get(uri.pathname).reply(200, content);
httpMock
.scope(uri.origin)
.get(uri.pathname + uri.search)
Copy link
Member

Choose a reason for hiding this comment

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

use string template instead of + concat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

].map((fixture) => [fixture, Fixtures.get(fixture + '.xml')]),
[...Object.keys(Unity3dDatasource.streams)].map((fixture) => [
fixture,
Fixtures.get(fixture + '.json'),
Copy link
Member

Choose a reason for hiding this comment

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

see comment below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Read below comment

);

if (legacyKey) {
if (legacyKey === 'stable') {
Copy link
Member

Choose a reason for hiding this comment

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

so stable and lts are effective the same stream?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you notice, the “stable” url of the old API points to: https://unity.com/releases/editor/releases.xml

And it redirects to the “lts” url of the old API.

};

response.body.results.forEach((release) => {
Copy link
Member

Choose a reason for hiding this comment

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

use for-of loop instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

lib/modules/datasource/unity3d/index.ts Outdated Show resolved Hide resolved
const UnityRelease = z.object({
version: z.string(),
releaseDate: z.string(),
releaseNotes: UnityReleaseNote,
Copy link
Member

Choose a reason for hiding this comment

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

are you sure this object always exists for all packages / streams?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I followed the instructions in the official API documentation: https://services.docs.unity.com/release/v1/#tag/Release/operation/getUnityReleases

@@ -6,7 +6,7 @@ import type { VersioningApi } from '../types';
export const id = 'unity3d';
export const displayName = 'Unity3D';
export const urls = [
'https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html#version-define-expressions',
'https://docs.unity3d.com/Manual/assembly-definition-includes.html',
Copy link
Member

Choose a reason for hiding this comment

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

if you move it to a separate docs PR then it'll merged faster

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! #33927

@bdovaz
Copy link
Contributor Author

bdovaz commented Jan 29, 2025

All comments answered and all the changes you requested are done @viceice

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.

3 participants