Compare commits

...

21 commits

Author SHA1 Message Date
2920d35b27
test: Update version checking tests 2023-12-23 13:16:43 -07:00
a0c983c7c0
test: Update API consistency tests 2023-12-23 13:16:42 -07:00
ad13909a9c
refactor: Update main script to use NextflowRelease objects 2023-12-23 13:16:41 -07:00
91a673d1c0
refactor: Outsource API calls to OctokitWrapper 2023-12-23 13:16:39 -07:00
9c201e4232
docs: Clarify why CAPSULE_LOG is set 2023-12-23 13:16:38 -07:00
063c2b071a
refactor: Add and remove imports from main script 2023-12-23 13:16:38 -07:00
f6ca4d60bb
refactor: Make install_nextflow work using NextflowRelease objects 2023-12-23 13:16:37 -07:00
5d8e8fd6f5
refactor: Make get_nextflow_release work using NextflowRelease objects 2023-12-23 13:16:36 -07:00
0b5ecde5fa
refactor: Make tag filtering work on NextflowRelease objects 2023-12-23 13:16:34 -07:00
18999426ee
refactor!: Move all Octokit code to own file
Separation of concerns. We want to completely separate the internals of
Octokit from this application, so move any reference/call to Octokit into
its own file to symbolize that.
2023-12-23 13:16:32 -07:00
d45224364c
feat: Add nextflow_release function
WIth the goal being to convert Octokit data into NextflowRelease objects,
create a function that can do that in one line.
2023-12-23 13:16:30 -07:00
c7120cfa01
refactor: Move nextflow_bin_url function to NextflowRelease.ts
Nextflow binary URLs should be stored in the new NextflowRelease object, so
it should essentially be private for the NextflowRelease type. Move the
function to that file to signify that (but retain export for testing
purposes).
2023-12-23 13:16:29 -07:00
4b078199d1
feat: Add NextflowRelease type 2023-12-23 13:16:28 -07:00
d736e9561d docs: Add codecov badge to README 2023-10-31 01:42:06 +00:00
71753bca1d feat: Add codecov action to test workflow 2023-10-31 01:42:06 +00:00
4499488e7d feat: Add coverage reporting to test protocol 2023-10-31 01:42:06 +00:00
1f1a43fb20 chore: Add c8 to dev dependencies 2023-10-31 01:42:06 +00:00
99243fb566 chore: Bump version number in package files 2023-10-26 02:45:41 +00:00
b9b7d187dd chore: Update CHANGELOG for v1.4.0 2023-10-26 02:45:41 +00:00
Edmund Miller
441990da28
Merge pull request #23 from mashehu/break-on-error
Fail instead of warn, when `nextflow help` doesn't work
2023-10-11 13:36:11 -05:00
mashehu
7e43c4af0e
Fail instead of warn, when nextflow help doesn't work 2023-10-11 16:29:12 +02:00
11 changed files with 589 additions and 157 deletions

View file

@ -26,3 +26,6 @@ jobs:
- run: npm run test - run: npm run test
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View file

