mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-12-21 12:28:17 +00:00
style: Use double-quotes
Co-authored-by: ewels <ewels@users.noreply.github.com>
This commit is contained in:
parent
05aef69bc1
commit
0aeab8d284
11 changed files with 92 additions and 92 deletions
16
.github/workflows/example.yml
vendored
16
.github/workflows/example.yml
vendored
|
@ -17,13 +17,13 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
nextflow_version:
|
||||
- '21.10.3'
|
||||
- '22.04'
|
||||
- '22.03.1-edge'
|
||||
- 'latest'
|
||||
- 'latest-stable'
|
||||
- 'latest-edge'
|
||||
- 'latest-everything'
|
||||
- "21.10.3"
|
||||
- "22.04"
|
||||
- "22.03.1-edge"
|
||||
- "latest"
|
||||
- "latest-stable"
|
||||
- "latest-edge"
|
||||
- "latest-everything"
|
||||
all_distribution:
|
||||
- true
|
||||
- false
|
||||
|
@ -33,7 +33,7 @@ jobs:
|
|||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
cache: 'npm'
|
||||
cache: "npm"
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm run package
|
||||
|
|
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
|||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
cache: 'npm'
|
||||
cache: "npm"
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm run package
|
||||
|
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
|||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
cache: 'npm'
|
||||
cache: "npm"
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm run format:check
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"singleQuote": false,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": true,
|
||||
"arrowParens": "avoid"
|
||||
|
|
20
action.yml
20
action.yml
|
@ -1,22 +1,22 @@
|
|||
name: 'Setup Nextflow'
|
||||
description: 'Install Nextflow and add it to the PATH'
|
||||
author: 'nf-core'
|
||||
name: "Setup Nextflow"
|
||||
description: "Install Nextflow and add it to the PATH"
|
||||
author: "nf-core"
|
||||
inputs:
|
||||
version:
|
||||
description: 'The Nextflow version to download (if necessary) and use. Example: 21.10.3'
|
||||
description: "The Nextflow version to download (if necessary) and use. Example: 21.10.3"
|
||||
required: false
|
||||
default: 'latest-stable'
|
||||
default: "latest-stable"
|
||||
all:
|
||||
description: "Whether to install every Nextflow release via the '-all' distribution."
|
||||
required: false
|
||||
default: false
|
||||
token:
|
||||
description: 'GitHub token to access the GitHub Releases API. The default token should be sufficient for all use cases.'
|
||||
description: "GitHub token to access the GitHub Releases API. The default token should be sufficient for all use cases."
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
runs:
|
||||
using: 'node16'
|
||||
main: 'dist/index.js'
|
||||
using: "node16"
|
||||
main: "dist/index.js"
|
||||
branding:
|
||||
icon: 'shuffle'
|
||||
color: 'green'
|
||||
icon: "shuffle"
|
||||
color: "green"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import * as core from '@actions/core'
|
||||
import { GitHub } from '@actions/github/lib/utils'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import retry from 'async-retry'
|
||||
import * as fs from 'fs'
|
||||
import semver from 'semver'
|
||||
import * as core from "@actions/core"
|
||||
import { GitHub } from "@actions/github/lib/utils"
|
||||
import * as tc from "@actions/tool-cache"
|
||||
import retry from "async-retry"
|
||||
import * as fs from "fs"
|
||||
import semver from "semver"
|
||||
|
||||
const NEXTFLOW_REPO = { owner: 'nextflow-io', repo: 'nextflow' }
|
||||
const NEXTFLOW_REPO = { owner: "nextflow-io", repo: "nextflow" }
|
||||
|
||||
// HACK Private but I want to test this
|
||||
export async function all_nf_releases(
|
||||
|
@ -35,21 +35,21 @@ export async function release_data(
|
|||
): Promise<object> {
|
||||
// Setup tag-based filtering
|
||||
let filter = (r: object): boolean => {
|
||||
return semver.satisfies(r['tag_name'], version, true)
|
||||
return semver.satisfies(r["tag_name"], version, true)
|
||||
}
|
||||
|
||||
// Check if the user passed a 'latest*' tag, and override filtering
|
||||
// accordingly
|
||||
if (version.includes('latest')) {
|
||||
if (version.includes('-everything')) {
|
||||
if (version.includes("latest")) {
|
||||
if (version.includes("-everything")) {
|
||||
// No filtering
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
filter = (r: object) => {
|
||||
return true
|
||||
}
|
||||
} else if (version.includes('-edge')) {
|
||||
} else if (version.includes("-edge")) {
|
||||
filter = r => {
|
||||
return r['tag_name'].endsWith('-edge')
|
||||
return r["tag_name"].endsWith("-edge")
|
||||
}
|
||||
} else {
|
||||
// This is special: passing 'latest' or 'latest-stable' allows us to use
|
||||
|
@ -66,19 +66,19 @@ export async function release_data(
|
|||
|
||||
matching_releases.sort((x, y) => {
|
||||
// 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["tag_name"], y["tag_name"], true) * -1
|
||||
})
|
||||
|
||||
return matching_releases[0]
|
||||
}
|
||||
|
||||
export function nextflow_bin_url(release: object, get_all: boolean): string {
|
||||
const release_assets = release['assets']
|
||||
const release_assets = release["assets"]
|
||||
const all_asset = release_assets.filter((a: object) => {
|
||||
return a['browser_download_url'].endsWith('-all')
|
||||
return a["browser_download_url"].endsWith("-all")
|
||||
})[0]
|
||||
const regular_asset = release_assets.filter((a: object) => {
|
||||
return a['name'] === 'nextflow'
|
||||
return a["name"] === "nextflow"
|
||||
})[0]
|
||||
|
||||
const dl_asset = get_all ? all_asset : regular_asset
|
||||
|
@ -107,7 +107,7 @@ export async function install_nextflow(
|
|||
const nf_path = `${temp_install_dir}/nextflow`
|
||||
|
||||
fs.renameSync(nf_dl_path, nf_path)
|
||||
fs.chmodSync(nf_path, '0711')
|
||||
fs.chmodSync(nf_path, "0711")
|
||||
|
||||
return temp_install_dir
|
||||
}
|
||||
|
|
40
src/main.ts
40
src/main.ts
|
@ -1,22 +1,22 @@
|
|||
import * as core from '@actions/core'
|
||||
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 fs from 'fs'
|
||||
import * as core from "@actions/core"
|
||||
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 fs from "fs"
|
||||
|
||||
import { install_nextflow, nextflow_bin_url, release_data } from './functions'
|
||||
import { install_nextflow, nextflow_bin_url, release_data } from "./functions"
|
||||
|
||||
async function run(): Promise<void> {
|
||||
// Set environment variables
|
||||
core.exportVariable('CAPSULE_LOG', 'none')
|
||||
core.exportVariable("CAPSULE_LOG", "none")
|
||||
|
||||
// Read in the arguments
|
||||
const token = core.getInput('token')
|
||||
const version = core.getInput('version')
|
||||
const get_all = core.getBooleanInput('all')
|
||||
const token = core.getInput("token")
|
||||
const version = core.getInput("version")
|
||||
const get_all = core.getBooleanInput("all")
|
||||
|
||||
let resolved_version = ''
|
||||
let resolved_version = ""
|
||||
|
||||
// Setup the API
|
||||
let octokit: InstanceType<typeof GitHub> | undefined
|
||||
|
@ -36,9 +36,9 @@ async function run(): Promise<void> {
|
|||
if (octokit !== undefined) {
|
||||
release = await release_data(version, octokit)
|
||||
}
|
||||
resolved_version = release['tag_name']
|
||||
resolved_version = release["tag_name"]
|
||||
core.info(
|
||||
`Input version '${version}' resolved to Nextflow ${release['name']}`
|
||||
`Input version '${version}' resolved to Nextflow ${release["name"]}`
|
||||
)
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error) {
|
||||
|
@ -49,7 +49,7 @@ async function run(): Promise<void> {
|
|||
}
|
||||
|
||||
// Get the download url for the desired release
|
||||
let url = ''
|
||||
let url = ""
|
||||
try {
|
||||
url = nextflow_bin_url(release, get_all)
|
||||
core.info(`Preparing to download from ${url}`)
|
||||
|
@ -60,14 +60,14 @@ async function run(): Promise<void> {
|
|||
}
|
||||
try {
|
||||
// Download Nextflow and add it to path
|
||||
let nf_path = ''
|
||||
nf_path = tc.find('nextflow', resolved_version)
|
||||
let nf_path = ""
|
||||
nf_path = tc.find("nextflow", resolved_version)
|
||||
|
||||
if (!nf_path) {
|
||||
core.debug(`Could not find Nextflow ${resolved_version} in cache`)
|
||||
const nf_install_path = await install_nextflow(url, resolved_version)
|
||||
|
||||
nf_path = await tc.cacheDir(nf_install_path, 'nextflow', resolved_version)
|
||||
nf_path = await tc.cacheDir(nf_install_path, "nextflow", resolved_version)
|
||||
core.debug(`Added Nextflow to cache: ${nf_path}`)
|
||||
|
||||
fs.rmdirSync(nf_install_path, { recursive: true })
|
||||
|
@ -86,11 +86,11 @@ async function run(): Promise<void> {
|
|||
|
||||
// Run Nextflow so it downloads its dependencies
|
||||
try {
|
||||
await exec.exec('nextflow', ['help'])
|
||||
await exec.exec("nextflow", ["help"])
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error) {
|
||||
core.warning(
|
||||
'Nextflow appears to have installed correctly, but an error was thrown while running it.'
|
||||
"Nextflow appears to have installed correctly, but an error was thrown while running it."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as github from '@actions/github'
|
||||
import { GitHub } from '@actions/github/lib/utils'
|
||||
import anyTest, { TestFn } from 'ava' // eslint-disable-line import/no-unresolved
|
||||
import * as github from "@actions/github"
|
||||
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 { getToken } from './utils'
|
||||
import * as functions from "../src/functions"
|
||||
import { getToken } from "./utils"
|
||||
|
||||
const test = anyTest as TestFn<{
|
||||
token: string
|
||||
|
@ -19,18 +19,18 @@ test.before(t => {
|
|||
}
|
||||
})
|
||||
|
||||
test('all_nf_releases', async t => {
|
||||
const result = await functions.all_nf_releases(t.context['octokit'])
|
||||
t.is(typeof result, 'object')
|
||||
test("all_nf_releases", async t => {
|
||||
const result = await functions.all_nf_releases(t.context["octokit"])
|
||||
t.is(typeof result, "object")
|
||||
})
|
||||
|
||||
test('lastest_stable_release_data', async t => {
|
||||
test("lastest_stable_release_data", async t => {
|
||||
const result = await functions.latest_stable_release_data(
|
||||
t.context['octokit']
|
||||
t.context["octokit"]
|
||||
)
|
||||
t.is(typeof result, 'object')
|
||||
t.is(result['tag_name'], 'v22.10.2')
|
||||
t.is(typeof result, "object")
|
||||
t.is(result["tag_name"], "v22.10.2")
|
||||
})
|
||||
|
||||
test.todo('nextflow_bin_url')
|
||||
test.todo('install_nextflow')
|
||||
test.todo("nextflow_bin_url")
|
||||
test.todo("install_nextflow")
|
||||
|
|
14
test/main.ts
14
test/main.ts
|
@ -1,13 +1,13 @@
|
|||
import test from 'ava' // eslint-disable-line import/no-unresolved
|
||||
import * as cp from 'child_process'
|
||||
import * as path from 'path'
|
||||
import * as process from 'process'
|
||||
import test from "ava" // eslint-disable-line import/no-unresolved
|
||||
import * as cp from "child_process"
|
||||
import * as path from "path"
|
||||
import * as process from "process"
|
||||
|
||||
// eslint-disable-next-line ava/no-skip-test
|
||||
test.skip('test runs', t => {
|
||||
process.env['INPUT_VERSION'] = 'v22.10.2'
|
||||
test.skip("test runs", t => {
|
||||
process.env["INPUT_VERSION"] = "v22.10.2"
|
||||
const np = process.execPath
|
||||
const ip = path.join(__dirname, '..', 'lib', 'src', 'main.js')
|
||||
const ip = path.join(__dirname, "..", "lib", "src", "main.js")
|
||||
const options: cp.ExecFileSyncOptions = {
|
||||
env: process.env
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as github from '@actions/github'
|
||||
import { GitHub } from '@actions/github/lib/utils'
|
||||
import anyTest, { TestFn } from 'ava' // eslint-disable-line import/no-unresolved
|
||||
import * as github from "@actions/github"
|
||||
import { GitHub } from "@actions/github/lib/utils"
|
||||
import anyTest, { TestFn } from "ava" // eslint-disable-line import/no-unresolved
|
||||
|
||||
import { release_data } from '../src/functions'
|
||||
import { getToken } from './utils'
|
||||
import { release_data } from "../src/functions"
|
||||
import { getToken } from "./utils"
|
||||
|
||||
const test = anyTest as TestFn<{
|
||||
token: string
|
||||
|
@ -20,11 +20,11 @@ test.before(t => {
|
|||
})
|
||||
|
||||
const macro = test.macro(async (t, version: string, expected: string) => {
|
||||
const result = await release_data(version, t.context['octokit'])
|
||||
t.is(result['tag_name'], expected)
|
||||
const result = await release_data(version, t.context["octokit"])
|
||||
t.is(result["tag_name"], expected)
|
||||
})
|
||||
|
||||
test('hard version', macro, 'v22.10.2', 'v22.10.2')
|
||||
test('latest-stable', macro, 'latest-stable', 'v22.10.2')
|
||||
test('latest-edge', macro, 'latest-edge', 'v22.09.7-edge')
|
||||
test('latest-everything', macro, 'latest-everything', 'v22.10.2')
|
||||
test("hard version", macro, "v22.10.2", "v22.10.2")
|
||||
test("latest-stable", macro, "latest-stable", "v22.10.2")
|
||||
test("latest-edge", macro, "latest-edge", "v22.09.7-edge")
|
||||
test("latest-everything", macro, "latest-everything", "v22.10.2")
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
export function getToken(first: boolean): string {
|
||||
const token = process.env['GITHUB_TOKEN'] || ''
|
||||
const token = process.env["GITHUB_TOKEN"] || ""
|
||||
if (!token && first) {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.warn(
|
||||
'Skipping GitHub tests. Set $GITHUB_TOKEN to run REST client and GraphQL client tests'
|
||||
"Skipping GitHub tests. Set $GITHUB_TOKEN to run REST client and GraphQL client tests"
|
||||
)
|
||||
first = false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue