Compare commits

..

2 commits

Author SHA1 Message Date
95fbb48328
wip: more work 2023-10-25 22:23:47 -05:00
5d5c2bcdc0
wip: Closer to MVC model 2023-09-26 17:25:10 -05:00
11 changed files with 41 additions and 53 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use nix

View file

@ -26,6 +26,3 @@ 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,12 +7,9 @@ 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
@ -58,8 +55,7 @@ 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.4.0...HEAD [unreleased]: https://github.com/nf-core/setup-nextflow/compare/v1.3.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,7 +1,6 @@
# ![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)

8
default.nix Normal file
View file

@ -0,0 +1,8 @@
{ 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.4.0", "version": "1.3.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "install-nextflow-action", "name": "install-nextflow-action",
"version": "1.4.0", "version": "1.3.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.5", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz",
"integrity": "sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==", "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==",
"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.20", "version": "0.3.19",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz",
"integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==",
"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.5", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz",
"integrity": "sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==", "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==",
"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.20", "version": "0.3.19",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz",
"integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==",
"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.4.0", "version": "1.3.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

@ -9,9 +9,9 @@ const NEXTFLOW_REPO = { owner: "nextflow-io", repo: "nextflow" }
export async function setup_octokit( export async function setup_octokit(
github_token: string github_token: string
): Promise<InstanceType<typeof GitHub>> { ): Promise<InstanceType<typeof GitHub>> {
let octokit = {} as InstanceType<typeof GitHub> let octokit = {} as InstanceType<typeof GitHub>
try { try {
octokit = github.getOctokit(github_token) octokit = github.getOctokit(github_token)
} catch (e: unknown) { } catch (e: unknown) {
if (e instanceof Error) { if (e instanceof Error) {
core.setFailed( core.setFailed(
@ -19,7 +19,7 @@ export async function setup_octokit(
) )
} }
} }
return octokit return octokit
} }
export async function pull_releases( export async function pull_releases(
@ -43,20 +43,3 @@ 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,11 +25,13 @@ 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
} }
@ -39,7 +41,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,6 +50,7 @@ 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)) {
@ -76,8 +77,9 @@ 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) {
// fail workflow if Nextflow run does not succeed core.warning(
core.setFailed(`Could not run 'nextflow help'. Error: ${e.message}`) "Nextflow appears to have installed correctly, but an error was thrown while running it."
)
} }
} }
} }