@ -7,9 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [1.4.0] - 2023-08-12
## Changed ## Changed
- If `fs.renameSync` fails (e.g. because source and destination files are on different partitions), try `fs.copySync` and `fs.unlinkSync` instead (#14). - If `fs.renameSync` fails (e.g. because source and destination files are on different partitions), try `fs.copySync` and `fs.unlinkSync` instead (#14).
- Fail instead of warn, when `nextflow help`` doesn't work (#23).
## Fixed ## Fixed
@ -55,7 +58,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- GitHub Actions workflow to test Nextflow installation and downstream usage - GitHub Actions workflow to test Nextflow installation and downstream usage
- Documentation and license files - Documentation and license files
[unreleased]: https://github.com/nf-core/setup-nextflow/compare/v1.3.0...HEAD [unreleased]: https://github.com/nf-core/setup-nextflow/compare/v1.4.0...HEAD
[1.4.0]: https://github.com/nf-core/setup-nextflow/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/nf-core/setup-nextflow/compare/v1.2.0...v1.3.0 [1.3.0]: https://github.com/nf-core/setup-nextflow/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/nf-core/setup-nextflow/compare/v1.1.1...v1.2.0 [1.2.0]: https://github.com/nf-core/setup-nextflow/compare/v1.1.1...v1.2.0
[1.1.0]: https://github.com/nf-core/setup-nextflow/compare/v1.0.1...v1.1.0 [1.1.0]: https://github.com/nf-core/setup-nextflow/compare/v1.0.1...v1.1.0

View file

@ -1,6 +1,7 @@
# ![nf-core/setup-nextflow](docs/images/nfcore-setupnextflow_logo.png#gh-light-mode-only) ![nf-core/setup-nextflow](docs/images/nfcore-setupnextflow_logo_dark.png#gh-dark-mode-only) # ![nf-core/setup-nextflow](docs/images/nfcore-setupnextflow_logo.png#gh-light-mode-only) ![nf-core/setup-nextflow](docs/images/nfcore-setupnextflow_logo_dark.png#gh-dark-mode-only)
[![Testing](https://github.com/nf-core/setup-nextflow/actions/workflows/example.yml/badge.svg)](https://github.com/nf-core/setup-nextflow/actions/workflows/example.yml) [![Testing](https://github.com/nf-core/setup-nextflow/actions/workflows/example.yml/badge.svg)](https://github.com/nf-core/setup-nextflow/actions/workflows/example.yml)
[![codecov](https://codecov.io/gh/nf-core/setup-nextflow/branch/master/graph/badge.svg)](https://codecov.io/gh/nf-core/setup-nextflow)
[![MIT License](https://img.shields.io/github/license/nf-core/setup-nextflow?logo=opensourceinitiative)](https://github.com/nf-core/setup-nextflow/blob/master/LICENSE) [![MIT License](https://img.shields.io/github/license/nf-core/setup-nextflow?logo=opensourceinitiative)](https://github.com/nf-core/setup-nextflow/blob/master/LICENSE)
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/nf-core/setup-nextflow?logo=github)](https://github.com/nf-core/setup-nextflow/releases/latest) [![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/nf-core/setup-nextflow?logo=github)](https://github.com/nf-core/setup-nextflow/releases/latest)
[![Get from GitHub Actions](https://img.shields.io/static/v1?label=actions&message=marketplace&color=green&logo=githubactions)](https://github.com/marketplace/actions/setup-nextflow) [![Get from GitHub Actions](https://img.shields.io/static/v1?label=actions&message=marketplace&color=green&logo=githubactions)](https://github.com/marketplace/actions/setup-nextflow)

320
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "install-nextflow-action", "name": "install-nextflow-action",
"version": "1.3.0", "version": "1.4.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "install-nextflow-action", "name": "install-nextflow-action",
"version": "1.2.0", "version": "1.4.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.8.2", "@actions/core": "^1.8.2",
@ -26,6 +26,7 @@
"@typescript-eslint/parser": "^5.42.1", "@typescript-eslint/parser": "^5.42.1",
"@vercel/ncc": "^0.34.0", "@vercel/ncc": "^0.34.0",
"ava": "^5.0.1", "ava": "^5.0.1",
"c8": "^8.0.1",
"eslint": "^8.27.0", "eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-ava": "^13.2.0", "eslint-plugin-ava": "^13.2.0",
@ -148,6 +149,12 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@bcoe/v8-coverage": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz",
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
"node_modules/@cspotcode/source-map-support": { "node_modules/@cspotcode/source-map-support": {
"version": "0.8.1", "version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
@ -222,6 +229,15 @@
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
"dev": true "dev": true
}, },
"node_modules/@istanbuljs/schema": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",
"integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/@jridgewell/resolve-uri": { "node_modules/@jridgewell/resolve-uri": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
@ -416,6 +432,12 @@
"@types/retry": "*" "@types/retry": "*"
} }
}, },
"node_modules/@types/istanbul-lib-coverage": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz",
"integrity": "sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==",
"dev": true
},
"node_modules/@types/json-schema": { "node_modules/@types/json-schema": {
"version": "7.0.11", "version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
@ -1136,6 +1158,32 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
} }
}, },
"node_modules/c8": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/c8/-/c8-8.0.1.tgz",
"integrity": "sha512-EINpopxZNH1mETuI0DzRA4MZpAUH+IFiRhnmFD3vFr3vdrgxqi3VfE3KL0AIL+zDq8rC9bZqwM/VDmmoe04y7w==",
"dev": true,
"dependencies": {
"@bcoe/v8-coverage": "^0.2.3",
"@istanbuljs/schema": "^0.1.3",
"find-up": "^5.0.0",
"foreground-child": "^2.0.0",
"istanbul-lib-coverage": "^3.2.0",
"istanbul-lib-report": "^3.0.1",
"istanbul-reports": "^3.1.6",
"rimraf": "^3.0.2",
"test-exclude": "^6.0.0",
"v8-to-istanbul": "^9.0.0",
"yargs": "^17.7.2",
"yargs-parser": "^21.1.1"
},
"bin": {
"c8": "bin/c8.js"
},
"engines": {
"node": ">=12"
}
},
"node_modules/call-bind": { "node_modules/call-bind": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
@ -1415,6 +1463,12 @@
"node": ">=10.18.0 <11 || >=12.14.0 <13 || >=14" "node": ">=10.18.0 <11 || >=12.14.0 <13 || >=14"
} }
}, },
"node_modules/convert-source-map": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
"dev": true
},
"node_modules/convert-to-spaces": { "node_modules/convert-to-spaces": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/convert-to-spaces/-/convert-to-spaces-2.0.1.tgz", "resolved": "https://registry.npmjs.org/convert-to-spaces/-/convert-to-spaces-2.0.1.tgz",
@ -2452,6 +2506,19 @@
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==",
"dev": true "dev": true
}, },
"node_modules/foreground-child": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz",
"integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==",
"dev": true,
"dependencies": {
"cross-spawn": "^7.0.0",
"signal-exit": "^3.0.2"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/fs.realpath": { "node_modules/fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -2704,6 +2771,12 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/html-escaper": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
"dev": true
},
"node_modules/human-signals": { "node_modules/human-signals": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
@ -3108,6 +3181,42 @@
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true "dev": true
}, },
"node_modules/istanbul-lib-coverage": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz",
"integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/istanbul-lib-report": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz",
"integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==",
"dev": true,
"dependencies": {
"istanbul-lib-coverage": "^3.0.0",
"make-dir": "^4.0.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/istanbul-reports": {
"version": "3.1.6",
"resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz",
"integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==",
"dev": true,
"dependencies": {
"html-escaper": "^2.0.0",
"istanbul-lib-report": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/js-sdsl": { "node_modules/js-sdsl": {
"version": "4.1.5", "version": "4.1.5",
"resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz",
@ -3274,6 +3383,21 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/make-dir": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz",
"integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==",
"dev": true,
"dependencies": {
"semver": "^7.5.3"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/make-error": { "node_modules/make-error": {
"version": "1.3.6", "version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
@ -4133,9 +4257,9 @@
} }
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "7.3.7", "version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dependencies": { "dependencies": {
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
}, },
@ -4499,6 +4623,20 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/test-exclude": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",
"integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==",
"dev": true,
"dependencies": {
"@istanbuljs/schema": "^0.1.2",
"glob": "^7.1.4",
"minimatch": "^3.0.4"
},
"engines": {
"node": ">=8"
}
},
"node_modules/text-table": { "node_modules/text-table": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@ -4722,6 +4860,30 @@
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
"dev": true "dev": true
}, },
"node_modules/v8-to-istanbul": {
"version": "9.1.3",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.3.tgz",
"integrity": "sha512-9lDD+EVI2fjFsMWXc6dy5JJzBsVTcQ2fVkfBvncZ6xJWG9wtBhOldG+mHkSL0+V1K/xgZz0JDO5UT5hFwHUghg==",
"dev": true,
"dependencies": {
"@jridgewell/trace-mapping": "^0.3.12",
"@types/istanbul-lib-coverage": "^2.0.1",
"convert-source-map": "^2.0.0"
},
"engines": {
"node": ">=10.12.0"
}
},
"node_modules/v8-to-istanbul/node_modules/@jridgewell/trace-mapping": {
"version": "0.3.20",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz",
"integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==",
"dev": true,
"dependencies": {
"@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/webidl-conversions": { "node_modules/webidl-conversions": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
@ -4864,9 +5026,9 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}, },
"node_modules/yargs": { "node_modules/yargs": {
"version": "17.6.2", "version": "17.7.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
"integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"cliui": "^8.0.1", "cliui": "^8.0.1",
@ -5039,6 +5201,12 @@
"regenerator-runtime": "^0.13.10" "regenerator-runtime": "^0.13.10"
} }
}, },
"@bcoe/v8-coverage": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz",
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
"@cspotcode/source-map-support": { "@cspotcode/source-map-support": {
"version": "0.8.1", "version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
@ -5094,6 +5262,12 @@
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
"dev": true "dev": true
}, },
"@istanbuljs/schema": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",
"integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==",
"dev": true
},
"@jridgewell/resolve-uri": { "@jridgewell/resolve-uri": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
@ -5270,6 +5444,12 @@
"@types/retry": "*" "@types/retry": "*"
} }
}, },
"@types/istanbul-lib-coverage": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz",
"integrity": "sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==",
"dev": true
},
"@types/json-schema": { "@types/json-schema": {
"version": "7.0.11", "version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
@ -5754,6 +5934,26 @@
"update-browserslist-db": "^1.0.9" "update-browserslist-db": "^1.0.9"
} }
}, },
"c8": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/c8/-/c8-8.0.1.tgz",
"integrity": "sha512-EINpopxZNH1mETuI0DzRA4MZpAUH+IFiRhnmFD3vFr3vdrgxqi3VfE3KL0AIL+zDq8rC9bZqwM/VDmmoe04y7w==",
"dev": true,
"requires": {
"@bcoe/v8-coverage": "^0.2.3",
"@istanbuljs/schema": "^0.1.3",
"find-up": "^5.0.0",
"foreground-child": "^2.0.0",
"istanbul-lib-coverage": "^3.2.0",
"istanbul-lib-report": "^3.0.1",
"istanbul-reports": "^3.1.6",
"rimraf": "^3.0.2",
"test-exclude": "^6.0.0",
"v8-to-istanbul": "^9.0.0",
"yargs": "^17.7.2",
"yargs-parser": "^21.1.1"
}
},
"call-bind": { "call-bind": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
@ -5961,6 +6161,12 @@
"well-known-symbols": "^2.0.0" "well-known-symbols": "^2.0.0"
} }
}, },
"convert-source-map": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
"dev": true
},
"convert-to-spaces": { "convert-to-spaces": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/convert-to-spaces/-/convert-to-spaces-2.0.1.tgz", "resolved": "https://registry.npmjs.org/convert-to-spaces/-/convert-to-spaces-2.0.1.tgz",
@ -6732,6 +6938,16 @@
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==",
"dev": true "dev": true
}, },
"foreground-child": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz",
"integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==",
"dev": true,
"requires": {
"cross-spawn": "^7.0.0",
"signal-exit": "^3.0.2"
}
},
"fs.realpath": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -6905,6 +7121,12 @@
"has-symbols": "^1.0.2" "has-symbols": "^1.0.2"
} }
}, },
"html-escaper": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
"dev": true
},
"human-signals": { "human-signals": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
@ -7171,6 +7393,33 @@
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true "dev": true
}, },
"istanbul-lib-coverage": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz",
"integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==",
"dev": true
},
"istanbul-lib-report": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz",
"integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==",
"dev": true,
"requires": {
"istanbul-lib-coverage": "^3.0.0",
"make-dir": "^4.0.0",
"supports-color": "^7.1.0"
}
},
"istanbul-reports": {
"version": "3.1.6",
"resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz",
"integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==",
"dev": true,
"requires": {
"html-escaper": "^2.0.0",
"istanbul-lib-report": "^3.0.0"
}
},
"js-sdsl": { "js-sdsl": {
"version": "4.1.5", "version": "4.1.5",
"resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz",
@ -7307,6 +7556,15 @@
"yallist": "^4.0.0" "yallist": "^4.0.0"
} }
}, },
"make-dir": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz",
"integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==",
"dev": true,
"requires": {
"semver": "^7.5.3"
}
},
"make-error": { "make-error": {
"version": "1.3.6", "version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
@ -7873,9 +8131,9 @@
} }
}, },
"semver": { "semver": {
"version": "7.3.7", "version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"requires": { "requires": {
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
} }
@ -8128,6 +8386,17 @@
"integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==", "integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==",
"dev": true "dev": true
}, },
"test-exclude": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",
"integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==",
"dev": true,
"requires": {
"@istanbuljs/schema": "^0.1.2",
"glob": "^7.1.4",
"minimatch": "^3.0.4"
}
},
"text-table": { "text-table": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@ -8275,6 +8544,29 @@
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
"dev": true "dev": true
}, },
"v8-to-istanbul": {
"version": "9.1.3",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.3.tgz",
"integrity": "sha512-9lDD+EVI2fjFsMWXc6dy5JJzBsVTcQ2fVkfBvncZ6xJWG9wtBhOldG+mHkSL0+V1K/xgZz0JDO5UT5hFwHUghg==",
"dev": true,
"requires": {
"@jridgewell/trace-mapping": "^0.3.12",
"@types/istanbul-lib-coverage": "^2.0.1",
"convert-source-map": "^2.0.0"
},
"dependencies": {
"@jridgewell/trace-mapping": {
"version": "0.3.20",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz",
"integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==",
"dev": true,
"requires": {
"@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "^1.4.14"
}
}
}
},
"webidl-conversions": { "webidl-conversions": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
@ -8386,9 +8678,9 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}, },
"yargs": { "yargs": {
"version": "17.6.2", "version": "17.7.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
"integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
"dev": true, "dev": true,
"requires": { "requires": {
"cliui": "^8.0.1", "cliui": "^8.0.1",

View file

@ -1,6 +1,6 @@
{ {
"name": "install-nextflow-action", "name": "install-nextflow-action",
"version": "1.3.0", "version": "1.4.0",
"description": "An action to install Nextflow into a GitHub Actions workflow and make it available for subsequent steps.", "description": "An action to install Nextflow into a GitHub Actions workflow and make it available for subsequent steps.",
"main": "lib/src/main.js", "main": "lib/src/main.js",
"scripts": { "scripts": {
@ -10,7 +10,7 @@
"lint": "eslint {src,test}/**/*.ts", "lint": "eslint {src,test}/**/*.ts",
"lint:fix": "eslint --fix {src,test}/**/*.ts", "lint:fix": "eslint --fix {src,test}/**/*.ts",
"package": "ncc build --source-map --license LICENSE", "package": "ncc build --source-map --license LICENSE",
"test": "ava", "test": "c8 --reporter=lcov ava",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test" "all": "npm run build && npm run format && npm run lint && npm run package && npm test"
}, },
"repository": { "repository": {
@ -63,6 +63,7 @@
"@typescript-eslint/parser": "^5.42.1", "@typescript-eslint/parser": "^5.42.1",
"@vercel/ncc": "^0.34.0", "@vercel/ncc": "^0.34.0",
"ava": "^5.0.1", "ava": "^5.0.1",
"c8": "^8.0.1",
"eslint": "^8.27.0", "eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-ava": "^13.2.0", "eslint-plugin-ava": "^13.2.0",

44
src/NextflowRelease.ts Normal file
View file

@ -0,0 +1,44 @@
/**
* Houses the pertinent data that GitHub exposes for each Nextflow release
*/
export type NextflowRelease = {
versionNumber: string
isEdge: boolean
binaryURL: string
allBinaryURL: string
}
/**
* Converts the raw OctoKit data into a structured NextflowRelease
* @param data A "release" data struct from OctoKit
* @returns `data` converted into a `NextflowRelease`
*/
export function nextflow_release(data: object) {
const nf_release: NextflowRelease = {
versionNumber: data["tag_name"],
isEdge: data["prerelease"],
binaryURL: nextflow_bin_url(data, false),
allBinaryURL: nextflow_bin_url(data, true)
}
return nf_release
}
/**
* Gets the download URL of a Nextflow binary
* @param release A "release" data struct from OctoKit
* @param get_all Whether to return the url for the "all" variant of Nextflow
* @returns The URL of the Nextflow binary
*/
export function nextflow_bin_url(release: object, get_all: boolean): string {
const release_assets = release["assets"]
const all_asset = release_assets.filter((a: object) => {
return a["browser_download_url"].endsWith("-all")
})[0]
const regular_asset = release_assets.filter((a: object) => {
return a["name"] === "nextflow"
})[0]
const dl_asset = get_all ? all_asset : regular_asset
return dl_asset.browser_download_url
}

62
src/OctokitWrapper.ts Normal file
View file

@ -0,0 +1,62 @@
import { GitHub } from "@actions/github/lib/utils"
import * as github from "@actions/github"
import * as core from "@actions/core"
import { NextflowRelease, nextflow_release } from "./NextflowRelease"
const NEXTFLOW_REPO = { owner: "nextflow-io", repo: "nextflow" }
export async function setup_octokit(
github_token: string
): Promise<InstanceType<typeof GitHub>> {
let octokit = {} as InstanceType<typeof GitHub>
try {
octokit = github.getOctokit(github_token)
} catch (e: unknown) {
if (e instanceof Error) {
core.setFailed(
`Could not authenticate to GitHub Releases API with provided token\n${e.message}`
)
}
}
return octokit
}
export async function pull_releases(
octokit: InstanceType<typeof GitHub>
): Promise<Array<NextflowRelease>> {
const all_release_data: object[] = await all_nf_release_data(octokit)
var all_releases: NextflowRelease[] = []
all_release_data.forEach(data => {
all_releases.push(nextflow_release(data))
})
return all_releases
}
export async function all_nf_release_data(
ok: InstanceType<typeof GitHub>
): Promise<object[]> {
return await ok.paginate(
ok.rest.repos.listReleases,
NEXTFLOW_REPO,
response => response.data
)
}
export async function latest_stable_release_data(
ok: InstanceType<typeof GitHub>
): Promise<object> {
const { data: stable_release } = await ok.rest.repos.getLatestRelease(
NEXTFLOW_REPO
)
return stable_release
}
export async function pull_latest_stable_release(
ok: InstanceType<typeof GitHub>
): Promise<NextflowRelease> {
const latest_release = await latest_stable_release_data(ok)
return nextflow_release(latest_release)
}

View file

@ -1,41 +1,15 @@
import * as core from "@actions/core" import * as core from "@actions/core"
import { GitHub } from "@actions/github/lib/utils"
import * as tc from "@actions/tool-cache" import * as tc from "@actions/tool-cache"
import retry from "async-retry" import retry from "async-retry"
import * as fs from "fs" import * as fs from "fs"
import semver from "semver" import semver from "semver"
const NEXTFLOW_REPO = { owner: "nextflow-io", repo: "nextflow" } import { NextflowRelease } from "./NextflowRelease"
// HACK Private but I want to test this function tag_filter(version: string): (NextflowRelease) => Boolean {
export async function all_nf_releases(
ok: InstanceType<typeof GitHub>
): Promise<object[]> {
return await ok.paginate(
ok.rest.repos.listReleases,
NEXTFLOW_REPO,
response => response.data
)
}
// HACK Private but I want to test this
export async function latest_stable_release_data(
ok: InstanceType<typeof GitHub>
): Promise<object> {
const { data: stable_release } = await ok.rest.repos.getLatestRelease(
NEXTFLOW_REPO
)
return stable_release
}
export async function release_data(
version: string,
ok: InstanceType<typeof GitHub>
): Promise<object> {
// Setup tag-based filtering // Setup tag-based filtering
let filter = (r: object): boolean => { let filter = (r: NextflowRelease): boolean => {
return semver.satisfies(r["tag_name"], version, true) return semver.satisfies(r.versionNumber, version, true)
} }
// Check if the user passed a 'latest*' tag, and override filtering // Check if the user passed a 'latest*' tag, and override filtering
@ -44,52 +18,45 @@ export async function release_data(
if (version.includes("-everything")) { if (version.includes("-everything")) {
// No filtering // No filtering
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
filter = (r: object) => { filter = (r: NextflowRelease) => {
return true return true
} }
} else if (version.includes("-edge")) { } else if (version.includes("-edge")) {
filter = r => { filter = (r: NextflowRelease) => {
return r["tag_name"].endsWith("-edge") return r.versionNumber.endsWith("-edge")
} }
} else { } else {
// This is special: passing 'latest' or 'latest-stable' allows us to use filter = (r: NextflowRelease) => {
// the latest stable GitHub release direct from the API return !r.isEdge
const stable_release = await latest_stable_release_data(ok)
return stable_release
} }
} }
}
return filter
}
// Get all the releases export async function get_nextflow_release(
const all_releases: object[] = await all_nf_releases(ok) version: string,
releases: Array<NextflowRelease>
const matching_releases = all_releases.filter(filter) ): Promise<NextflowRelease> {
// Filter the releases
const filter = tag_filter(version)
const matching_releases = releases.filter(filter)
matching_releases.sort((x, y) => { matching_releases.sort((x, y) => {
// HACK IDK why the value flip is necessary with the return // HACK IDK why the value flip is necessary with the return
return semver.compare(x["tag_name"], y["tag_name"], true) * -1 return semver.compare(x.versionNumber, y.versionNumber, true) * -1
}) })
return matching_releases[0] return matching_releases[0]
} }
export function nextflow_bin_url(release: object, get_all: boolean): string {
const release_assets = release["assets"]
const all_asset = release_assets.filter((a: object) => {
return a["browser_download_url"].endsWith("-all")
})[0]
const regular_asset = release_assets.filter((a: object) => {
return a["name"] === "nextflow"
})[0]
const dl_asset = get_all ? all_asset : regular_asset
return dl_asset.browser_download_url
}
export async function install_nextflow( export async function install_nextflow(
url: string, release: NextflowRelease,
version: string get_all: boolean
): Promise<string> { ): Promise<string> {
const url = get_all ? release.allBinaryURL : release.binaryURL
const version = release.versionNumber
core.debug(`Downloading Nextflow from ${url}`) core.debug(`Downloading Nextflow from ${url}`)
const nf_dl_path = await retry( const nf_dl_path = await retry(
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars

View file

@ -1,7 +1,5 @@
import * as core from "@actions/core" import * as core from "@actions/core"
import * as exec from "@actions/exec" import * as exec from "@actions/exec"
import * as github from "@actions/github"
import { GitHub } from "@actions/github/lib/utils"
import * as tc from "@actions/tool-cache" import * as tc from "@actions/tool-cache"
import * as fs from "fs" import * as fs from "fs"
import semver from "semver" import semver from "semver"
@ -9,12 +7,15 @@ import semver from "semver"
import { import {
check_cache, check_cache,
install_nextflow, install_nextflow,
nextflow_bin_url, get_nextflow_release
release_data
} from "./functions" } from "./functions"
import { NextflowRelease } from "./NextflowRelease"
import { pull_releases, setup_octokit } from "./OctokitWrapper"
async function run(): Promise<void> { async function run(): Promise<void> {
// Set environment variables // CAPSULE_LOG leads to a bunch of boilerplate being output to the logs: turn
// it off
core.exportVariable("CAPSULE_LOG", "none") core.exportVariable("CAPSULE_LOG", "none")
// Read in the arguments // Read in the arguments
@ -28,25 +29,16 @@ async function run(): Promise<void> {
} }
// Setup the API // Setup the API
let octokit: InstanceType<typeof GitHub> | undefined const octokit = await setup_octokit(token)
try {
octokit = github.getOctokit(token) const releases = await pull_releases(octokit)
} catch (e: unknown) {
if (e instanceof Error) {
core.setFailed(
`Could not authenticate to GitHub Releases API with provided token\n${e.message}`
)
}
}
// Get the release info for the desired release // Get the release info for the desired release
let release = {} let release = {} as NextflowRelease
let resolved_version = "" let resolved_version = ""
try { try {
if (octokit !== undefined) { release = await get_nextflow_release(version, releases)
release = await release_data(version, octokit) resolved_version = release.versionNumber
}
resolved_version = release["tag_name"]
core.info( core.info(
`Input version '${version}' resolved to Nextflow ${release["name"]}` `Input version '${version}' resolved to Nextflow ${release["name"]}`
) )
@ -58,20 +50,10 @@ async function run(): Promise<void> {
} }
} }
// Get the download url for the desired release
let url = ""
try {
url = nextflow_bin_url(release, get_all)
core.info(`Preparing to download from ${url}`)
} catch (e: unknown) {
if (e instanceof Error) {
core.setFailed(`Could not parse the download URL\n${e.message}`)
}
}
try { try {
// Download Nextflow and add it to path // Download Nextflow and add it to path
if (!check_cache(resolved_version)) { if (!check_cache(resolved_version)) {
const nf_install_path = await install_nextflow(url, resolved_version) const nf_install_path = await install_nextflow(release, get_all)
const cleaned_version = String(semver.clean(resolved_version, true)) const cleaned_version = String(semver.clean(resolved_version, true))
const nf_path = await tc.cacheDir( const nf_path = await tc.cacheDir(
nf_install_path, nf_install_path,
@ -94,9 +76,8 @@ async function run(): Promise<void> {
await exec.exec("nextflow", ["help"]) await exec.exec("nextflow", ["help"])
} catch (e: unknown) { } catch (e: unknown) {
if (e instanceof Error) { if (e instanceof Error) {
core.warning( // fail workflow if Nextflow run does not succeed
"Nextflow appears to have installed correctly, but an error was thrown while running it." core.setFailed(`Could not run 'nextflow help'. Error: ${e.message}`)
)
} }
} }
} }

View file

@ -1,37 +1,113 @@
import * as github from "@actions/github" import test from "ava" // eslint-disable-line import/no-unresolved
import { GitHub } from "@actions/github/lib/utils"
import anyTest, { TestFn } from "ava" // eslint-disable-line import/no-unresolved
import * as functions from "../src/functions" import * as functions from "../src/functions"
import { getReleaseTag, getToken } from "./utils" import { NextflowRelease } from "../src/NextflowRelease"
const test = anyTest as TestFn<{ // The Nextflow releases we are going to use for testing follow a regular
token: string // pattern: create a mock function to bootstrap some test data without repeating
octokit: InstanceType<typeof GitHub> // ourselves
}> function nf_release_gen(version_number: string): NextflowRelease {
const is_edge = version_number.endsWith("-edge")
test.before(t => { const release: NextflowRelease = {
const first = true versionNumber: version_number,
const current_token = getToken(first) isEdge: is_edge,
t.context = { binaryURL: `https://github.com/nextflow-io/nextflow/releases/download/${version_number}/nextflow`,
token: current_token, allBinaryURL: `https://github.com/nextflow-io/nextflow/releases/download/${version_number}/nextflow-${version_number.replace(
octokit: github.getOctokit(current_token) "v",
""
)}-all`
} }
}) return release
}
test("all_nf_releases", async t => { // A mock set of Nextflow releases
const result = await functions.all_nf_releases(t.context["octokit"]) const edge_is_newer = [
t.is(typeof result, "object") nf_release_gen("v23.09.1-edge"),
}) nf_release_gen("v23.04.3"),
nf_release_gen("v23.04.2")
]
const edge_is_older = [
nf_release_gen("v23.04.3"),
nf_release_gen("v23.04.2"),
nf_release_gen("v23.03.0-edge")
]
test("lastest_stable_release_data", async t => { /*
const result = await functions.latest_stable_release_data( The whole reason this action exists is to handle the cases where a final
t.context["octokit"] release is the "bleeding edge" release, rather than the "edge" release, even
though that's what the name would imply. Therefore, we need to test that the
'latest-everything' parameter can find the correct one regardless of whether
an "edge" release or a stable release is the true latest
*/
const release_filter_macro = test.macro(
async (
t,
input_version: string,
expected_version: string,
releases: Array<NextflowRelease>
) => {
const matched_release = await functions.get_nextflow_release(
input_version,
releases
) )
t.is(typeof result, "object") t.is(matched_release.versionNumber, expected_version)
const expected = await getReleaseTag("nextflow-io/nextflow", false) }
t.is(result["tag_name"], expected) )
}) test(
"Latest-everything install with newer edge release",
release_filter_macro,
"latest-everything",
"v23.09.1-edge",
edge_is_newer
)
test(
"Latest-everything install with older edge release",
release_filter_macro,
"latest-everything",
"v23.04.3",
edge_is_older
)
test(
"Latest-edge install with newer edge release",
release_filter_macro,
"latest-edge",
"v23.09.1-edge",
edge_is_newer
)
test(
"Latest-edge install with older edge release",
release_filter_macro,
"latest-edge",
"v23.03.0-edge",
edge_is_older
)
test(
"Latest-stable install with newer edge release",
release_filter_macro,
"latest",
"v23.04.3",
edge_is_newer
)
test(
"Latest-stable install with older edge release",
release_filter_macro,
"latest",
"v23.04.3",
edge_is_older
)
test(
"Fully versioned tag release",
release_filter_macro,
"v23.04.2",
"v23.04.2",
edge_is_newer
)
test(
"Partially versioned tag release",
release_filter_macro,
"v23.04",
"v23.04.3",
edge_is_newer
)
test.todo("nextflow_bin_url")
test.todo("install_nextflow") test.todo("install_nextflow")

