diff --git a/__tests__/data/liberica-linux.json b/__tests__/data/liberica-linux.json new file mode 100644 index 000000000..778265688 --- /dev/null +++ b/__tests__/data/liberica-linux.json @@ -0,0 +1,443 @@ +[ + { + "buildVersion": 36, + "updateVersion": 0, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14+36/bellsoft-jdk14+36-linux-amd64.zip", + "interimVersion": 0, + "version": "14+36", + "featureVersion": 14 + }, + { + "buildVersion": 9, + "updateVersion": 11, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.11+9/bellsoft-jdk11.0.11+9-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.11+9", + "featureVersion": 11 + }, + { + "buildVersion": 8, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.1+8/bellsoft-jdk14.0.1+8-linux-amd64.zip", + "interimVersion": 0, + "version": "14.0.1+8", + "featureVersion": 14 + }, + { + "buildVersion": 10, + "updateVersion": 262, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u262+10/bellsoft-jdk8u262+10-linux-amd64.zip", + "interimVersion": 0, + "version": "8u262+10", + "featureVersion": 8 + }, + { + "buildVersion": 1, + "updateVersion": 275, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u275+1/bellsoft-jdk8u275+1-linux-amd64.zip", + "interimVersion": 0, + "version": "8u275+1", + "featureVersion": 8 + }, + { + "buildVersion": 1, + "updateVersion": 9, + "patchVersion": 1, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9.1+1/bellsoft-jdk11.0.9.1+1-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.9.1+1", + "featureVersion": 11 + }, + { + "buildVersion": 8, + "updateVersion": 202, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u202/bellsoft-jdk8u202-linux-amd64.zip", + "interimVersion": 0, + "version": "8u202+8", + "featureVersion": 8 + }, + { + "buildVersion": 33, + "updateVersion": 0, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12/bellsoft-jdk12-linux-amd64.zip", + "interimVersion": 0, + "version": "12+33", + "featureVersion": 12 + }, + { + "buildVersion": 8, + "updateVersion": 282, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u282+8/bellsoft-jdk8u282+8-linux-amd64.zip", + "interimVersion": 0, + "version": "8u282+8", + "featureVersion": 8 + }, + { + "buildVersion": 11, + "updateVersion": 9, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+11/bellsoft-jdk11.0.9+11-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.9+11", + "featureVersion": 11 + }, + { + "buildVersion": 33, + "updateVersion": 0, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13/bellsoft-jdk13-linux-amd64.zip", + "interimVersion": 0, + "version": "13+33", + "featureVersion": 13 + }, + { + "buildVersion": 12, + "updateVersion": 9, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+12/bellsoft-jdk11.0.9+12-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.9+12", + "featureVersion": 11 + }, + { + "buildVersion": 7, + "updateVersion": 242, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u242+7/bellsoft-jdk8u242+7-linux-amd64.zip", + "interimVersion": 0, + "version": "8u242+7", + "featureVersion": 8 + }, + { + "buildVersion": 9, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.2+9/bellsoft-jdk13.0.2+9-linux-amd64.zip", + "interimVersion": 0, + "version": "13.0.2+9", + "featureVersion": 13 + }, + { + "buildVersion": 9, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1/bellsoft-jdk13.0.1-linux-amd64.zip", + "interimVersion": 0, + "version": "13.0.1+9", + "featureVersion": 13 + }, + { + "buildVersion": 1, + "updateVersion": 265, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u265+1/bellsoft-jdk8u265+1-linux-amd64.zip", + "interimVersion": 0, + "version": "8u265+1", + "featureVersion": 8 + }, + { + "buildVersion": 9, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.1+9/bellsoft-jdk15.0.1+9-linux-amd64.zip", + "interimVersion": 0, + "version": "15.0.1+9", + "featureVersion": 15 + }, + { + "buildVersion": 10, + "updateVersion": 272, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u272+10/bellsoft-jdk8u272+10-linux-amd64.zip", + "interimVersion": 0, + "version": "8u272+10", + "featureVersion": 8 + }, + { + "buildVersion": 7, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.2+7/bellsoft-jdk16.0.2+7-linux-amd64.zip", + "interimVersion": 0, + "version": "16.0.2+7", + "featureVersion": 16 + }, + { + "buildVersion": 10, + "updateVersion": 6, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.6+10/bellsoft-jdk11.0.6+10-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.6+10", + "featureVersion": 11 + }, + { + "buildVersion": 9, + "updateVersion": 252, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jdk8u252+9-linux-amd64.zip", + "interimVersion": 0, + "version": "8u252+9", + "featureVersion": 8 + }, + { + "buildVersion": 12, + "updateVersion": 212, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u212/bellsoft-jdk8u212-linux-amd64.zip", + "interimVersion": 0, + "version": "8u212+12", + "featureVersion": 8 + }, + { + "buildVersion": 10, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+10/bellsoft-jdk15.0.2+10-linux-amd64.zip", + "interimVersion": 0, + "version": "15.0.2+10", + "featureVersion": 15 + }, + { + "buildVersion": 9, + "updateVersion": 10, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.10+9/bellsoft-jdk11.0.10+9-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.10+9", + "featureVersion": 11 + }, + { + "buildVersion": 0, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.1/bellsoft-jdk11.0.1-linux-amd64.tar.gz", + "interimVersion": 0, + "version": "11.0.1+0", + "featureVersion": 11 + }, + { + "buildVersion": 7, + "updateVersion": 12, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.12+7/bellsoft-jdk11.0.12+7-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.12+7", + "featureVersion": 11 + }, + { + "buildVersion": 36, + "updateVersion": 0, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16+36/bellsoft-jdk16+36-linux-amd64.zip", + "interimVersion": 0, + "version": "16+36", + "featureVersion": 16 + }, + { + "buildVersion": 12, + "updateVersion": 3, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.3/bellsoft-jdk11.0.3-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.3+12", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 8, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.8+10/bellsoft-jdk11.0.8+10-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.8+10", + "featureVersion": 11 + }, + { + "buildVersion": 7, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.2/bellsoft-jdk11.0.2-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.2+7", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 5, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5/bellsoft-jdk11.0.5-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.5+10", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 4, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.4/bellsoft-jdk11.0.4-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.4+10", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.2/bellsoft-jdk12.0.2-linux-amd64.zip", + "interimVersion": 0, + "version": "12.0.2+10", + "featureVersion": 12 + }, + { + "buildVersion": 12, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.1/bellsoft-jdk12.0.1-linux-amd64.zip", + "interimVersion": 0, + "version": "12.0.1+12", + "featureVersion": 12 + }, + { + "buildVersion": 10, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1+10/bellsoft-jdk13.0.1+10-linux-amd64.zip", + "interimVersion": 0, + "version": "13.0.1+10", + "featureVersion": 13 + }, + { + "buildVersion": 11, + "updateVersion": 5, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-linux-amd64.tar.gz", + "interimVersion": 0, + "version": "11.0.5+11", + "featureVersion": 11 + }, + { + "buildVersion": 11, + "updateVersion": 5, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.5+11", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 292, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u292+10/bellsoft-jdk8u292+10-linux-amd64.zip", + "interimVersion": 0, + "version": "8u292+10", + "featureVersion": 8 + }, + { + "buildVersion": 11, + "updateVersion": 222, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u222/bellsoft-jdk8u222-linux-amd64.zip", + "interimVersion": 0, + "version": "8u222+11", + "featureVersion": 8 + }, + { + "buildVersion": 36, + "updateVersion": 0, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15+36/bellsoft-jdk15+36-linux-amd64.zip", + "interimVersion": 0, + "version": "15+36", + "featureVersion": 15 + }, + { + "buildVersion": 10, + "updateVersion": 7, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.7+10/bellsoft-jdk11.0.7+10-linux-amd64.zip", + "interimVersion": 0, + "version": "11.0.7+10", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 232, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232+10/bellsoft-jdk8u232+10-linux-amd64.zip", + "interimVersion": 0, + "version": "8u232+10", + "featureVersion": 8 + }, + { + "buildVersion": 8, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+8/bellsoft-jdk15.0.2+8-linux-amd64.zip", + "interimVersion": 0, + "version": "15.0.2+8", + "featureVersion": 15 + }, + { + "buildVersion": 8, + "updateVersion": 302, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u302+8/bellsoft-jdk8u302+8-linux-amd64.zip", + "interimVersion": 0, + "version": "8u302+8", + "featureVersion": 8 + }, + { + "buildVersion": 12, + "updateVersion": 192, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u192.all/bellsoft-jdk1.8.0-linux-amd64.tar.gz", + "interimVersion": 0, + "version": "8u192+12", + "featureVersion": 8 + }, + { + "buildVersion": 13, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.2+13/bellsoft-jdk14.0.2+13-linux-amd64.zip", + "interimVersion": 0, + "version": "14.0.2+13", + "featureVersion": 14 + }, + { + "buildVersion": 9, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.1+9/bellsoft-jdk16.0.1+9-linux-amd64.zip", + "interimVersion": 0, + "version": "16.0.1+9", + "featureVersion": 16 + }, + { + "buildVersion": 9, + "updateVersion": 232, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232/bellsoft-jdk8u232-linux-amd64.zip", + "interimVersion": 0, + "version": "8u232+9", + "featureVersion": 8 + }, + { + "buildVersion": 13, + "updateVersion": 10, + "patchVersion": 0, + "downloadUrl":"https://download.bell-sw.com/java/17.0.10+13/bellsoft-jdk17.0.10+13-linux-amd64.tar.gz", + "interimVersion": 0, + "version": "17.0.10+13", + "featureVersion": 17 + } +] \ No newline at end of file diff --git a/__tests__/data/liberica-windows.json b/__tests__/data/liberica-windows.json new file mode 100644 index 000000000..83b5089ab --- /dev/null +++ b/__tests__/data/liberica-windows.json @@ -0,0 +1,452 @@ +[ + { + "buildVersion": 36, + "updateVersion": 0, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14+36/bellsoft-jdk14+36-windows-amd64.zip", + "interimVersion": 0, + "version": "14+36", + "featureVersion": 14 + }, + { + "buildVersion": 9, + "updateVersion": 11, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.11+9/bellsoft-jdk11.0.11+9-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.11+9", + "featureVersion": 11 + }, + { + "buildVersion": 8, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.1+8/bellsoft-jdk14.0.1+8-windows-amd64.zip", + "interimVersion": 0, + "version": "14.0.1+8", + "featureVersion": 14 + }, + { + "buildVersion": 10, + "updateVersion": 262, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u262+10/bellsoft-jdk8u262+10-windows-amd64.zip", + "interimVersion": 0, + "version": "8u262+10", + "featureVersion": 8 + }, + { + "buildVersion": 1, + "updateVersion": 275, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u275+1/bellsoft-jdk8u275+1-windows-amd64.zip", + "interimVersion": 0, + "version": "8u275+1", + "featureVersion": 8 + }, + { + "buildVersion": 1, + "updateVersion": 9, + "patchVersion": 1, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9.1+1/bellsoft-jdk11.0.9.1+1-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.9.1+1", + "featureVersion": 11 + }, + { + "buildVersion": 8, + "updateVersion": 202, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u202/bellsoft-jdk8u202-windows-amd64.zip", + "interimVersion": 0, + "version": "8u202+8", + "featureVersion": 8 + }, + { + "buildVersion": 33, + "updateVersion": 0, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12/bellsoft-jdk12-windows-amd64.zip", + "interimVersion": 0, + "version": "12+33", + "featureVersion": 12 + }, + { + "buildVersion": 8, + "updateVersion": 282, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u282+8/bellsoft-jdk8u282+8-windows-amd64.zip", + "interimVersion": 0, + "version": "8u282+8", + "featureVersion": 8 + }, + { + "buildVersion": 11, + "updateVersion": 9, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+11/bellsoft-jdk11.0.9+11-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.9+11", + "featureVersion": 11 + }, + { + "buildVersion": 33, + "updateVersion": 0, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13/bellsoft-jdk13-windows-amd64.zip", + "interimVersion": 0, + "version": "13+33", + "featureVersion": 13 + }, + { + "buildVersion": 12, + "updateVersion": 9, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+12/bellsoft-jdk11.0.9+12-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.9+12", + "featureVersion": 11 + }, + { + "buildVersion": 7, + "updateVersion": 242, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u242+7/bellsoft-jdk8u242+7-windows-amd64.zip", + "interimVersion": 0, + "version": "8u242+7", + "featureVersion": 8 + }, + { + "buildVersion": 9, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.2+9/bellsoft-jdk13.0.2+9-windows-amd64.zip", + "interimVersion": 0, + "version": "13.0.2+9", + "featureVersion": 13 + }, + { + "buildVersion": 9, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1/bellsoft-jdk13.0.1-windows-amd64.zip", + "interimVersion": 0, + "version": "13.0.1+9", + "featureVersion": 13 + }, + { + "buildVersion": 1, + "updateVersion": 265, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u265+1/bellsoft-jdk8u265+1-windows-amd64.zip", + "interimVersion": 0, + "version": "8u265+1", + "featureVersion": 8 + }, + { + "buildVersion": 9, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.1+9/bellsoft-jdk15.0.1+9-windows-amd64.zip", + "interimVersion": 0, + "version": "15.0.1+9", + "featureVersion": 15 + }, + { + "buildVersion": 10, + "updateVersion": 272, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u272+10/bellsoft-jdk8u272+10-windows-amd64.zip", + "interimVersion": 0, + "version": "8u272+10", + "featureVersion": 8 + }, + { + "buildVersion": 7, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.2+7/bellsoft-jdk16.0.2+7-windows-amd64.zip", + "interimVersion": 0, + "version": "16.0.2+7", + "featureVersion": 16 + }, + { + "buildVersion": 10, + "updateVersion": 6, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.6+10/bellsoft-jdk11.0.6+10-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.6+10", + "featureVersion": 11 + }, + { + "buildVersion": 9, + "updateVersion": 252, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jdk8u252+9-windows-amd64.zip", + "interimVersion": 0, + "version": "8u252+9", + "featureVersion": 8 + }, + { + "buildVersion": 12, + "updateVersion": 212, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u212/bellsoft-jdk8u212-windows-amd64.zip", + "interimVersion": 0, + "version": "8u212+12", + "featureVersion": 8 + }, + { + "buildVersion": 10, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+10/bellsoft-jdk15.0.2+10-windows-amd64.zip", + "interimVersion": 0, + "version": "15.0.2+10", + "featureVersion": 15 + }, + { + "buildVersion": 9, + "updateVersion": 10, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.10+9/bellsoft-jdk11.0.10+9-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.10+9", + "featureVersion": 11 + }, + { + "buildVersion": 0, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.1/bellsoft-jdk11.0.1-windows-amd64.tar.gz", + "interimVersion": 0, + "version": "11.0.1+0", + "featureVersion": 11 + }, + { + "buildVersion": 7, + "updateVersion": 12, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.12+7/bellsoft-jdk11.0.12+7-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.12+7", + "featureVersion": 11 + }, + { + "buildVersion": 36, + "updateVersion": 0, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16+36/bellsoft-jdk16+36-windows-amd64.zip", + "interimVersion": 0, + "version": "16+36", + "featureVersion": 16 + }, + { + "buildVersion": 12, + "updateVersion": 3, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.3/bellsoft-jdk11.0.3-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.3+12", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 8, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.8+10/bellsoft-jdk11.0.8+10-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.8+10", + "featureVersion": 11 + }, + { + "buildVersion": 7, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.2/bellsoft-jdk11.0.2-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.2+7", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 5, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5/bellsoft-jdk11.0.5-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.5+10", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 4, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.4/bellsoft-jdk11.0.4-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.4+10", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.2/bellsoft-jdk12.0.2-windows-amd64.zip", + "interimVersion": 0, + "version": "12.0.2+10", + "featureVersion": 12 + }, + { + "buildVersion": 12, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.1/bellsoft-jdk12.0.1-windows-amd64.zip", + "interimVersion": 0, + "version": "12.0.1+12", + "featureVersion": 12 + }, + { + "buildVersion": 10, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1+10/bellsoft-jdk13.0.1+10-windows-amd64.zip", + "interimVersion": 0, + "version": "13.0.1+10", + "featureVersion": 13 + }, + { + "buildVersion": 11, + "updateVersion": 5, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-windows-amd64.tar.gz", + "interimVersion": 0, + "version": "11.0.5+11", + "featureVersion": 11 + }, + { + "buildVersion": 11, + "updateVersion": 5, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.5+11", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 292, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u292+10/bellsoft-jdk8u292+10-windows-amd64.zip", + "interimVersion": 0, + "version": "8u292+10", + "featureVersion": 8 + }, + { + "buildVersion": 11, + "updateVersion": 222, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u222/bellsoft-jdk8u222-windows-amd64.zip", + "interimVersion": 0, + "version": "8u222+11", + "featureVersion": 8 + }, + { + "buildVersion": 36, + "updateVersion": 0, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15+36/bellsoft-jdk15+36-windows-amd64.zip", + "interimVersion": 0, + "version": "15+36", + "featureVersion": 15 + }, + { + "buildVersion": 10, + "updateVersion": 7, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.7+10/bellsoft-jdk11.0.7+10-windows-amd64.zip", + "interimVersion": 0, + "version": "11.0.7+10", + "featureVersion": 11 + }, + { + "buildVersion": 10, + "updateVersion": 232, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232+10/bellsoft-jdk8u232+10-windows-amd64.zip", + "interimVersion": 0, + "version": "8u232+10", + "featureVersion": 8 + }, + { + "buildVersion": 8, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+8/bellsoft-jdk15.0.2+8-windows-amd64.zip", + "interimVersion": 0, + "version": "15.0.2+8", + "featureVersion": 15 + }, + { + "buildVersion": 8, + "updateVersion": 302, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u302+8/bellsoft-jdk8u302+8-windows-amd64.zip", + "interimVersion": 0, + "version": "8u302+8", + "featureVersion": 8 + }, + { + "buildVersion": 12, + "updateVersion": 192, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u192.all/bellsoft-jdk1.8.0-windows-amd64.tar.gz", + "interimVersion": 0, + "version": "8u192+12", + "featureVersion": 8 + }, + { + "buildVersion": 13, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.2+13/bellsoft-jdk14.0.2+13-windows-amd64.zip", + "interimVersion": 0, + "version": "14.0.2+13", + "featureVersion": 14 + }, + { + "buildVersion": 9, + "updateVersion": 1, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.1+9/bellsoft-jdk16.0.1+9-windows-amd64.zip", + "interimVersion": 0, + "version": "16.0.1+9", + "featureVersion": 16 + }, + { + "buildVersion": 9, + "updateVersion": 232, + "patchVersion": 0, + "downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232/bellsoft-jdk8u232-windows-amd64.zip", + "interimVersion": 0, + "version": "8u232+9", + "featureVersion": 8 + }, + { + "buildVersion": 14, + "updateVersion": 2, + "patchVersion": 0, + "downloadUrl": "https://download.bell-sw.com/java/21.0.2+14/bellsoft-jdk21.0.2+14-windows-aarch64.zip", + "interimVersion": 0, + "version": "21.0.2+14", + "featureVersion": 21 + }, + { + "buildVersion": 13, + "updateVersion": 10, + "patchVersion": 0, + "downloadUrl": "https://download.bell-sw.com/java/17.0.10+13/bellsoft-jdk17.0.10+13-windows-aarch64.zip", + "interimVersion": 0, + "version": "17.0.10+13", + "featureVersion": 17 + } +] \ No newline at end of file diff --git a/__tests__/data/microsoft.json b/__tests__/data/microsoft.json index d9136311f..18e67d9d3 100644 --- a/__tests__/data/microsoft.json +++ b/__tests__/data/microsoft.json @@ -70,6 +70,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.7-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-windows-aarch64.zip" } ] }, diff --git a/__tests__/data/zulu-linux.json b/__tests__/data/zulu-linux.json new file mode 100644 index 000000000..1f2fa2716 --- /dev/null +++ b/__tests__/data/zulu-linux.json @@ -0,0 +1,254 @@ +[ + { + "id": 10996, + "url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_05-8.1.0.10-linux.tar.gz", + "name": "zulu1.8.0_05-8.1.0.10-linux.tar.gz", + "zulu_version": [8, 1, 0, 10], + "jdk_version": [8, 0, 5, 13] + }, + { + "id": 10997, + "url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_11-8.2.0.1-linux.tar.gz", + "name": "zulu1.8.0_11-8.2.0.1-linux.tar.gz", + "zulu_version": [8, 2, 0, 1], + "jdk_version": [8, 0, 11, 12] + }, + { + "id": 10346, + "url": "https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-linux_x64.tar.gz", + "name": "zulu8.21.0.1-jdk8.0.131-linux_x64.tar.gz", + "zulu_version": [8, 21, 0, 1], + "jdk_version": [8, 0, 131, 11] + }, + { + "id": 10362, + "url": "https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-linux_x64.tar.gz", + "name": "zulu8.23.0.3-jdk8.0.144-linux_x64.tar.gz", + "zulu_version": [8, 23, 0, 3], + "jdk_version": [8, 0, 144, 1] + }, + { + "id": 10399, + "url": "https://cdn.azul.com/zulu/bin/zulu8.25.0.1-jdk8.0.152-linux_x64.tar.gz", + "name": "zulu8.25.0.1-jdk8.0.152-linux_x64.tar.gz", + "zulu_version": [8, 25, 0, 1], + "jdk_version": [8, 0, 152, 16] + }, + { + "id": 11355, + "url": "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-linux_x64.tar.gz", + "name": "zulu8.46.0.19-ca-jdk8.0.252-linux_x64.tar.gz", + "zulu_version": [8, 46, 0, 19], + "jdk_version": [8, 0, 252, 14] + }, + { + "id": 11481, + "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.47-ca-jdk8.0.262-linux_x64.tar.gz", + "name": "zulu8.48.0.47-ca-jdk8.0.262-linux_x64.tar.gz", + "zulu_version": [8, 48, 0, 47], + "jdk_version": [8, 0, 262, 17] + }, + { + "id": 11622, + "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.51-ca-jdk8.0.262-linux_x64.tar.gz", + "name": "zulu8.48.0.51-ca-jdk8.0.262-linux_x64.tar.gz", + "zulu_version": [8, 48, 0, 51], + "jdk_version": [8, 0, 262, 19] + }, + { + "id": 11535, + "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.49-ca-jdk8.0.262-linux_x64.tar.gz", + "name": "zulu8.48.0.49-ca-jdk8.0.262-linux_x64.tar.gz", + "zulu_version": [8, 48, 0, 49], + "jdk_version": [8, 0, 262, 18] + }, + { + "id": 12424, + "url": "https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-linux_x64.tar.gz", + "name": "zulu8.52.0.23-ca-jdk8.0.282-linux_x64.tar.gz", + "zulu_version": [8, 52, 0, 23], + "jdk_version": [8, 0, 282, 8] + }, + { + "id": 10383, + "url": "https://cdn.azul.com/zulu/bin/zulu9.0.0.15-jdk9.0.0-linux_x64.tar.gz", + "name": "zulu9.0.0.15-jdk9.0.0-linux_x64.tar.gz", + "zulu_version": [9, 0, 0, 15], + "jdk_version": [9, 0, 0, 0] + }, + { + "id": 10413, + "url": "https://cdn.azul.com/zulu/bin/zulu9.0.1.3-jdk9.0.1-linux_x64.tar.gz", + "name": "zulu9.0.1.3-jdk9.0.1-linux_x64.tar.gz", + "zulu_version": [9, 0, 1, 3], + "jdk_version": [9, 0, 1, 0] + }, + { + "id": 10503, + "url": "https://cdn.azul.com/zulu/bin/zulu10.2+3-jdk10.0.1-linux_x64.tar.gz", + "name": "zulu10.2+3-jdk10.0.1-linux_x64.tar.gz", + "zulu_version": [10, 2, 3, 0], + "jdk_version": [10, 0, 1, 9] + }, + { + "id": 10541, + "url": "https://cdn.azul.com/zulu/bin/zulu10.3+5-jdk10.0.2-linux_x64.tar.gz", + "name": "zulu10.3+5-jdk10.0.2-linux_x64.tar.gz", + "zulu_version": [10, 3, 5, 0], + "jdk_version": [10, 0, 2, 13] + }, + { + "id": 10576, + "url": "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-linux_x64.tar.gz", + "name": "zulu11.2.3-jdk11.0.1-linux_x64.tar.gz", + "zulu_version": [11, 2, 3, 0], + "jdk_version": [11, 0, 1, 13] + }, + { + "id": 10604, + "url": "https://cdn.azul.com/zulu/bin/zulu11.29.3-ca-jdk11.0.2-linux_x64.tar.gz", + "name": "zulu11.29.3-ca-jdk11.0.2-linux_x64.tar.gz", + "zulu_version": [11, 29, 3, 0], + "jdk_version": [11, 0, 2, 7] + }, + { + "id": 10687, + "url": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz", + "name": "zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz", + "zulu_version": [11, 31, 11, 0], + "jdk_version": [11, 0, 3, 7] + }, + { + "id": 10856, + "url": "https://cdn.azul.com/zulu/bin/zulu11.35.13-ca-jdk11.0.5-linux_x64.tar.gz", + "name": "zulu11.35.13-ca-jdk11.0.5-linux_x64.tar.gz", + "zulu_version": [11, 35, 13, 0], + "jdk_version": [11, 0, 5, 10] + }, + { + "id": 10933, + "url": "https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-linux_x64.tar.gz", + "name": "zulu11.35.15-ca-jdk11.0.5-linux_x64.tar.gz", + "zulu_version": [11, 35, 15, 0], + "jdk_version": [11, 0, 5, 10] + }, + { + "id": 10933, + "url": "https://cdn.azul.com/zulu/bin/zulu11.35.11-ca-jdk11.0.5-linux_x64.tar.gz", + "name": "zulu11.35.15-ca-jdk11.0.5-linux_x64.tar.gz", + "zulu_version": [11, 35, 11, 0], + "jdk_version": [11, 0, 5, 10] + }, + { + "id": 12397, + "url": "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-linux_x64.tar.gz", + "name": "zulu11.45.27-ca-jdk11.0.10-linux_x64.tar.gz", + "zulu_version": [11, 45, 27, 0], + "jdk_version": [11, 0, 10, 9] + }, + { + "id": 10667, + "url": "https://cdn.azul.com/zulu/bin/zulu12.1.3-ca-jdk12.0.0-linux_x64.tar.gz", + "name": "zulu12.1.3-ca-jdk12.0.0-linux_x64.tar.gz", + "zulu_version": [12, 1, 3, 0], + "jdk_version": [12, 0, 0, 33] + }, + { + "id": 10710, + "url": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz", + "name": "zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz", + "zulu_version": [12, 2, 3, 0], + "jdk_version": [12, 0, 1, 12] + }, + { + "id": 10780, + "url": "https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-linux_x64.tar.gz", + "name": "zulu12.3.11-ca-jdk12.0.2-linux_x64.tar.gz", + "zulu_version": [12, 3, 11, 0], + "jdk_version": [12, 0, 2, 3] + }, + { + "id": 10846, + "url": "https://cdn.azul.com/zulu/bin/zulu13.27.9-ca-jdk13.0.0-linux_x64.tar.gz", + "name": "zulu13.27.9-ca-jdk13.0.0-linux_x64.tar.gz", + "zulu_version": [13, 27, 9, 0], + "jdk_version": [13, 0, 0, 33] + }, + { + "id": 10888, + "url": "https://cdn.azul.com/zulu/bin/zulu13.28.11-ca-jdk13.0.1-linux_x64.tar.gz", + "name": "zulu13.28.11-ca-jdk13.0.1-linux_x64.tar.gz", + "zulu_version": [13, 28, 11, 0], + "jdk_version": [13, 0, 1, 10] + }, + { + "id": 11073, + "url": "https://cdn.azul.com/zulu/bin/zulu13.29.9-ca-jdk13.0.2-linux_x64.tar.gz", + "name": "zulu13.29.9-ca-jdk13.0.2-linux_x64.tar.gz", + "zulu_version": [13, 29, 9, 0], + "jdk_version": [13, 0, 2, 6] + }, + { + "id": 12408, + "url": "https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-linux_x64.tar.gz", + "name": "zulu13.37.21-ca-jdk13.0.6-linux_x64.tar.gz", + "zulu_version": [13, 37, 21, 0], + "jdk_version": [13, 0, 6, 5] + }, + { + "id": 11236, + "url": "https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14.0.0-linux_x64.tar.gz", + "name": "zulu14.27.1-ca-jdk14.0.0-linux_x64.tar.gz", + "zulu_version": [14, 27, 1, 0], + "jdk_version": [14, 0, 0, 36] + }, + { + "id": 11349, + "url": "https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-linux_x64.tar.gz", + "name": "zulu14.28.21-ca-jdk14.0.1-linux_x64.tar.gz", + "zulu_version": [14, 28, 21, 0], + "jdk_version": [14, 0, 1, 8] + }, + { + "id": 11513, + "url": "https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-linux_x64.tar.gz", + "name": "zulu14.29.23-ca-jdk14.0.2-linux_x64.tar.gz", + "zulu_version": [14, 29, 23, 0], + "jdk_version": [14, 0, 2, 12] + }, + { + "id": 11780, + "url": "https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-linux_x64.tar.gz", + "name": "zulu15.27.17-ca-jdk15.0.0-linux_x64.tar.gz", + "zulu_version": [15, 27, 17, 0], + "jdk_version": [15, 0, 0, 36] + }, + { + "id": 11924, + "url": "https://cdn.azul.com/zulu/bin/zulu15.28.13-ca-jdk15.0.1-linux_x64.tar.gz", + "name": "zulu15.28.13-ca-jdk15.0.1-linux_x64.tar.gz", + "zulu_version": [15, 28, 13, 0], + "jdk_version": [15, 0, 1, 8] + }, + { + "id": 12101, + "url": "https://cdn.azul.com/zulu/bin/zulu15.28.51-ca-jdk15.0.1-linux_x64.tar.gz", + "name": "zulu15.28.51-ca-jdk15.0.1-linux_x64.tar.gz", + "zulu_version": [15, 28, 51, 0], + "jdk_version": [15, 0, 1, 9] + }, + { + "id": 12445, + "url": "https://cdn.azul.com/zulu/bin/zulu15.29.15-ca-jdk15.0.2-linux_x64.tar.gz", + "name": "zulu15.29.15-ca-jdk15.0.2-linux_x64.tar.gz", + "zulu_version": [15, 29, 15, 0], + "jdk_version": [15, 0, 2, 7] + }, + { + "id": 12447, + "url": "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz", + "name": "zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz", + "zulu_version": [21, 32, 17, 0], + "jdk_version": [21, 0, 2, 6] + } +] \ No newline at end of file diff --git a/__tests__/data/zulu-windows.json b/__tests__/data/zulu-windows.json new file mode 100644 index 000000000..e4ce99538 --- /dev/null +++ b/__tests__/data/zulu-windows.json @@ -0,0 +1,254 @@ +[ + { + "id": 10996, + "url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_05-8.1.0.10-windows.tar.gz", + "name": "zulu1.8.0_05-8.1.0.10-windows.tar.gz", + "zulu_version": [8, 1, 0, 10], + "jdk_version": [8, 0, 5, 13] + }, + { + "id": 10997, + "url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_11-8.2.0.1-windows.tar.gz", + "name": "zulu1.8.0_11-8.2.0.1-windows.tar.gz", + "zulu_version": [8, 2, 0, 1], + "jdk_version": [8, 0, 11, 12] + }, + { + "id": 10346, + "url": "https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-windows_x64.tar.gz", + "name": "zulu8.21.0.1-jdk8.0.131-windows_x64.tar.gz", + "zulu_version": [8, 21, 0, 1], + "jdk_version": [8, 0, 131, 11] + }, + { + "id": 10362, + "url": "https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-windows_x64.tar.gz", + "name": "zulu8.23.0.3-jdk8.0.144-windows_x64.tar.gz", + "zulu_version": [8, 23, 0, 3], + "jdk_version": [8, 0, 144, 1] + }, + { + "id": 10399, + "url": "https://cdn.azul.com/zulu/bin/zulu8.25.0.1-jdk8.0.152-windows_x64.tar.gz", + "name": "zulu8.25.0.1-jdk8.0.152-windows_x64.tar.gz", + "zulu_version": [8, 25, 0, 1], + "jdk_version": [8, 0, 152, 16] + }, + { + "id": 11355, + "url": "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-windows_x64.tar.gz", + "name": "zulu8.46.0.19-ca-jdk8.0.252-windows_x64.tar.gz", + "zulu_version": [8, 46, 0, 19], + "jdk_version": [8, 0, 252, 14] + }, + { + "id": 11481, + "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.47-ca-jdk8.0.262-windows_x64.tar.gz", + "name": "zulu8.48.0.47-ca-jdk8.0.262-windows_x64.tar.gz", + "zulu_version": [8, 48, 0, 47], + "jdk_version": [8, 0, 262, 17] + }, + { + "id": 11622, + "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.51-ca-jdk8.0.262-windows_x64.tar.gz", + "name": "zulu8.48.0.51-ca-jdk8.0.262-windows_x64.tar.gz", + "zulu_version": [8, 48, 0, 51], + "jdk_version": [8, 0, 262, 19] + }, + { + "id": 11535, + "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.49-ca-jdk8.0.262-windows_x64.tar.gz", + "name": "zulu8.48.0.49-ca-jdk8.0.262-windows_x64.tar.gz", + "zulu_version": [8, 48, 0, 49], + "jdk_version": [8, 0, 262, 18] + }, + { + "id": 12424, + "url": "https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-windows_x64.tar.gz", + "name": "zulu8.52.0.23-ca-jdk8.0.282-windows_x64.tar.gz", + "zulu_version": [8, 52, 0, 23], + "jdk_version": [8, 0, 282, 8] + }, + { + "id": 10383, + "url": "https://cdn.azul.com/zulu/bin/zulu9.0.0.15-jdk9.0.0-windows_x64.tar.gz", + "name": "zulu9.0.0.15-jdk9.0.0-windows_x64.tar.gz", + "zulu_version": [9, 0, 0, 15], + "jdk_version": [9, 0, 0, 0] + }, + { + "id": 10413, + "url": "https://cdn.azul.com/zulu/bin/zulu9.0.1.3-jdk9.0.1-windows_x64.tar.gz", + "name": "zulu9.0.1.3-jdk9.0.1-windows_x64.tar.gz", + "zulu_version": [9, 0, 1, 3], + "jdk_version": [9, 0, 1, 0] + }, + { + "id": 10503, + "url": "https://cdn.azul.com/zulu/bin/zulu10.2+3-jdk10.0.1-windows_x64.tar.gz", + "name": "zulu10.2+3-jdk10.0.1-windows_x64.tar.gz", + "zulu_version": [10, 2, 3, 0], + "jdk_version": [10, 0, 1, 9] + }, + { + "id": 10541, + "url": "https://cdn.azul.com/zulu/bin/zulu10.3+5-jdk10.0.2-windows_x64.tar.gz", + "name": "zulu10.3+5-jdk10.0.2-windows_x64.tar.gz", + "zulu_version": [10, 3, 5, 0], + "jdk_version": [10, 0, 2, 13] + }, + { + "id": 10576, + "url": "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-windows_x64.tar.gz", + "name": "zulu11.2.3-jdk11.0.1-windows_x64.tar.gz", + "zulu_version": [11, 2, 3, 0], + "jdk_version": [11, 0, 1, 13] + }, + { + "id": 10604, + "url": "https://cdn.azul.com/zulu/bin/zulu11.29.3-ca-jdk11.0.2-windows_x64.tar.gz", + "name": "zulu11.29.3-ca-jdk11.0.2-windows_x64.tar.gz", + "zulu_version": [11, 29, 3, 0], + "jdk_version": [11, 0, 2, 7] + }, + { + "id": 10687, + "url": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-windows_x64.tar.gz", + "name": "zulu11.31.11-ca-jdk11.0.3-windows_x64.tar.gz", + "zulu_version": [11, 31, 11, 0], + "jdk_version": [11, 0, 3, 7] + }, + { + "id": 10856, + "url": "https://cdn.azul.com/zulu/bin/zulu11.35.13-ca-jdk11.0.5-windows_x64.tar.gz", + "name": "zulu11.35.13-ca-jdk11.0.5-windows_x64.tar.gz", + "zulu_version": [11, 35, 13, 0], + "jdk_version": [11, 0, 5, 10] + }, + { + "id": 10933, + "url": "https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-windows_x64.tar.gz", + "name": "zulu11.35.15-ca-jdk11.0.5-windows_x64.tar.gz", + "zulu_version": [11, 35, 15, 0], + "jdk_version": [11, 0, 5, 10] + }, + { + "id": 10933, + "url": "https://cdn.azul.com/zulu/bin/zulu11.35.11-ca-jdk11.0.5-windows_x64.tar.gz", + "name": "zulu11.35.15-ca-jdk11.0.5-windows_x64.tar.gz", + "zulu_version": [11, 35, 11, 0], + "jdk_version": [11, 0, 5, 10] + }, + { + "id": 12397, + "url": "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-windows_x64.tar.gz", + "name": "zulu11.45.27-ca-jdk11.0.10-windows_x64.tar.gz", + "zulu_version": [11, 45, 27, 0], + "jdk_version": [11, 0, 10, 9] + }, + { + "id": 10667, + "url": "https://cdn.azul.com/zulu/bin/zulu12.1.3-ca-jdk12.0.0-windows_x64.tar.gz", + "name": "zulu12.1.3-ca-jdk12.0.0-windows_x64.tar.gz", + "zulu_version": [12, 1, 3, 0], + "jdk_version": [12, 0, 0, 33] + }, + { + "id": 10710, + "url": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-windows_x64.tar.gz", + "name": "zulu12.2.3-ca-jdk12.0.1-windows_x64.tar.gz", + "zulu_version": [12, 2, 3, 0], + "jdk_version": [12, 0, 1, 12] + }, + { + "id": 10780, + "url": "https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-windows_x64.tar.gz", + "name": "zulu12.3.11-ca-jdk12.0.2-windows_x64.tar.gz", + "zulu_version": [12, 3, 11, 0], + "jdk_version": [12, 0, 2, 3] + }, + { + "id": 10846, + "url": "https://cdn.azul.com/zulu/bin/zulu13.27.9-ca-jdk13.0.0-windows_x64.tar.gz", + "name": "zulu13.27.9-ca-jdk13.0.0-windows_x64.tar.gz", + "zulu_version": [13, 27, 9, 0], + "jdk_version": [13, 0, 0, 33] + }, + { + "id": 10888, + "url": "https://cdn.azul.com/zulu/bin/zulu13.28.11-ca-jdk13.0.1-windows_x64.tar.gz", + "name": "zulu13.28.11-ca-jdk13.0.1-windows_x64.tar.gz", + "zulu_version": [13, 28, 11, 0], + "jdk_version": [13, 0, 1, 10] + }, + { + "id": 11073, + "url": "https://cdn.azul.com/zulu/bin/zulu13.29.9-ca-jdk13.0.2-windows_x64.tar.gz", + "name": "zulu13.29.9-ca-jdk13.0.2-windows_x64.tar.gz", + "zulu_version": [13, 29, 9, 0], + "jdk_version": [13, 0, 2, 6] + }, + { + "id": 12408, + "url": "https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-windows_x64.tar.gz", + "name": "zulu13.37.21-ca-jdk13.0.6-windows_x64.tar.gz", + "zulu_version": [13, 37, 21, 0], + "jdk_version": [13, 0, 6, 5] + }, + { + "id": 11236, + "url": "https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14.0.0-windows_x64.tar.gz", + "name": "zulu14.27.1-ca-jdk14.0.0-windows_x64.tar.gz", + "zulu_version": [14, 27, 1, 0], + "jdk_version": [14, 0, 0, 36] + }, + { + "id": 11349, + "url": "https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-windows_x64.tar.gz", + "name": "zulu14.28.21-ca-jdk14.0.1-windows_x64.tar.gz", + "zulu_version": [14, 28, 21, 0], + "jdk_version": [14, 0, 1, 8] + }, + { + "id": 11513, + "url": "https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-windows_x64.tar.gz", + "name": "zulu14.29.23-ca-jdk14.0.2-windows_x64.tar.gz", + "zulu_version": [14, 29, 23, 0], + "jdk_version": [14, 0, 2, 12] + }, + { + "id": 11780, + "url": "https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-windows_x64.tar.gz", + "name": "zulu15.27.17-ca-jdk15.0.0-windows_x64.tar.gz", + "zulu_version": [15, 27, 17, 0], + "jdk_version": [15, 0, 0, 36] + }, + { + "id": 11924, + "url": "https://cdn.azul.com/zulu/bin/zulu15.28.13-ca-jdk15.0.1-windows_x64.tar.gz", + "name": "zulu15.28.13-ca-jdk15.0.1-windows_x64.tar.gz", + "zulu_version": [15, 28, 13, 0], + "jdk_version": [15, 0, 1, 8] + }, + { + "id": 12101, + "url": "https://cdn.azul.com/zulu/bin/zulu15.28.51-ca-jdk15.0.1-windows_x64.tar.gz", + "name": "zulu15.28.51-ca-jdk15.0.1-windows_x64.tar.gz", + "zulu_version": [15, 28, 51, 0], + "jdk_version": [15, 0, 1, 9] + }, + { + "id": 12445, + "url": "https://cdn.azul.com/zulu/bin/zulu15.29.15-ca-jdk15.0.2-windows_x64.tar.gz", + "name": "zulu15.29.15-ca-jdk15.0.2-windows_x64.tar.gz", + "zulu_version": [15, 29, 15, 0], + "jdk_version": [15, 0, 2, 7] + }, + { + "id": 12446, + "url": "https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip", + "name": "zulu17.48.15-ca-jdk17.0.10-win_aarhc4.zip", + "zulu_version": [17, 48, 15, 0], + "jdk_version": [17, 0, 10, 7] + } +] \ No newline at end of file diff --git a/__tests__/distributors/liberica-linux-installer.test.ts b/__tests__/distributors/liberica-linux-installer.test.ts new file mode 100644 index 000000000..8e6a665e0 --- /dev/null +++ b/__tests__/distributors/liberica-linux-installer.test.ts @@ -0,0 +1,290 @@ +import {LibericaDistributions} from '../../src/distributions/liberica/installer'; +import { + ArchitectureOptions, + LibericaVersion +} from '../../src/distributions/liberica/models'; +import {HttpClient} from '@actions/http-client'; +import os from 'os'; + +import manifestData from '../data/liberica-linux.json'; + +describe('getAvailableVersions', () => { + let spyHttpClient: jest.SpyInstance; + + beforeEach(() => { + spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson'); + spyHttpClient.mockReturnValue({ + statusCode: 200, + headers: {}, + result: manifestData as LibericaVersion[] + }); + }); + + afterEach(() => { + jest.resetAllMocks(); + jest.clearAllMocks(); + jest.restoreAllMocks(); + }); + + it.each([ + [ + { + version: '11.x', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }, + 'bundle-type=jdk&bitness=32&arch=x86&build-type=all' + ], + [ + { + version: '11-ea', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }, + 'bundle-type=jdk&bitness=32&arch=x86&build-type=ea' + ], + [ + { + version: '16.0.2', + architecture: 'x64', + packageType: 'jdk', + checkLatest: false + }, + 'bundle-type=jdk&bitness=64&arch=x86&build-type=all' + ], + [ + { + version: '16.0.2', + architecture: 'x64', + packageType: 'jre', + checkLatest: false + }, + 'bundle-type=jre&bitness=64&arch=x86&build-type=all' + ], + [ + { + version: '8', + architecture: 'armv7', + packageType: 'jdk+fx', + checkLatest: false + }, + 'bundle-type=jdk-full&bitness=32&arch=arm&build-type=all' + ], + [ + { + version: '8', + architecture: 'aarch64', + packageType: 'jre+fx', + checkLatest: false + }, + 'bundle-type=jre-full&bitness=64&arch=arm&build-type=all' + ] + ])('build correct url for %s -> %s', async (input, urlParams) => { + const additionalParams = + '&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' + + 'updateVersion%2CbuildVersion'; + const distribution = new LibericaDistributions(input); + distribution['getPlatformOption'] = () => 'linux'; + const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=linux&${urlParams}${additionalParams}`; + + await distribution['getAvailableVersions'](); + + expect(spyHttpClient.mock.calls).toHaveLength(1); + expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); + }); + + type DistroArch = { + bitness: string; + arch: string; + }; + it.each([ + ['amd64', {bitness: '64', arch: 'x86'}], + ['arm64', {bitness: '64', arch: 'arm'}] + ])( + 'defaults to os.arch(): %s mapped to distro arch: %s', + async (osArch: string, distroArch: DistroArch) => { + jest.spyOn(os, 'arch').mockReturnValue(osArch); + + const distribution = new LibericaDistributions({ + version: '17', + architecture: '', // to get default value + packageType: 'jdk', + checkLatest: false + }); + + const additionalParams = + '&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' + + 'updateVersion%2CbuildVersion'; + distribution['getPlatformOption'] = () => 'linux'; + + const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=linux&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`; + + await distribution['getAvailableVersions'](); + + expect(spyHttpClient.mock.calls).toHaveLength(1); + expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); + } + ); + + it('load available versions', async () => { + const distribution = new LibericaDistributions({ + version: '11', + architecture: 'x64', + packageType: 'jdk', + checkLatest: false + }); + const availableVersions = await distribution['getAvailableVersions'](); + expect(availableVersions).toEqual(manifestData); + }); +}); + +describe('getArchitectureOptions', () => { + it.each([ + ['x86', {bitness: '32', arch: 'x86'}], + ['x64', {bitness: '64', arch: 'x86'}], + ['armv7', {bitness: '32', arch: 'arm'}], + ['aarch64', {bitness: '64', arch: 'arm'}], + ['ppc64le', {bitness: '64', arch: 'ppc'}] + ] as [string, ArchitectureOptions][])( + 'parse architecture %s -> %s', + (input, expected) => { + const distributions = new LibericaDistributions({ + architecture: input, + checkLatest: false, + packageType: '', + version: '' + }); + + expect(distributions['getArchitectureOptions']()).toEqual(expected); + } + ); + + it.each(['armv6', 's390x'])('not support architecture %s', input => { + const distributions = new LibericaDistributions({ + architecture: input, + checkLatest: false, + packageType: '', + version: '' + }); + + expect(() => distributions['getArchitectureOptions']()).toThrow( + /Architecture '\w+' is not supported\. Supported architectures: .*/ + ); + }); +}); + +describe('findPackageForDownload', () => { + let distribution: LibericaDistributions; + + beforeEach(() => { + distribution = new LibericaDistributions({ + version: '', + architecture: 'x64', + packageType: 'jdk', + checkLatest: false + }); + distribution['getAvailableVersions'] = async () => manifestData; + }); + + it.each([ + ['8', '8.0.302+8'], + ['11.x', '11.0.12+7'], + ['8.0', '8.0.302+8'], + ['11.0.x', '11.0.12+7'], + ['15', '15.0.2+10'], + ['15.0', '15.0.2+10'], + ['15.0.0', '15.0.0+36'], + ['8.0.232', '8.0.232+10'], + ['8.0.232+9', '8.0.232+9'], + ['15.0.2+8', '15.0.2+8'], + ['15.0.2+10', '15.0.2+10'] + ])('version is %s -> %s', async (input, expected) => { + const result = await distribution['findPackageForDownload'](input); + expect(result.version).toBe(expected); + }); + + it('should throw an error', async () => { + await expect(distribution['findPackageForDownload']('18')).rejects.toThrow( + /Could not find satisfied version for semver */ + ); + }); +}); + +describe('getPlatformOption', () => { + const distributions = new LibericaDistributions({ + architecture: 'x64', + version: '11', + packageType: 'jdk', + checkLatest: false + }); + + it.each([ + ['linux', 'linux'], + ['darwin', 'macos'], + ['win32', 'windows'], + ['cygwin', 'windows'], + ['sunos', 'solaris'] + ])('os version %s -> %s', (input, expected) => { + const actual = distributions['getPlatformOption'](input as NodeJS.Platform); + + expect(actual).toEqual(expected); + }); + + it.each(['aix', 'android', 'freebsd', 'openbsd', 'netbsd'])( + 'not support os version %s', + input => { + expect(() => + distributions['getPlatformOption'](input as NodeJS.Platform) + ).toThrow(/Platform '\w+' is not supported\. Supported platforms: .+/); + } + ); +}); + +describe('convertVersionToSemver', () => { + const distributions = new LibericaDistributions({ + architecture: 'x64', + version: '11', + packageType: 'jdk', + checkLatest: false + }); + + it.each([ + [ + { + featureVersion: 11, + interimVersion: 0, + updateVersion: 12, + buildVersion: 7 + }, + '11.0.12+7' + ], + [ + { + featureVersion: 11, + interimVersion: 0, + updateVersion: 12, + buildVersion: 0 + }, + '11.0.12' + ], + [ + { + featureVersion: 11, + interimVersion: 0, + updateVersion: 0, + buildVersion: 13 + }, + '11.0.0+13' + ] + ])('%s -> %s', (input, expected) => { + const actual = distributions['convertVersionToSemver']({ + downloadUrl: '', + version: '', + ...input + }); + + expect(actual).toEqual(expected); + }); +}); diff --git a/__tests__/distributors/liberica-windows-installer.test.ts b/__tests__/distributors/liberica-windows-installer.test.ts new file mode 100644 index 000000000..1ccc57ede --- /dev/null +++ b/__tests__/distributors/liberica-windows-installer.test.ts @@ -0,0 +1,290 @@ +import {LibericaDistributions} from '../../src/distributions/liberica/installer'; +import { + ArchitectureOptions, + LibericaVersion +} from '../../src/distributions/liberica/models'; +import {HttpClient} from '@actions/http-client'; +import os from 'os'; + +import manifestData from '../data/liberica-windows.json'; + +describe('getAvailableVersions', () => { + let spyHttpClient: jest.SpyInstance; + + beforeEach(() => { + spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson'); + spyHttpClient.mockReturnValue({ + statusCode: 200, + headers: {}, + result: manifestData as LibericaVersion[] + }); + }); + + afterEach(() => { + jest.resetAllMocks(); + jest.clearAllMocks(); + jest.restoreAllMocks(); + }); + + it.each([ + [ + { + version: '11.x', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }, + 'bundle-type=jdk&bitness=32&arch=x86&build-type=all' + ], + [ + { + version: '11-ea', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }, + 'bundle-type=jdk&bitness=32&arch=x86&build-type=ea' + ], + [ + { + version: '16.0.2', + architecture: 'x64', + packageType: 'jdk', + checkLatest: false + }, + 'bundle-type=jdk&bitness=64&arch=x86&build-type=all' + ], + [ + { + version: '16.0.2', + architecture: 'x64', + packageType: 'jre', + checkLatest: false + }, + 'bundle-type=jre&bitness=64&arch=x86&build-type=all' + ], + [ + { + version: '8', + architecture: 'armv7', + packageType: 'jdk+fx', + checkLatest: false + }, + 'bundle-type=jdk-full&bitness=32&arch=arm&build-type=all' + ], + [ + { + version: '8', + architecture: 'aarch64', + packageType: 'jre+fx', + checkLatest: false + }, + 'bundle-type=jre-full&bitness=64&arch=arm&build-type=all' + ] + ])('build correct url for %s -> %s', async (input, urlParams) => { + const additionalParams = + '&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' + + 'updateVersion%2CbuildVersion'; + const distribution = new LibericaDistributions(input); + distribution['getPlatformOption'] = () => 'windows'; + const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=windows&${urlParams}${additionalParams}`; + + await distribution['getAvailableVersions'](); + + expect(spyHttpClient.mock.calls).toHaveLength(1); + expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); + }); + + type DistroArch = { + bitness: string; + arch: string; + }; + it.each([ + ['amd64', {bitness: '64', arch: 'x86'}], + ['arm64', {bitness: '64', arch: 'arm'}] + ])( + 'defaults to os.arch(): %s mapped to distro arch: %s', + async (osArch: string, distroArch: DistroArch) => { + jest.spyOn(os, 'arch').mockReturnValue(osArch); + + const distribution = new LibericaDistributions({ + version: '17', + architecture: '', // to get default value + packageType: 'jdk', + checkLatest: false + }); + + const additionalParams = + '&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' + + 'updateVersion%2CbuildVersion'; + distribution['getPlatformOption'] = () => 'windows'; + + const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=windows&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`; + + await distribution['getAvailableVersions'](); + + expect(spyHttpClient.mock.calls).toHaveLength(1); + expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); + } + ); + + it('load available versions', async () => { + const distribution = new LibericaDistributions({ + version: '11', + architecture: 'x64', + packageType: 'jdk', + checkLatest: false + }); + const availableVersions = await distribution['getAvailableVersions'](); + expect(availableVersions).toEqual(manifestData); + }); +}); + +describe('getArchitectureOptions', () => { + it.each([ + ['x86', {bitness: '32', arch: 'x86'}], + ['x64', {bitness: '64', arch: 'x86'}], + ['armv7', {bitness: '32', arch: 'arm'}], + ['aarch64', {bitness: '64', arch: 'arm'}], + ['ppc64le', {bitness: '64', arch: 'ppc'}] + ] as [string, ArchitectureOptions][])( + 'parse architecture %s -> %s', + (input, expected) => { + const distributions = new LibericaDistributions({ + architecture: input, + checkLatest: false, + packageType: '', + version: '' + }); + + expect(distributions['getArchitectureOptions']()).toEqual(expected); + } + ); + + it.each(['armv6', 's390x'])('not support architecture %s', input => { + const distributions = new LibericaDistributions({ + architecture: input, + checkLatest: false, + packageType: '', + version: '' + }); + + expect(() => distributions['getArchitectureOptions']()).toThrow( + /Architecture '\w+' is not supported\. Supported architectures: .*/ + ); + }); +}); + +describe('findPackageForDownload', () => { + let distribution: LibericaDistributions; + + beforeEach(() => { + distribution = new LibericaDistributions({ + version: '', + architecture: 'x64', + packageType: 'jdk', + checkLatest: false + }); + distribution['getAvailableVersions'] = async () => manifestData; + }); + + it.each([ + ['8', '8.0.302+8'], + ['11.x', '11.0.12+7'], + ['8.0', '8.0.302+8'], + ['11.0.x', '11.0.12+7'], + ['15', '15.0.2+10'], + ['15.0', '15.0.2+10'], + ['15.0.0', '15.0.0+36'], + ['8.0.232', '8.0.232+10'], + ['8.0.232+9', '8.0.232+9'], + ['15.0.2+8', '15.0.2+8'], + ['15.0.2+10', '15.0.2+10'] + ])('version is %s -> %s', async (input, expected) => { + const result = await distribution['findPackageForDownload'](input); + expect(result.version).toBe(expected); + }); + + it('should throw an error', async () => { + await expect(distribution['findPackageForDownload']('18')).rejects.toThrow( + /Could not find satisfied version for semver */ + ); + }); +}); + +describe('getPlatformOption', () => { + const distributions = new LibericaDistributions({ + architecture: 'x64', + version: '11', + packageType: 'jdk', + checkLatest: false + }); + + it.each([ + ['linux', 'linux'], + ['darwin', 'macos'], + ['win32', 'windows'], + ['cygwin', 'windows'], + ['sunos', 'solaris'] + ])('os version %s -> %s', (input, expected) => { + const actual = distributions['getPlatformOption'](input as NodeJS.Platform); + + expect(actual).toEqual(expected); + }); + + it.each(['aix', 'android', 'freebsd', 'openbsd', 'netbsd'])( + 'not support os version %s', + input => { + expect(() => + distributions['getPlatformOption'](input as NodeJS.Platform) + ).toThrow(/Platform '\w+' is not supported\. Supported platforms: .+/); + } + ); +}); + +describe('convertVersionToSemver', () => { + const distributions = new LibericaDistributions({ + architecture: 'x64', + version: '11', + packageType: 'jdk', + checkLatest: false + }); + + it.each([ + [ + { + featureVersion: 11, + interimVersion: 0, + updateVersion: 12, + buildVersion: 7 + }, + '11.0.12+7' + ], + [ + { + featureVersion: 11, + interimVersion: 0, + updateVersion: 12, + buildVersion: 0 + }, + '11.0.12' + ], + [ + { + featureVersion: 11, + interimVersion: 0, + updateVersion: 0, + buildVersion: 13 + }, + '11.0.0+13' + ] + ])('%s -> %s', (input, expected) => { + const actual = distributions['convertVersionToSemver']({ + downloadUrl: '', + version: '', + ...input + }); + + expect(actual).toEqual(expected); + }); +}); diff --git a/__tests__/distributors/microsoft-installer.test.ts b/__tests__/distributors/microsoft-installer.test.ts index 011df1b13..00c4b6c6e 100644 --- a/__tests__/distributors/microsoft-installer.test.ts +++ b/__tests__/distributors/microsoft-installer.test.ts @@ -89,6 +89,30 @@ describe('findPackageForDownload', () => { expect(result.url).toBe(url); }); + it.each([ + ['amd64', 'x64'], + ['arm64', 'aarch64'] + ])( + 'defaults to os.arch(): %s mapped to distro arch: %s', + async (osArch: string, distroArch: string) => { + jest.spyOn(os, 'arch').mockReturnValue(osArch); + jest.spyOn(os, 'platform').mockReturnValue('darwin'); + + const version = '17'; + const distro = new MicrosoftDistributions({ + version, + architecture: '', // to get default value + packageType: 'jdk', + checkLatest: false + }); + + const result = await distro['findPackageForDownload'](version); + const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.7-macos-${distroArch}.tar.gz`; + + expect(result.url).toBe(expectedUrl); + } + ); + it.each([ ['amd64', 'x64'], ['arm64', 'aarch64'] @@ -113,6 +137,30 @@ describe('findPackageForDownload', () => { } ); + it.each([ + ['amd64', 'x64'], + ['arm64', 'aarch64'] + ])( + 'defaults to os.arch(): %s mapped to distro arch: %s', + async (osArch: string, distroArch: string) => { + jest.spyOn(os, 'arch').mockReturnValue(osArch); + jest.spyOn(os, 'platform').mockReturnValue('win32'); + + const version = '17'; + const distro = new MicrosoftDistributions({ + version, + architecture: '', // to get default value + packageType: 'jdk', + checkLatest: false + }); + + const result = await distro['findPackageForDownload'](version); + const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.7-windows-${distroArch}.zip`; + + expect(result.url).toBe(expectedUrl); + } + ); + it('should throw an error', async () => { await expect(distribution['findPackageForDownload']('8')).rejects.toThrow( /Could not find satisfied version for SemVer */ diff --git a/__tests__/distributors/zulu-linux-installer.test.ts b/__tests__/distributors/zulu-linux-installer.test.ts new file mode 100644 index 000000000..60f36ee59 --- /dev/null +++ b/__tests__/distributors/zulu-linux-installer.test.ts @@ -0,0 +1,229 @@ +import {HttpClient} from '@actions/http-client'; +import * as semver from 'semver'; +import {ZuluDistribution} from '../../src/distributions/zulu/installer'; +import {IZuluVersions} from '../../src/distributions/zulu/models'; +import * as utils from '../../src/util'; +import os from 'os'; + +import manifestData from '../data/zulu-linux.json'; + +describe('getAvailableVersions', () => { + let spyHttpClient: jest.SpyInstance; + let spyUtilGetDownloadArchiveExtension: jest.SpyInstance; + + beforeEach(() => { + spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson'); + spyHttpClient.mockReturnValue({ + statusCode: 200, + headers: {}, + result: manifestData as IZuluVersions[] + }); + + spyUtilGetDownloadArchiveExtension = jest.spyOn( + utils, + 'getDownloadArchiveExtension' + ); + spyUtilGetDownloadArchiveExtension.mockReturnValue('zip'); + }); + + afterEach(() => { + jest.resetAllMocks(); + jest.clearAllMocks(); + jest.restoreAllMocks(); + }); + + it.each([ + [ + { + version: '11', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }, + '?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ga' + ], + [ + { + version: '11-ea', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }, + '?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ea' + ], + [ + { + version: '8', + architecture: 'x64', + packageType: 'jdk', + checkLatest: false + }, + '?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=64&release_status=ga' + ], + [ + { + version: '8', + architecture: 'x64', + packageType: 'jre', + checkLatest: false + }, + '?os=linux&ext=zip&bundle_type=jre&javafx=false&arch=x86&hw_bitness=64&release_status=ga' + ], + [ + { + version: '8', + architecture: 'x64', + packageType: 'jdk+fx', + checkLatest: false + }, + '?os=linux&ext=zip&bundle_type=jdk&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx' + ], + [ + { + version: '8', + architecture: 'x64', + packageType: 'jre+fx', + checkLatest: false + }, + '?os=linux&ext=zip&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx' + ], + [ + { + version: '11', + architecture: 'arm64', + packageType: 'jdk', + checkLatest: false + }, + '?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=64&release_status=ga' + ], + [ + { + version: '11', + architecture: 'arm', + packageType: 'jdk', + checkLatest: false + }, + '?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=&release_status=ga' + ] + ])('build correct url for %s -> %s', async (input, parsedUrl) => { + const distribution = new ZuluDistribution(input); + distribution['getPlatformOption'] = () => 'linux'; + const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/${parsedUrl}`; + + await distribution['getAvailableVersions'](); + + expect(spyHttpClient.mock.calls).toHaveLength(1); + expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); + }); + + type DistroArch = { + bitness: string; + arch: string; + }; + it.each([ + ['amd64', {bitness: '64', arch: 'x86'}], + ['arm64', {bitness: '64', arch: 'arm'}] + ])( + 'defaults to os.arch(): %s mapped to distro arch: %s', + async (osArch: string, distroArch: DistroArch) => { + jest.spyOn(os, 'arch').mockReturnValue(osArch); + + const distribution = new ZuluDistribution({ + version: '17', + architecture: '', // to get default value + packageType: 'jdk', + checkLatest: false + }); + distribution['getPlatformOption'] = () => 'linux'; + const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`; + + await distribution['getAvailableVersions'](); + + expect(spyHttpClient.mock.calls).toHaveLength(1); + expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); + } + ); + + it('load available versions', async () => { + const distribution = new ZuluDistribution({ + version: '11', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }); + const availableVersions = await distribution['getAvailableVersions'](); + expect(availableVersions).toHaveLength(manifestData.length); + }); +}); + +describe('getArchitectureOptions', () => { + it.each([ + [{architecture: 'x64'}, {arch: 'x86', hw_bitness: '64', abi: ''}], + [{architecture: 'x86'}, {arch: 'x86', hw_bitness: '32', abi: ''}], + [{architecture: 'x32'}, {arch: 'x32', hw_bitness: '', abi: ''}], + [{architecture: 'arm'}, {arch: 'arm', hw_bitness: '', abi: ''}] + ])('%s -> %s', (input, expected) => { + const distribution = new ZuluDistribution({ + version: '11', + architecture: input.architecture, + packageType: 'jdk', + checkLatest: false + }); + expect(distribution['getArchitectureOptions']()).toEqual(expected); + }); +}); + +describe('findPackageForDownload', () => { + it.each([ + ['8', '8.0.282+8'], + ['11.x', '11.0.10+9'], + ['8.0', '8.0.282+8'], + ['11.0.x', '11.0.10+9'], + ['15', '15.0.2+7'], + ['9.0.0', '9.0.0+0'], + ['9.0', '9.0.1+0'], + ['8.0.262', '8.0.262+19'], // validate correct choice between [8.0.262.17, 8.0.262.19, 8.0.262.18] + ['8.0.262+17', '8.0.262+17'], + ['15.0.1+8', '15.0.1+8'], + ['15.0.1+9', '15.0.1+9'] + ])('version is %s -> %s', async (input, expected) => { + const distribution = new ZuluDistribution({ + version: input, + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }); + distribution['getAvailableVersions'] = async () => manifestData; + const result = await distribution['findPackageForDownload']( + distribution['version'] + ); + expect(result.version).toBe(expected); + }); + + it('select correct bundle if there are multiple items with the same jdk version but different zulu versions', async () => { + const distribution = new ZuluDistribution({ + version: '', + architecture: 'arm64', + packageType: 'jdk', + checkLatest: false + }); + distribution['getAvailableVersions'] = async () => manifestData; + const result = await distribution['findPackageForDownload']('21.0.2'); + expect(result.url).toBe( + 'https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz' + ); + }); + + it('should throw an error', async () => { + const distribution = new ZuluDistribution({ + version: '18', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }); + distribution['getAvailableVersions'] = async () => manifestData; + await expect( + distribution['findPackageForDownload'](distribution['version']) + ).rejects.toThrow(/Could not find satisfied version for semver */); + }); +}); diff --git a/__tests__/distributors/zulu-windows-installer.test.ts b/__tests__/distributors/zulu-windows-installer.test.ts new file mode 100644 index 000000000..dcac5aa0d --- /dev/null +++ b/__tests__/distributors/zulu-windows-installer.test.ts @@ -0,0 +1,229 @@ +import {HttpClient} from '@actions/http-client'; +import * as semver from 'semver'; +import {ZuluDistribution} from '../../src/distributions/zulu/installer'; +import {IZuluVersions} from '../../src/distributions/zulu/models'; +import * as utils from '../../src/util'; +import os from 'os'; + +import manifestData from '../data/zulu-windows.json'; + +describe('getAvailableVersions', () => { + let spyHttpClient: jest.SpyInstance; + let spyUtilGetDownloadArchiveExtension: jest.SpyInstance; + + beforeEach(() => { + spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson'); + spyHttpClient.mockReturnValue({ + statusCode: 200, + headers: {}, + result: manifestData as IZuluVersions[] + }); + + spyUtilGetDownloadArchiveExtension = jest.spyOn( + utils, + 'getDownloadArchiveExtension' + ); + spyUtilGetDownloadArchiveExtension.mockReturnValue('zip'); + }); + + afterEach(() => { + jest.resetAllMocks(); + jest.clearAllMocks(); + jest.restoreAllMocks(); + }); + + it.each([ + [ + { + version: '11', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }, + '?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ga' + ], + [ + { + version: '11-ea', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }, + '?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ea' + ], + [ + { + version: '8', + architecture: 'x64', + packageType: 'jdk', + checkLatest: false + }, + '?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=64&release_status=ga' + ], + [ + { + version: '8', + architecture: 'x64', + packageType: 'jre', + checkLatest: false + }, + '?os=windows&ext=zip&bundle_type=jre&javafx=false&arch=x86&hw_bitness=64&release_status=ga' + ], + [ + { + version: '8', + architecture: 'x64', + packageType: 'jdk+fx', + checkLatest: false + }, + '?os=windows&ext=zip&bundle_type=jdk&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx' + ], + [ + { + version: '8', + architecture: 'x64', + packageType: 'jre+fx', + checkLatest: false + }, + '?os=windows&ext=zip&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx' + ], + [ + { + version: '11', + architecture: 'arm64', + packageType: 'jdk', + checkLatest: false + }, + '?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=64&release_status=ga' + ], + [ + { + version: '11', + architecture: 'arm', + packageType: 'jdk', + checkLatest: false + }, + '?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=&release_status=ga' + ] + ])('build correct url for %s -> %s', async (input, parsedUrl) => { + const distribution = new ZuluDistribution(input); + distribution['getPlatformOption'] = () => 'windows'; + const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/${parsedUrl}`; + + await distribution['getAvailableVersions'](); + + expect(spyHttpClient.mock.calls).toHaveLength(1); + expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); + }); + + type DistroArch = { + bitness: string; + arch: string; + }; + it.each([ + ['amd64', {bitness: '64', arch: 'x86'}], + ['arm64', {bitness: '64', arch: 'arm'}] + ])( + 'defaults to os.arch(): %s mapped to distro arch: %s', + async (osArch: string, distroArch: DistroArch) => { + jest.spyOn(os, 'arch').mockReturnValue(osArch); + + const distribution = new ZuluDistribution({ + version: '17', + architecture: '', // to get default value + packageType: 'jdk', + checkLatest: false + }); + distribution['getPlatformOption'] = () => 'windows'; + const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`; + + await distribution['getAvailableVersions'](); + + expect(spyHttpClient.mock.calls).toHaveLength(1); + expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); + } + ); + + it('load available versions', async () => { + const distribution = new ZuluDistribution({ + version: '11', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }); + const availableVersions = await distribution['getAvailableVersions'](); + expect(availableVersions).toHaveLength(manifestData.length); + }); +}); + +describe('getArchitectureOptions', () => { + it.each([ + [{architecture: 'x64'}, {arch: 'x86', hw_bitness: '64', abi: ''}], + [{architecture: 'x86'}, {arch: 'x86', hw_bitness: '32', abi: ''}], + [{architecture: 'x32'}, {arch: 'x32', hw_bitness: '', abi: ''}], + [{architecture: 'arm'}, {arch: 'arm', hw_bitness: '', abi: ''}] + ])('%s -> %s', (input, expected) => { + const distribution = new ZuluDistribution({ + version: '11', + architecture: input.architecture, + packageType: 'jdk', + checkLatest: false + }); + expect(distribution['getArchitectureOptions']()).toEqual(expected); + }); +}); + +describe('findPackageForDownload', () => { + it.each([ + ['8', '8.0.282+8'], + ['11.x', '11.0.10+9'], + ['8.0', '8.0.282+8'], + ['11.0.x', '11.0.10+9'], + ['15', '15.0.2+7'], + ['9.0.0', '9.0.0+0'], + ['9.0', '9.0.1+0'], + ['8.0.262', '8.0.262+19'], // validate correct choice between [8.0.262.17, 8.0.262.19, 8.0.262.18] + ['8.0.262+17', '8.0.262+17'], + ['15.0.1+8', '15.0.1+8'], + ['15.0.1+9', '15.0.1+9'] + ])('version is %s -> %s', async (input, expected) => { + const distribution = new ZuluDistribution({ + version: input, + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }); + distribution['getAvailableVersions'] = async () => manifestData; + const result = await distribution['findPackageForDownload']( + distribution['version'] + ); + expect(result.version).toBe(expected); + }); + + it('select correct bundle if there are multiple items with the same jdk version but different zulu versions', async () => { + const distribution = new ZuluDistribution({ + version: '', + architecture: 'arm64', + packageType: 'jdk', + checkLatest: false + }); + distribution['getAvailableVersions'] = async () => manifestData; + const result = await distribution['findPackageForDownload']('17.0.10'); + expect(result.url).toBe( + 'https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip' + ); + }); + + it('should throw an error', async () => { + const distribution = new ZuluDistribution({ + version: '18', + architecture: 'x86', + packageType: 'jdk', + checkLatest: false + }); + distribution['getAvailableVersions'] = async () => manifestData; + await expect( + distribution['findPackageForDownload'](distribution['version']) + ).rejects.toThrow(/Could not find satisfied version for semver */); + }); +}); diff --git a/dist/setup/index.js b/dist/setup/index.js index 916f488bb..f8c70dab2 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -123685,9 +123685,15 @@ class LibericaDistributions extends base_installer_1.JavaBase { downloadTool(javaRelease) { return __awaiter(this, void 0, void 0, function* () { core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`); - const javaArchivePath = yield tc.downloadTool(javaRelease.url); + let javaArchivePath = yield tc.downloadTool(javaRelease.url); core.info(`Extracting Java archive...`); const extension = (0, util_1.getDownloadArchiveExtension)(); + if (process.platform === 'win32' && + (this.architecture === 'arm64' || this.architecture === 'aarch64')) { + const javaArchivePathRenamed = `${javaArchivePath}.zip`; + yield fs_1.default.renameSync(javaArchivePath, javaArchivePathRenamed); + javaArchivePath = javaArchivePathRenamed; + } const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension); const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0]; const archivePath = path_1.default.join(extractedJavaPath, archiveName); @@ -123967,7 +123973,18 @@ class MicrosoftDistributions extends base_installer_1.JavaBase { downloadTool(javaRelease) { return __awaiter(this, void 0, void 0, function* () { core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`); - const javaArchivePath = yield tc.downloadTool(javaRelease.url); + let javaArchivePath = yield tc.downloadTool(javaRelease.url); + // Rename archive to add extension because after downloading + // archive does not contain extension type and it leads to some issues + // on Windows runners without PowerShell Core. + // + // For default PowerShell Windows it should contain extension type to unpack it. + if (process.platform === 'win32' && + (this.architecture === 'arm64' || this.architecture === 'aarch64')) { + const javaArchivePathRenamed = `${javaArchivePath}.zip`; + yield fs_1.default.renameSync(javaArchivePath, javaArchivePathRenamed); + javaArchivePath = javaArchivePathRenamed; + } core.info(`Extracting Java archive...`); const extension = (0, util_1.getDownloadArchiveExtension)(); const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension); @@ -124635,9 +124652,15 @@ class ZuluDistribution extends base_installer_1.JavaBase { downloadTool(javaRelease) { return __awaiter(this, void 0, void 0, function* () { core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`); - const javaArchivePath = yield tc.downloadTool(javaRelease.url); + let javaArchivePath = yield tc.downloadTool(javaRelease.url); core.info(`Extracting Java archive...`); const extension = (0, util_1.getDownloadArchiveExtension)(); + if (process.platform === 'win32' && + (this.architecture === 'arm64' || this.architecture === 'aarch64')) { + const javaArchivePathRenamed = `${javaArchivePath}.zip`; + yield fs_1.default.renameSync(javaArchivePath, javaArchivePathRenamed); + javaArchivePath = javaArchivePathRenamed; + } const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension); const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0]; const archivePath = path_1.default.join(extractedJavaPath, archiveName); diff --git a/package.json b/package.json index 3f6eb92fd..dba2d0471 100644 --- a/package.json +++ b/package.json @@ -57,5 +57,4 @@ "url": "https://github.com/actions/setup-java/issues" }, "homepage": "https://github.com/actions/setup-java#readme" - } diff --git a/src/distributions/liberica/installer.ts b/src/distributions/liberica/installer.ts index 313f29eae..3ed9435ab 100644 --- a/src/distributions/liberica/installer.ts +++ b/src/distributions/liberica/installer.ts @@ -31,10 +31,18 @@ export class LibericaDistributions extends JavaBase { core.info( `Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...` ); - const javaArchivePath = await tc.downloadTool(javaRelease.url); + let javaArchivePath = await tc.downloadTool(javaRelease.url); core.info(`Extracting Java archive...`); const extension = getDownloadArchiveExtension(); + if ( + process.platform === 'win32' && + (this.architecture === 'arm64' || this.architecture === 'aarch64') + ) { + const javaArchivePathRenamed = `${javaArchivePath}.zip`; + await fs.renameSync(javaArchivePath, javaArchivePathRenamed); + javaArchivePath = javaArchivePathRenamed; + } const extractedJavaPath = await extractJdkFile(javaArchivePath, extension); const archiveName = fs.readdirSync(extractedJavaPath)[0]; diff --git a/src/distributions/microsoft/installer.ts b/src/distributions/microsoft/installer.ts index 6feafabc0..d20e55da6 100644 --- a/src/distributions/microsoft/installer.ts +++ b/src/distributions/microsoft/installer.ts @@ -26,7 +26,20 @@ export class MicrosoftDistributions extends JavaBase { core.info( `Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...` ); - const javaArchivePath = await tc.downloadTool(javaRelease.url); + let javaArchivePath = await tc.downloadTool(javaRelease.url); + // Rename archive to add extension because after downloading + // archive does not contain extension type and it leads to some issues + // on Windows runners without PowerShell Core. + // + // For default PowerShell Windows it should contain extension type to unpack it. + if ( + process.platform === 'win32' && + (this.architecture === 'arm64' || this.architecture === 'aarch64') + ) { + const javaArchivePathRenamed = `${javaArchivePath}.zip`; + await fs.renameSync(javaArchivePath, javaArchivePathRenamed); + javaArchivePath = javaArchivePathRenamed; + } core.info(`Extracting Java archive...`); const extension = getDownloadArchiveExtension(); diff --git a/src/distributions/microsoft/microsoft-openjdk-versions.json b/src/distributions/microsoft/microsoft-openjdk-versions.json index 9b7e798b1..4fd1e974f 100644 --- a/src/distributions/microsoft/microsoft-openjdk-versions.json +++ b/src/distributions/microsoft/microsoft-openjdk-versions.json @@ -1,4 +1,90 @@ [ + { + "version": "21.0.2", + "stable": true, + "release_url": "https://aka.ms/download-jdk", + "files": [ + { + "filename": "microsoft-jdk-21.0.2-macos-x64.tar.gz", + "arch": "x64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-macos-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-21.0.2-linux-x64.tar.gz", + "arch": "x64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-linux-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-21.0.2-windows-x64.zip", + "arch": "x64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-x64.zip" + }, + { + "filename": "microsoft-jdk-21.0.2-macos-aarch64.tar.gz", + "arch": "aarch64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-macos-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-21.0.2-linux-aarch64.tar.gz", + "arch": "aarch64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-21.0.2-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-aarch64.zip" + } + ] +}, + { + "version": "21.0.1", + "stable": true, + "release_url": "https://aka.ms/download-jdk", + "files": [ + { + "filename": "microsoft-jdk-21.0.1-macos-x64.tar.gz", + "arch": "x64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-macos-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-21.0.1-linux-x64.tar.gz", + "arch": "x64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-21.0.1-windows-x64.zip", + "arch": "x64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-x64.zip" + }, + { + "filename": "microsoft-jdk-21.0.1-macos-aarch64.tar.gz", + "arch": "aarch64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-macos-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-21.0.1-linux-aarch64.tar.gz", + "arch": "aarch64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-21.0.1-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-aarch64.zip" + } + ] +}, { "version": "21.0.0", "stable": true, @@ -33,6 +119,184 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.0-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-21.0.0-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.0-windows-aarch64.zip" + } + ] + }, + { + "version": "17.0.10", + "stable": true, + "release_url": "https://aka.ms/download-jdk", + "files": [ + { + "filename": "microsoft-jdk-17.0.10-macos-x64.tar.gz", + "arch": "x64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-macos-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.10-linux-x64.tar.gz", + "arch": "x64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.10-linux-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.10-windows-x64.zip", + "arch": "x64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.10-windows-x64.zip" + }, + { + "filename": "microsoft-jdk-17.0.10-macos-aarch64.tar.gz", + "arch": "aarch64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.10-macos-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.10-linux-aarch64.tar.gz", + "arch": "aarch64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.10-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.10-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.10-windows-aarch64.zip" + } + ] + }, + { + "version": "17.0.9", + "stable": true, + "release_url": "https://aka.ms/download-jdk", + "files": [ + { + "filename": "microsoft-jdk-17.0.9-macos-x64.tar.gz", + "arch": "x64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.9-linux-x64.tar.gz", + "arch": "x64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.9-windows-x64.zip", + "arch": "x64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-x64.zip" + }, + { + "filename": "microsoft-jdk-17.0.9-macos-aarch64.tar.gz", + "arch": "aarch64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.9-linux-aarch64.tar.gz", + "arch": "aarch64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.9-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-aarch64.zip" + } + ] + }, + { + "version": "17.0.8", + "stable": true, + "release_url": "https://aka.ms/download-jdk", + "files": [ + { + "filename": "microsoft-jdk-17.0.8-macos-x64.tar.gz", + "arch": "x64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8-macos-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.8-linux-x64.tar.gz", + "arch": "x64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8-linux-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.8-windows-x64.zip", + "arch": "x64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8-windows-x64.zip" + }, + { + "filename": "microsoft-jdk-17.0.8-macos-aarch64.tar.gz", + "arch": "aarch64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8-macos-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.8-linux-aarch64.tar.gz", + "arch": "aarch64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.8-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8-windows-aarch64.zip" + } + ] + }, + { + "version": "17.0.8.1", + "stable": true, + "release_url": "https://aka.ms/download-jdk", + "files": [ + { + "filename": "microsoft-jdk-17.0.8.1-macos-x64.tar.gz", + "arch": "x64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8.1-macos-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.8.1-linux-x64.tar.gz", + "arch": "x64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8.1-linux-x64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.8.1-windows-x64.zip", + "arch": "x64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8.1-windows-x64.zip" + }, + { + "filename": "microsoft-jdk-17.0.8.1-macos-aarch64.tar.gz", + "arch": "aarch64", + "platform": "darwin", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8.1-macos-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.8.1-linux-aarch64.tar.gz", + "arch": "aarch64", + "platform": "linux", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8.1-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.8.1-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.8.1-windows-aarch64.zip" } ] }, @@ -70,6 +334,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.7-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-windows-aarch64.zip" } ] }, @@ -107,6 +377,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.6-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.6-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.6-windows-aarch64.zip" } ] }, @@ -144,6 +420,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.5-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.5-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.5-windows-aarch64.zip" } ] }, @@ -181,6 +463,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.4-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.4-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.4-windows-aarch64.zip" } ] }, @@ -218,6 +506,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.3-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-17.0.3-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.3-windows-aarch64.zip" } ] }, @@ -329,6 +623,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.19-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-11.0.19-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.19-windows-aarch64.zip" } ] }, @@ -366,6 +666,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.18-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-11.0.18-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.18-windows-aarch64.zip" } ] }, @@ -403,6 +709,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.17-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-11.0.17-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.17-windows-aarch64.zip" } ] }, @@ -440,6 +752,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.16-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-11.0.16-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.16-windows-aarch64.zip" } ] }, @@ -477,6 +795,12 @@ "arch": "aarch64", "platform": "linux", "download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.15-linux-aarch64.tar.gz" + }, + { + "filename": "microsoft-jdk-11.0.15-windows-aarch64.zip", + "arch": "aarch64", + "platform": "win32", + "download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.15-windows-aarch64.zip" } ] }, diff --git a/src/distributions/zulu/installer.ts b/src/distributions/zulu/installer.ts index c996bb8e4..e406c6b6d 100644 --- a/src/distributions/zulu/installer.ts +++ b/src/distributions/zulu/installer.ts @@ -76,11 +76,18 @@ export class ZuluDistribution extends JavaBase { core.info( `Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...` ); - const javaArchivePath = await tc.downloadTool(javaRelease.url); + let javaArchivePath = await tc.downloadTool(javaRelease.url); core.info(`Extracting Java archive...`); const extension = getDownloadArchiveExtension(); - + if ( + process.platform === 'win32' && + (this.architecture === 'arm64' || this.architecture === 'aarch64') + ) { + const javaArchivePathRenamed = `${javaArchivePath}.zip`; + await fs.renameSync(javaArchivePath, javaArchivePathRenamed); + javaArchivePath = javaArchivePathRenamed; + } const extractedJavaPath = await extractJdkFile(javaArchivePath, extension); const archiveName = fs.readdirSync(extractedJavaPath)[0];