mirror of
https://github.com/actions/setup-java.git
synced 2026-04-07 06:48:53 +00:00
Address copilot warnings: fix unused abi var, add pagination test, document CRaC in README
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/50c422d6-fd37-4e0b-a22c-a3745f876e7b Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
This commit is contained in:
parent
3140bcf59b
commit
301143a197
@ -40,7 +40,7 @@ For information about the latest releases, recent updates, and newly supported d
|
||||
|
||||
- `distribution`: _(required)_ Java [distribution](#supported-distributions).
|
||||
|
||||
- `java-package`: The packaging variant of the chosen distribution. Possible values: `jdk`, `jre`, `jdk+fx`, `jre+fx`. Default value: `jdk`.
|
||||
- `java-package`: The packaging variant of the chosen distribution. Possible values: `jdk`, `jre`, `jdk+fx`, `jre+fx`. For Azul Zulu, `jdk+crac` and `jre+crac` are also supported to select builds with [CRaC](https://openjdk.org/projects/crac/) support. Default value: `jdk`.
|
||||
|
||||
- `architecture`: The target architecture of the package. Possible values: `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`. Default value: Derived from the runner machine.
|
||||
|
||||
|
||||
@ -164,6 +164,28 @@ describe('getAvailableVersions', () => {
|
||||
const availableVersions = await distribution['getAvailableVersions']();
|
||||
expect(availableVersions).toHaveLength(manifestData.length);
|
||||
});
|
||||
|
||||
it('fetches multiple pages when first page is full', async () => {
|
||||
const firstPage = Array(100).fill(manifestData[0]) as IZuluVersions[];
|
||||
const secondPage = manifestData.slice(0, 5) as IZuluVersions[];
|
||||
|
||||
spyHttpClient
|
||||
.mockReturnValueOnce({statusCode: 200, headers: {}, result: firstPage})
|
||||
.mockReturnValueOnce({statusCode: 200, headers: {}, result: secondPage});
|
||||
|
||||
const distribution = new ZuluDistribution({
|
||||
version: '11',
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getPlatformOption'] = () => 'linux';
|
||||
|
||||
const availableVersions = await distribution['getAvailableVersions']();
|
||||
|
||||
expect(spyHttpClient).toHaveBeenCalledTimes(2);
|
||||
expect(availableVersions).toHaveLength(firstPage.length + secondPage.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getArchitectureOptions', () => {
|
||||
|
||||
@ -61,10 +61,25 @@ steps:
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '21'
|
||||
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
|
||||
java-package: jdk # optional (jdk, jre, jdk+fx, jre+fx, jdk+crac or jre+crac) - defaults to jdk
|
||||
- run: java -cp java HelloWorldApp
|
||||
```
|
||||
|
||||
To use a Zulu JDK build with [CRaC (Coordinated Restore at Checkpoint)](https://openjdk.org/projects/crac/) support, set `java-package` to `jdk+crac` or `jre+crac`:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '21'
|
||||
java-package: jdk+crac
|
||||
- run: java -cp java HelloWorldApp
|
||||
```
|
||||
|
||||
> **Note:** CRaC builds are only available for specific Zulu versions on Linux. The default (`jdk`) selects non-CRaC builds.
|
||||
|
||||
### Liberica
|
||||
|
||||
```yaml
|
||||
|
||||
@ -100,7 +100,7 @@ export class ZuluDistribution extends JavaBase {
|
||||
}
|
||||
|
||||
private async getAvailableVersions(): Promise<IZuluVersions[]> {
|
||||
const {arch, hw_bitness, abi} = this.getArchitectureOptions();
|
||||
const {arch, hw_bitness} = this.getArchitectureOptions();
|
||||
const [bundleType, features] = this.packageType.split('+');
|
||||
const platform = this.getPlatformOption();
|
||||
const extension = getDownloadArchiveExtension();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user