mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-11-23 01:59:55 +00:00
Compare commits
12 commits
d58f32726d
...
8e5e5dbd4c
Author | SHA1 | Date | |
---|---|---|---|
8e5e5dbd4c | |||
|
2008cb75f6 | ||
|
b77a1defc2 | ||
|
e066eb124a | ||
|
7136a6f06e | ||
|
07f474dd40 | ||
|
c6daa302be | ||
|
62561112a2 | ||
|
3323654b16 | ||
|
b9495c9762 | ||
|
be72b1dc0f | ||
519edf8749 |
11 changed files with 88 additions and 12 deletions
15
.github/workflows/example.yml
vendored
15
.github/workflows/example.yml
vendored
|
@ -42,3 +42,18 @@ jobs:
|
||||||
version: ${{ matrix.nextflow_version }}
|
version: ${{ matrix.nextflow_version }}
|
||||||
all: ${{ matrix.all_distribution }}
|
all: ${{ matrix.all_distribution }}
|
||||||
- run: nextflow -v
|
- run: nextflow -v
|
||||||
|
|
||||||
|
test-14:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: easimon/maximize-build-space@v7
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
cache: "npm"
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run build
|
||||||
|
- run: npm run package
|
||||||
|
- uses: ./
|
||||||
|
- run: nextflow -v
|
||||||
|
|
1
.github/workflows/publish.yml
vendored
1
.github/workflows/publish.yml
vendored
|
@ -16,6 +16,7 @@ jobs:
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm run package
|
- run: npm run package
|
||||||
|
- run: sed -i 's%lib/src/main.js%dist/index.js%' package.json
|
||||||
- uses: JasonEtco/build-and-tag-action@v1
|
- uses: JasonEtco/build-and-tag-action@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|
5
.github/workflows/test.yml
vendored
5
.github/workflows/test.yml
vendored
|
@ -23,5 +23,6 @@ jobs:
|
||||||
- run: npm run format:check
|
- run: npm run format:check
|
||||||
- run: npm run lint
|
- run: npm run lint
|
||||||
- run: npm run package
|
- run: npm run package
|
||||||
# FIXME Token doesn't get passed correctly
|
- run: npm run test
|
||||||
# - run: npm run test
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
|
||||||
|
- If `fs.renameSync` fails (e.g. because source and destination files are on different partitions), try `fs.copySync` and `fs.unlinkSync` instead (#14).
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- Re-enable npm run test in CI (#15).
|
||||||
|
|
||||||
|
- Fix release version check in unit test (#15).
|
||||||
|
|
||||||
|
- Add helper function for checking the latest releases in the unit tests (#15).
|
||||||
|
|
||||||
## [1.3.0] - 2023-05-19
|
## [1.3.0] - 2023-05-19
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Setup Nextflow for GitHub Actions
|
# ![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)
|
||||||
[![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)
|
||||||
|
|
BIN
docs/images/nfcore-setupnextflow_logo.png
Normal file
BIN
docs/images/nfcore-setupnextflow_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 90 KiB |
BIN
docs/images/nfcore-setupnextflow_logo_dark.png
Normal file
BIN
docs/images/nfcore-setupnextflow_logo_dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
|
@ -106,7 +106,13 @@ export async function install_nextflow(
|
||||||
const temp_install_dir = fs.mkdtempSync(`nxf-${version}`)
|
const temp_install_dir = fs.mkdtempSync(`nxf-${version}`)
|
||||||
const nf_path = `${temp_install_dir}/nextflow`
|
const nf_path = `${temp_install_dir}/nextflow`
|
||||||
|
|
||||||
|
try {
|
||||||
fs.renameSync(nf_dl_path, nf_path)
|
fs.renameSync(nf_dl_path, nf_path)
|
||||||
|
} catch (err: unknown) {
|
||||||
|
core.debug(`Failed to rename file: ${err}`)
|
||||||
|
fs.copyFileSync(nf_dl_path, nf_path)
|
||||||
|
fs.unlinkSync(nf_dl_path)
|
||||||
|
}
|
||||||
fs.chmodSync(nf_path, "0711")
|
fs.chmodSync(nf_path, "0711")
|
||||||
|
|
||||||
return temp_install_dir
|
return temp_install_dir
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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 { getReleaseTag, getToken } from "./utils"
|
||||||
|
|
||||||
const test = anyTest as TestFn<{
|
const test = anyTest as TestFn<{
|
||||||
token: string
|
token: string
|
||||||
|
@ -29,7 +29,8 @@ test("lastest_stable_release_data", async t => {
|
||||||
t.context["octokit"]
|
t.context["octokit"]
|
||||||
)
|
)
|
||||||
t.is(typeof result, "object")
|
t.is(typeof result, "object")
|
||||||
t.is(result["tag_name"], "v22.10.2")
|
const expected = await getReleaseTag("nextflow-io/nextflow", false)
|
||||||
|
t.is(result["tag_name"], expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
test.todo("nextflow_bin_url")
|
test.todo("nextflow_bin_url")
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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 { getReleaseTag, getToken } from "./utils"
|
||||||
|
|
||||||
const test = anyTest as TestFn<{
|
const test = anyTest as TestFn<{
|
||||||
token: string
|
token: string
|
||||||
|
@ -19,12 +19,22 @@ test.before(t => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const macro = test.macro(async (t, version: string, expected: string) => {
|
const macro = test.macro(async (t, version: string) => {
|
||||||
|
let expected
|
||||||
|
if (version === "latest-stable") {
|
||||||
|
expected = await getReleaseTag("nextflow-io/nextflow", false)
|
||||||
|
} 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"])
|
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")
|
||||||
test("latest-stable", macro, "latest-stable", "v22.10.2")
|
test("latest-stable", macro, "latest-stable")
|
||||||
test("latest-edge", macro, "latest-edge", "v22.09.7-edge")
|
test("latest-edge", macro, "latest-edge")
|
||||||
test("latest-everything", macro, "latest-everything", "v22.10.2")
|
test("latest-everything", macro, "latest-everything")
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import fetch from "node-fetch"
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -10,3 +12,31 @@ export function getToken(first: boolean): string {
|
||||||
|
|
||||||
return token
|
return token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the release from a GitHub repository. This function allows to fetch
|
||||||
|
* either the latest release or the latest pre-release ("edge" release).
|
||||||
|
*
|
||||||
|
* @param {string} repo - The GitHub repository to fetch the release from,
|
||||||
|
* in the format 'owner/repo'.
|
||||||
|
* @param {boolean} [prerelease] - If true, fetches the latest pre-release.
|
||||||
|
* If false or undefined, fetches the latest release regardless of whether
|
||||||
|
* it's a pre-release or not.
|
||||||
|
*
|
||||||
|
* @returns {Promise<string>} A Promise that resolves to a string representing the tag name
|
||||||
|
* of the found release. If no release is found, the Promise resolves to 'Release not found'.
|
||||||
|
*/
|
||||||
|
export async function getReleaseTag(
|
||||||
|
repo: string,
|
||||||
|
prerelease?: boolean
|
||||||
|
): Promise<string> {
|
||||||
|
const response = await fetch(`https://api.github.com/repos/${repo}/releases`)
|
||||||
|
const releases = await response.json()
|
||||||
|
|
||||||
|
const release = releases.find(
|
||||||
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||||
|
(rel: any) => prerelease === undefined || rel.prerelease === prerelease
|
||||||
|
)
|
||||||
|
|
||||||
|
return release ? release.tag_name : "No release found"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue