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 53 additions and 41 deletions

1
.envrc
View file

@ -1 +0,0 @@
use nix

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)

View file

@ -1,8 +0,0 @@
{ pkgs ? import (fetchTarball "channel:nixos-23.05") {} }:
pkgs.mkShell {
buildInputs = [
pkgs.nodejs
];
}

28
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.3.0", "version": "1.4.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.8.2", "@actions/core": "^1.8.2",
@ -433,9 +433,9 @@
} }
}, },
"node_modules/@types/istanbul-lib-coverage": { "node_modules/@types/istanbul-lib-coverage": {
"version": "2.0.4", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz",
"integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", "integrity": "sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==",
"dev": true "dev": true
}, },
"node_modules/@types/json-schema": { "node_modules/@types/json-schema": {
@ -4875,9 +4875,9 @@
} }
}, },
"node_modules/v8-to-istanbul/node_modules/@jridgewell/trace-mapping": { "node_modules/v8-to-istanbul/node_modules/@jridgewell/trace-mapping": {
"version": "0.3.19", "version": "0.3.20",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz",
"integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/resolve-uri": "^3.1.0",
@ -5445,9 +5445,9 @@
} }
}, },
"@types/istanbul-lib-coverage": { "@types/istanbul-lib-coverage": {
"version": "2.0.4", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz",
"integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", "integrity": "sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==",
"dev": true "dev": true
}, },
"@types/json-schema": { "@types/json-schema": {
@ -8556,9 +8556,9 @@
}, },
"dependencies": { "dependencies": {
"@jridgewell/trace-mapping": { "@jridgewell/trace-mapping": {
"version": "0.3.19", "version": "0.3.20",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz",
"integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/resolve-uri": "^3.1.0",

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": {

View file

@ -2,10 +2,10 @@
* Houses the pertinent data that GitHub exposes for each Nextflow release * Houses the pertinent data that GitHub exposes for each Nextflow release
*/ */
export type NextflowRelease = { export type NextflowRelease = {
versionNumber: string; versionNumber: string
isEdge: boolean; isEdge: boolean
binaryURL: string; binaryURL: string
allBinaryURL: string; allBinaryURL: string
} }
/** /**

View file

@ -43,3 +43,20 @@ export async function all_nf_release_data(
response => response.data 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

@ -25,13 +25,11 @@ function tag_filter(version: string): (NextflowRelease) => Boolean {
filter = (r: NextflowRelease) => { filter = (r: NextflowRelease) => {
return r.versionNumber.endsWith("-edge") return r.versionNumber.endsWith("-edge")
} }
} else { } else {
filter = (r: NextflowRelease) => { filter = (r: NextflowRelease) => {
return !r.isEdge return !r.isEdge
} }
} }
} }
return filter return filter
} }
@ -41,7 +39,7 @@ export async function get_nextflow_release(
releases: Array<NextflowRelease> releases: Array<NextflowRelease>
): Promise<NextflowRelease> { ): Promise<NextflowRelease> {
// Filter the releases // Filter the releases
const filter = tag_filter(version); const filter = tag_filter(version)
const matching_releases = releases.filter(filter) const matching_releases = releases.filter(filter)
matching_releases.sort((x, y) => { matching_releases.sort((x, y) => {

View file

@ -34,8 +34,8 @@ async function run(): Promise<void> {
const releases = await pull_releases(octokit) const releases = await pull_releases(octokit)
// Get the release info for the desired release // Get the release info for the desired release
let release = {} as NextflowRelease; let release = {} as NextflowRelease
let resolved_version = ""; let resolved_version = ""
try { try {
release = await get_nextflow_release(version, releases) release = await get_nextflow_release(version, releases)
resolved_version = release.versionNumber resolved_version = release.versionNumber
@ -50,7 +50,6 @@ async function run(): Promise<void> {
} }
} }
// Get the download url for the desired release
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)) {
@ -77,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}`)
)
} }
} }
} }