Compare commits

..

7 Commits

Author SHA1 Message Date
b6e674f4b7 Update actions/core for releases/v1 (#467) 2023-03-29 16:25:48 +02:00
d202f5dbf7 Swap to Environment Files (#104)
* Add Licensed workflow and config files

* Manually validate dependencies

* Swap to Environment Files
2020-09-30 15:51:22 +02:00
11790a2d66 Add Licensed To Help Verify Prod Licenses (#88)
* Add Licensed workflow and config files

* Manually validate dependencies

* Ignore Generated Files in Git PR's

* update contributing.md
2020-09-23 23:23:32 +02:00
8bb50d97d6 Move contributor doc 2020-08-24 14:35:19 +02:00
fe06bcdc44 Remove old dist/index.js file (#96)
* Remove old dist/index.js file

* Misc fixes
2020-08-24 14:19:47 +02:00
d34a7e45c8 Architecture Support (#95)
* Quick fix for 32-bit architecture support.

* Validate arch at input

Co-authored-by: Émile Grégoire <eg@emilegregoire.ca>
2020-08-24 12:35:41 +02:00
3019d15cad Add Third Party Licenses (#87) 2020-08-10 18:22:52 +02:00
32 changed files with 6630 additions and 1410 deletions

1
.gitattributes vendored
View File

@ -1,2 +1,3 @@
dist/index.js -diff -merge
dist/index.js linguist-generated=true
.licenses/** -diff linguist-generated=true

20
.github/workflows/licensed.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Licensed
on:
push: {branches: main}
pull_request: {branches: main}
jobs:
test:
runs-on: ubuntu-latest
name: Check licenses
steps:
- uses: actions/checkout@v2
- run: npm ci
- name: Install licensed
run: |
cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed
- run: licensed status

View File

@ -53,7 +53,7 @@ jobs:
options: --dns 127.0.0.1
services:
squid-proxy:
image: datadog/squid:latest
image: ubuntu/squid:latest
ports:
- 3128:3128
env:

14
.licensed.yml Normal file
View File

@ -0,0 +1,14 @@
sources:
npm: true
allowed:
- apache-2.0
- bsd-2-clause
- bsd-3-clause
- isc
- mit
- cc0-1.0
- unlicense
reviewed:
npm:

BIN
.licenses/npm/@actions/core.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@actions/exec.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@actions/io.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@actions/tool-cache.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@oozcitak/dom.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@oozcitak/url.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@oozcitak/util-1.0.1.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@oozcitak/util-1.0.2.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@oozcitak/util-8.0.0.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@oozcitak/util-8.3.3.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/semver.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/tunnel.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/uuid-3.4.0.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/uuid-8.3.2.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/xmlbuilder2.dep.yml generated Normal file

Binary file not shown.

38
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,38 @@
# Contributors
### Checkin
- Do checkin source (src)
- Do checkin a single index.js file after running `ncc`
- Do not checking node_modules
### NCC
In order to avoid uploading `node_modules` to the repository, we use [zeit/ncc](https://github.com/zeit/ncc) to create multiple `index.js` files that gets saved under `dist/`.
There are two main files that get created
- `dist/setup/index.js`
- Core `setup-java` logic that downloads and installs an appropriate version of Java
- Handling creating a `settings.xml` file to make it easier to publish packages
- `dist/cleanup/index/js`
- Extra cleanup script that is used to remove GPG keys (needed for certain self-hosted runner scenarios)
If you're developing locally, after doing `npm install`, you can use the following commands
```yaml
npm run build # runs tsc along with ncc
npm run format # runs prettier --write
npm run format-check # runs prettier --check
npm run test # runs jest
npm run release # add all the necessary ncc files under dist/* to the git staging area
```
Any files generated using `tsc` will be added to `lib/*`, however those files also are not uploaded to the repository and are excluded using `.gitignore`.
### Testing
Tests are included under `_tests_/*` and can be run using `npm run-script test`.
We ask that you include a link to a successful run that utilizes the changes you are working on. For example, if your changes are in the branch `newAwesomeFeature`, then show an example run that uses `setup-python@newAwesomeFeature` or `my-fork@newAwesomeFeature`. This will help speed up testing and help us confirm that there are no breaking changes or bugs.
### Licensed
This repository uses a tool called [Licensed](https://github.com/github/licensed) to verify third party dependencies. You may need to locally install licensed and run `licensed cache` to update the dependency cache if you install or update a production dependency. If licensed cache is unable to determine the dependency, you may need to modify the cache file yourself to put the correct license. You should still verify the dependency, licensed is a tool to help, but is not a substitute for human review of dependencies.

2533
dist/cleanup/index.js vendored

File diff suppressed because it is too large Load Diff

BIN
dist/index.js generated vendored

Binary file not shown.

5350
dist/setup/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
# Contributors
### Checkin
- Do checkin source (src)
- Do checkin a single index.js file after running `ncc`
- Do not checking node_modules
### NCC
In order to avoid uploading `node_modules` to the repository, we use [zeit/ncc](https://github.com/zeit/ncc) to create a single `index.js` file that gets saved in `dist/`.
If you're developing locally you can run
```
npm install
tsc
ncc build
```
You can also do
```
npm run-script build # runs tsc
npm run-script format # runs prettier --write
npm run-script format-check # runs prettier --check
npm run-script test # runs jest
npm run-script release # runs ncc build
```
Any files generated using `tsc` will be added to `lib/*`, however those files also are not uploaded to the repository and are excluded using `.gitignore`.
### Testing
Tests are included under `_tests_/*` and can be run using `npm run-script test`.
We ask that you include a link to a successful run that utilizes the changes you are working on. For example, if your changes are in the branch `newAwesomeFeature`, then show an example run that uses `setup-python@newAwesomeFeature` or `my-fork@newAwesomeFeature`. This will help speed up testing and help us confirm that there are no breaking changes or bugs.

25
package-lock.json generated
View File

@ -5,9 +5,28 @@
"requires": true,
"dependencies": {
"@actions/core": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
"integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg=="
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"requires": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
},
"dependencies": {
"@actions/http-client": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.0.tgz",
"integrity": "sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==",
"requires": {
"tunnel": "^0.0.6"
}
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
},
"@actions/exec": {
"version": "1.0.3",

View File

@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"description": "setup java action",
"main": "dist/index.js",
"main": "dist/setup/index.js",
"scripts": {
"build": "ncc build -o dist/setup src/setup-java.ts && ncc build -o dist/cleanup src/cleanup-java.ts",
"format": "prettier --write **/*.ts",
@ -24,7 +24,7 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.0.0",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.0.0",
"@actions/http-client": "^1.0.8",
"@actions/io": "^1.0.0",

View File

@ -45,7 +45,7 @@ export async function getJava(
const contents = await response.readBody();
const refs = contents.match(/<a href.*\">/gi) || [];
const downloadInfo = getDownloadInfo(refs, version, javaPackage);
const downloadInfo = getDownloadInfo(refs, version, arch, javaPackage);
jdkFile = await tc.downloadTool(downloadInfo.url);
version = downloadInfo.version;
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
@ -181,20 +181,26 @@ async function unzipJavaDownload(
function getDownloadInfo(
refs: string[],
version: string,
arch: string,
javaPackage: string
): {version: string; url: string} {
version = normalizeVersion(version);
const archExtension = arch === 'x86' ? 'i686' : 'x64';
let extension = '';
if (IS_WINDOWS) {
extension = `-win_x64.zip`;
extension = `-win_${archExtension}.zip`;
} else {
if (process.platform === 'darwin') {
extension = `-macosx_x64.tar.gz`;
extension = `-macosx_${archExtension}.tar.gz`;
} else {
extension = `-linux_x64.tar.gz`;
extension = `-linux_${archExtension}.tar.gz`;
}
}
core.debug(`Searching for files with extension: ${extension}`);
let pkgRegexp = new RegExp('');
let pkgTypeLength = 0;
if (javaPackage === 'jdk') {

View File

@ -11,7 +11,12 @@ async function run() {
if (!version) {
version = core.getInput(constants.INPUT_JAVA_VERSION, {required: true});
}
const arch = core.getInput(constants.INPUT_ARCHITECTURE, {required: true});
if (!['x86', 'x64'].includes(arch)) {
throw new Error(`architecture "${arch}" is not in [x86 | x64]`);
}
const javaPackage = core.getInput(constants.INPUT_JAVA_PACKAGE, {
required: true
});