style: Use double-quotes

Co-authored-by: ewels <ewels@users.noreply.github.com>
pull/10/head
Edmund Miller 2 years ago committed by Thomas A. Christensen II
parent 05aef69bc1
commit 0aeab8d284

@ -17,13 +17,13 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
nextflow_version: nextflow_version:
- '21.10.3' - "21.10.3"
- '22.04' - "22.04"
- '22.03.1-edge' - "22.03.1-edge"
- 'latest' - "latest"
- 'latest-stable' - "latest-stable"
- 'latest-edge' - "latest-edge"
- 'latest-everything' - "latest-everything"
all_distribution: all_distribution:
- true - true
- false - false
@ -33,7 +33,7 @@ jobs:
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 16
cache: 'npm' cache: "npm"
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npm run package - run: npm run package

@ -12,7 +12,7 @@ jobs:
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 16
cache: 'npm' cache: "npm"
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npm run package - run: npm run package

@ -17,7 +17,7 @@ jobs:
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 16
cache: 'npm' cache: "npm"
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npm run format:check - run: npm run format:check

@ -3,7 +3,7 @@
"tabWidth": 2, "tabWidth": 2,
"useTabs": false, "useTabs": false,
"semi": false, "semi": false,
"singleQuote": true, "singleQuote": false,
"trailingComma": "none", "trailingComma": "none",
"bracketSpacing": true, "bracketSpacing": true,
"arrowParens": "avoid" "arrowParens": "avoid"

@ -1,22 +1,22 @@
name: 'Setup Nextflow' name: "Setup Nextflow"
description: 'Install Nextflow and add it to the PATH' description: "Install Nextflow and add it to the PATH"
author: 'nf-core' author: "nf-core"
inputs: inputs:
version: 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 required: false
default: 'latest-stable' default: "latest-stable"
all: all:
description: "Whether to install every Nextflow release via the '-all' distribution." description: "Whether to install every Nextflow release via the '-all' distribution."
required: false required: false
default: false default: false
token: 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 required: false
default: ${{ github.token }} default: ${{ github.token }}
runs: runs:
using: 'node16' using: "node16"
main: 'dist/index.js' main: "dist/index.js"
branding: branding:
icon: 'shuffle' icon: "shuffle"
color: 'green' color: "green"