View file

@ -2,8 +2,9 @@ import * as github from "@actions/github"
import { GitHub } from "@actions/github/lib/utils" import { GitHub } from "@actions/github/lib/utils"
import anyTest, { TestFn } from "ava" // eslint-disable-line import/no-unresolved import anyTest, { TestFn } from "ava" // eslint-disable-line import/no-unresolved
import { release_data } from "../src/functions" import { getToken } from "./utils"
import { getReleaseTag, getToken } from "./utils" import { all_nf_release_data } from "../src/OctokitWrapper"
import { nextflow_bin_url } from "../src/NextflowRelease"
const test = anyTest as TestFn<{ const test = anyTest as TestFn<{
token: string token: string
@ -19,22 +20,22 @@ test.before(t => {
} }
}) })
const macro = test.macro(async (t, version: string) => { const exists_macro = test.macro(async (t, object_name: string) => {
let expected const all_releases = await all_nf_release_data(t.context.octokit)
if (version === "latest-stable") { const first_release = all_releases[0]
expected = await getReleaseTag("nextflow-io/nextflow", false) t.assert(first_release.hasOwnProperty(object_name))
} else if (version === "latest-edge") {
expected = await getReleaseTag("nextflow-io/nextflow", true)
} else if (version === "latest-everything") {
expected = await getReleaseTag("nextflow-io/nextflow", undefined)
} else {
expected = version
}
const result = await release_data(version, t.context["octokit"])
t.is(result["tag_name"], expected)
}) })
test("hard version", macro, "v22.10.2") test("OctoKit returns tag", exists_macro, "tag_name")
test("latest-stable", macro, "latest-stable") test("Octokit returns prerelease", exists_macro, "prerelease")
test("latest-edge", macro, "latest-edge") test("Octokit returns assets", exists_macro, "assets")
test("latest-everything", macro, "latest-everything")
const binary_url_macro = test.macro(async (t, get_all: boolean) => {
const all_releases = await all_nf_release_data(t.context.octokit)
const first_release = all_releases[0]
const url = nextflow_bin_url(first_release, get_all)
t.notThrows(() => new URL(url))
})
test("Nextflow binary URL valid", binary_url_macro, false)
test("Nextflow 'all' binary URL valid", binary_url_macro, true)