@ -1,11 +1,11 @@
import * as core from '@actions/core' import * as core from "@actions/core"
import { GitHub } from '@actions/github/lib/utils' 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' } const NEXTFLOW_REPO = { owner: "nextflow-io", repo: "nextflow" }
// HACK Private but I want to test this // HACK Private but I want to test this
export async function all_nf_releases( export async function all_nf_releases(
@ -35,21 +35,21 @@ export async function release_data(
): Promise<object> { ): Promise<object> {
// Setup tag-based filtering // Setup tag-based filtering
let filter = (r: object): boolean => { 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 // Check if the user passed a 'latest*' tag, and override filtering
// accordingly // accordingly
if (version.includes('latest')) { if (version.includes("latest")) {
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: object) => {
return true return true
} }
} else if (version.includes('-edge')) { } else if (version.includes("-edge")) {
filter = r => { filter = r => {
return r['tag_name'].endsWith('-edge') return r["tag_name"].endsWith("-edge")
} }
} else { } else {
// This is special: passing 'latest' or 'latest-stable' allows us to use // 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) => { 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["tag_name"], y["tag_name"], true) * -1
}) })
return matching_releases[0] return matching_releases[0]
} }
export function nextflow_bin_url(release: object, get_all: boolean): string { 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) => { const all_asset = release_assets.filter((a: object) => {
return a['browser_download_url'].endsWith('-all') return a["browser_download_url"].endsWith("-all")
})[0] })[0]
const regular_asset = release_assets.filter((a: object) => { const regular_asset = release_assets.filter((a: object) => {
return a['name'] === 'nextflow' return a["name"] === "nextflow"
})[0] })[0]
const dl_asset = get_all ? all_asset : regular_asset 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` const nf_path = `${temp_install_dir}/nextflow`
fs.renameSync(nf_dl_path, nf_path) fs.renameSync(nf_dl_path, nf_path)
fs.chmodSync(nf_path, '0711') fs.chmodSync(nf_path, "0711")
return temp_install_dir return temp_install_dir
} }

@ -1,22 +1,22 @@
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 * as github from "@actions/github"
import { GitHub } from '@actions/github/lib/utils' 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 { install_nextflow, nextflow_bin_url, release_data } from './functions' import { install_nextflow, nextflow_bin_url, release_data } from "./functions"
async function run(): Promise<void> { async function run(): Promise<void> {
// Set environment variables // Set environment variables
core.exportVariable('CAPSULE_LOG', 'none') core.exportVariable("CAPSULE_LOG", "none")
// Read in the arguments // Read in the arguments
const token = core.getInput('token') const token = core.getInput("token")
const version = core.getInput('version') const version = core.getInput("version")
const get_all = core.getBooleanInput('all') const get_all = core.getBooleanInput("all")
let resolved_version = '' let resolved_version = ""
// Setup the API // Setup the API
let octokit: InstanceType<typeof GitHub> | undefined let octokit: InstanceType<typeof GitHub> | undefined
@ -36,9 +36,9 @@ async function run(): Promise<void> {
if (octokit !== undefined) { if (octokit !== undefined) {
release = await release_data(version, octokit) release = await release_data(version, octokit)
} }
resolved_version = release['tag_name'] 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"]}`
) )
} catch (e: unknown) { } catch (e: unknown) {
if (e instanceof Error) { if (e instanceof Error) {
@ -49,7 +49,7 @@ async function run(): Promise<void> {
} }
// Get the download url for the desired release // Get the download url for the desired release
let url = '' let url = ""
try { try {
url = nextflow_bin_url(release, get_all) url = nextflow_bin_url(release, get_all)
core.info(`Preparing to download from ${url}`) core.info(`Preparing to download from ${url}`)
@ -60,14 +60,14 @@ async function run(): Promise<void> {
} }
try { try {
// Download Nextflow and add it to path // Download Nextflow and add it to path
let nf_path = '' let nf_path = ""
nf_path = tc.find('nextflow', resolved_version) nf_path = tc.find("nextflow", resolved_version)
if (!nf_path) { if (!nf_path) {
core.debug(`Could not find Nextflow ${resolved_version} in cache`) core.debug(`Could not find Nextflow ${resolved_version} in cache`)
const nf_install_path = await install_nextflow(url, resolved_version) 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}`) core.debug(`Added Nextflow to cache: ${nf_path}`)
fs.rmdirSync(nf_install_path, { recursive: true }) fs.rmdirSync(nf_install_path, { recursive: true })
@ -86,11 +86,11 @@ async function run(): Promise<void> {
// Run Nextflow so it downloads its dependencies // Run Nextflow so it downloads its dependencies
try { try {
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( 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 * 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 * as functions from '../src/functions' import * as functions from "../src/functions"
import { getToken } from './utils' import { getToken } from "./utils"
const test = anyTest as TestFn<{ const test = anyTest as TestFn<{
token: string token: string
@ -19,18 +19,18 @@ test.before(t => {
} }
}) })
test('all_nf_releases', async t => { test("all_nf_releases", async t => {
const result = await functions.all_nf_releases(t.context['octokit']) const result = await functions.all_nf_releases(t.context["octokit"])
t.is(typeof result, 'object') 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( const result = await functions.latest_stable_release_data(
t.context['octokit'] t.context["octokit"]
) )
t.is(typeof result, 'object') t.is(typeof result, "object")
t.is(result['tag_name'], 'v22.10.2') t.is(result["tag_name"], "v22.10.2")
}) })
test.todo('nextflow_bin_url') test.todo("nextflow_bin_url")
test.todo('install_nextflow') test.todo("install_nextflow")

@ -1,13 +1,13 @@
import test from 'ava' // eslint-disable-line import/no-unresolved import test from "ava" // eslint-disable-line import/no-unresolved
import * as cp from 'child_process' import * as cp from "child_process"
import * as path from 'path' import * as path from "path"
import * as process from 'process' import * as process from "process"
// eslint-disable-next-line ava/no-skip-test // eslint-disable-next-line ava/no-skip-test
test.skip('test runs', t => { test.skip("test runs", t => {
process.env['INPUT_VERSION'] = 'v22.10.2' process.env["INPUT_VERSION"] = "v22.10.2"
const np = process.execPath 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 = { const options: cp.ExecFileSyncOptions = {
env: process.env env: process.env
} }

@ -1,9 +1,9 @@
import * as github from '@actions/github' 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 { release_data } from "../src/functions"
import { getToken } from './utils' import { getToken } from "./utils"
const test = anyTest as TestFn<{ const test = anyTest as TestFn<{
token: string token: string
@ -20,11 +20,11 @@ test.before(t => {
}) })
const macro = test.macro(async (t, version: string, expected: string) => { const macro = test.macro(async (t, version: string, expected: string) => {
const result = await release_data(version, t.context['octokit']) const result = await release_data(version, t.context["octokit"])
t.is(result['tag_name'], expected) t.is(result["tag_name"], expected)
}) })
test('hard version', macro, 'v22.10.2', 'v22.10.2') test("hard version", macro, "v22.10.2", "v22.10.2")
test('latest-stable', macro, 'latest-stable', 'v22.10.2') test("latest-stable", macro, "latest-stable", "v22.10.2")
test('latest-edge', macro, 'latest-edge', 'v22.09.7-edge') test("latest-edge", macro, "latest-edge", "v22.09.7-edge")
test('latest-everything', macro, 'latest-everything', 'v22.10.2') test("latest-everything", macro, "latest-everything", "v22.10.2")

@ -1,9 +1,9 @@
export function getToken(first: boolean): string { export function getToken(first: boolean): string {
const token = process.env['GITHUB_TOKEN'] || '' const token = process.env["GITHUB_TOKEN"] || ""
if (!token && first) { if (!token && first) {
/* eslint-disable-next-line no-console */ /* eslint-disable-next-line no-console */
console.warn( 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 first = false
} }

Loading…
Cancel
Save