From 3cb50adff1629ff3ddea6a5aacd47b05ffc3d2d4 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Wed, 21 Aug 2024 22:56:54 +0200 Subject: [PATCH 01/12] add project_directory to many actions --- .github/workflows/build.yaml | 11 ++++++++++- .github/workflows/test.yaml | 12 +++++++++++- ns-build/README.md | 5 +++++ ns-build/action.yml | 8 ++++++++ ns-build/generate_yml.R | 12 +++++------- ns-list/README.md | 19 ++++++++----------- ns-list/action.yml | 19 ++++++++++--------- ns-list/generate_yml.R | 11 ++++------- ns-list/index.js | 6 ++++++ pro/generate-documentation-qmd/README.md | 4 ++++ project/build-target/README.md | 2 ++ project/build-target/action.yml | 12 ++++++++++-- project/detect-changed-components/README.md | 2 ++ project/detect-changed-components/action.yml | 7 +++++++ project/sync-and-cache/README.md | 4 ++-- project/sync-and-cache/action.yml | 13 +++++++++---- 16 files changed, 103 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6e44438..90a0adb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,6 +7,10 @@ concurrency: on: workflow_call: inputs: + project_directory: + type: string + description: 'The path to a Viash project' + required: false version: type: string description: | @@ -51,6 +55,7 @@ jobs: - name: Determine variables id: variables + working-directory: ${{ inputs.project_directory }} run: | VERSION="${{ inputs.version }}" SOURCE_BRANCH=$(echo "$GITHUB_REF" | sed 's/refs\/heads\///') @@ -76,6 +81,7 @@ jobs: - uses: viash-io/viash-actions/project/build-target@v6 id: build-target with: + project_directory: ${{ inputs.project_directory }} target_branch: ${{ steps.variables.outputs.target_branch }} version: ${{ steps.variables.outputs.version }} @@ -84,7 +90,7 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_branch: ${{ steps.variables.outputs.target_branch }} - publish_dir: . + publish_dir: ${{ inputs.project_directory }} # phase 2 docker: @@ -121,11 +127,13 @@ jobs: - name: Build image if: ${{ inputs.retag_image_tag == '' }} + working-directory: ${{ inputs.project_directory }} run: | ${{matrix.component.executable}} ---engine docker ---setup build ---verbose - name: Retag image if: ${{ inputs.retag_image_tag != '' }} + working-directory: ${{ inputs.project_directory }} run: | source_image_tag="${{ inputs.retag_image_tag }}" @@ -143,5 +151,6 @@ jobs: docker tag "$source_image_id" "$dest_image_id" - name: Push image + working-directory: ${{ inputs.project_directory }} run: | ${{matrix.component.executable}} ---engine docker ---setup push ---verbose diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2567f6a..148890b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,6 +3,10 @@ name: Test on: workflow_call: inputs: + project_directory: + type: string + description: 'The path to a Viash project' + required: false timeout: type: number description: | @@ -45,22 +49,27 @@ jobs: - uses: viash-io/viash-actions/setup@v6 - - uses: viash-io/viash-actions/project/sync-and-cache@main + - uses: viash-io/viash-actions/project/sync-and-cache@v6 id: cache + with: + project_directory: ${{ inputs.project_directory }} - id: ns_list uses: viash-io/viash-actions/ns-list@v6 with: + project_directory: ${{ inputs.project_directory }} format: json runner: executable - id: ns_list_filter_changed uses: viash-io/viash-actions/project/detect-changed-components@v6 with: + project_directory: ${{ inputs.project_directory }} input_file: "${{ steps.ns_list.outputs.output_file }}" - name: Filter out Nextflow scripts (testing currently not supported) id: ns_list_filter_nextflow + working-directory: ${{ inputs.project_directory }} run: | OUTPUT_MATRIX=$(echo '${{ steps.ns_list_filter_changed.outputs.output_matrix }}' | jq -c 'map(select(.main_script_type != "nextflow_script"))') echo "output_matrix=$OUTPUT_MATRIX" >> $GITHUB_OUTPUT @@ -104,6 +113,7 @@ jobs: timeout-minutes: ${{ inputs.timeout }} env: RUNNER_TEMP: "${{ runner.temp }}/viash_temp" + working-directory: ${{ inputs.project_directory }} run: | viash test \ "${{ matrix.component.config }}" \ diff --git a/ns-build/README.md b/ns-build/README.md index b2fcde9..bc0b94d 100644 --- a/ns-build/README.md +++ b/ns-build/README.md @@ -26,6 +26,8 @@ We recommend using a Linux or MacOS runner if possible. by namespace name. Can be a regex. Example: “^mynamespace\$”. - `query_name`: - *optional*. Filter which components get selected by component name. Can be a regex. Example: “^component1”. +- `config`: - *optional*. Filter which component get selected by + specifying the config path. - `src`: - *optional*. A source directory containing viash config files, possibly structured in a hierarchical folder structure. Default: src/. - `platform`: - *optional*. (viash \< 0.9.0) Acts as a regular @@ -54,6 +56,9 @@ We recommend using a Linux or MacOS runner if possible. are: “error”, “warn”, “info”, “debug”, “trace”. - `setup`: - *optional*. Which docker_setup_strategy for creating the container to use \[Docker Engine only\]. +- `project_directory`: - *optional*. Path to the project directory. This + is the directory where the project’s `_viash.yaml` file is located. If + not provided, the current working directory is used. ### Outputs diff --git a/ns-build/action.yml b/ns-build/action.yml index 7189f55..2d15992 100644 --- a/ns-build/action.yml +++ b/ns-build/action.yml @@ -18,6 +18,9 @@ inputs: description: 'Filter which components get selected by component name. Can be a regex. Example: "^component1".' required: false + config: + description: Filter which component get selected by specifying the config path. + required: false src: description: 'A source directory containing viash config files, possibly structured in a hierarchical folder structure. Default: src/.' @@ -61,6 +64,11 @@ inputs: description: Which docker_setup_strategy for creating the container to use [Docker Engine only]. required: false + project_directory: + description: Path to the project directory. This is the directory where the project's + `_viash.yaml` file is located. If not provided, the current working directory + is used. + required: false outputs: output: description: The output of 'viash ns build'. diff --git a/ns-build/generate_yml.R b/ns-build/generate_yml.R index 41842ae..bda8da4 100644 --- a/ns-build/generate_yml.R +++ b/ns-build/generate_yml.R @@ -41,13 +41,11 @@ input_values <- sapply(selected_opts, function(opt) { ) setNames(list(out), opt$name) }) -# workaround for viash 0.9.0-RC6, should be fixed in 0.9.0 -if (!"platform" %in% names(input_values)) { - input_values$platform <- list( - description = "Acts as a regular expression to filter the platform ids specified in the found config files. If this is not provided, all platforms will be used. If no platforms are defined in a config, the native platform will be used. In addition, the path to a platform yaml file can also be specified. Deprecated in Viash 0.9.0, will be removed in Viash 1.0.0.", - required = FALSE - ) -} + +input_values$project_directory <- list( + description = "Path to the project directory. This is the directory where the project's `_viash.yaml` file is located. If not provided, the current working directory is used.", + required = FALSE +) out <- list( name = schema$bannerCommand, diff --git a/ns-list/README.md b/ns-list/README.md index d1cba64..9d13174 100644 --- a/ns-list/README.md +++ b/ns-list/README.md @@ -26,6 +26,8 @@ We recommend using a Linux or MacOS runner if possible. by namespace name. Can be a regex. Example: “^mynamespace\$”. - `query_name`: - *optional*. Filter which components get selected by component name. Can be a regex. Example: “^component1”. +- `config`: - *optional*. Filter which component get selected by + specifying the config path. - `src`: - *optional*. A source directory containing viash config files, possibly structured in a hierarchical folder structure. Default: src/. - `platform`: - *optional*. (viash \< 0.9.0) Use –runner and –engine @@ -54,6 +56,9 @@ We recommend using a Linux or MacOS runner if possible. - `parse_argument_groups`: - *optional*. DEPRECATED. This is now always enabled. Whether or not to postprocess each component’s argument_groups. +- `project_directory`: - *optional*. Path to the project directory. This + is the directory where the project’s `_viash.yaml` file is located. If + not provided, the current working directory is used. - `output_file`: - *optional*. Path of a file to which the output will be written. If not set, this action will create a file with a random name in `RUNNER_TEMP`. @@ -63,7 +68,6 @@ We recommend using a Linux or MacOS runner if possible. - `output`: The output of the ‘viash ns list’ command, which is a list of all of the components found. By default this will be a yaml, unless the format argument was set to ‘json’. - - `output_file`: Path of a file to which the output was written (same as \`inputs.output_file\`\`). We recommend using this property for capturing the action’s output because there is a limit in the object @@ -71,16 +75,9 @@ We recommend using a Linux or MacOS runner if possible. property instead of a static file path, changing the location of the output file will not require you to adjust settings for downstream actions as well. - -- `output_matrix`: Matrix of components. The matrix is a json array with - the following fields: - - - name: The name of the component - - namespace: The namespace of the component - - full_name: The full name of the component - - config: The path to the config file of the component - - dir: The directory of the config file of the component - - main_script_type: The type of the main script of the component +- `output_matrix`: A simplified version of the output, which is a list + of components with fields ‘name’, ‘namespace’, ‘full_name’, ‘config’, + and ‘dir’. ## Usage diff --git a/ns-list/action.yml b/ns-list/action.yml index f201730..25ca5c3 100644 --- a/ns-list/action.yml +++ b/ns-list/action.yml @@ -18,6 +18,9 @@ inputs: description: 'Filter which components get selected by component name. Can be a regex. Example: "^component1".' required: false + config: + description: Filter which component get selected by specifying the config path. + required: false src: description: 'A source directory containing viash config files, possibly structured in a hierarchical folder structure. Default: src/.' @@ -58,6 +61,11 @@ inputs: description: DEPRECATED. This is now always enabled. Whether or not to postprocess each component's argument_groups. required: false + project_directory: + description: Path to the project directory. This is the directory where the project's + `_viash.yaml` file is located. If not provided, the current working directory + is used. + required: false output_file: description: Path of a file to which the output will be written. If not set, this action will create a file with a random name in `RUNNER_TEMP`. @@ -75,15 +83,8 @@ outputs: of the output file will not require you to adjust settings for downstream actions as well. output_matrix: - description: | - Matrix of components. The matrix is a json array with the following fields: - - - name: The name of the component - - namespace: The namespace of the component - - full_name: The full name of the component - - config: The path to the config file of the component - - dir: The directory of the config file of the component - - main_script_type: The type of the main script of the component + description: A simplified version of the output, which is a list of components + with fields 'name', 'namespace', 'full_name', 'config', and 'dir'. runs: using: node20 main: index.js diff --git a/ns-list/generate_yml.R b/ns-list/generate_yml.R index bcb3c95..8c77595 100644 --- a/ns-list/generate_yml.R +++ b/ns-list/generate_yml.R @@ -42,13 +42,10 @@ input_values <- sapply(selected_opts, function(opt) { setNames(list(out), opt$name) }) -# workaround for viash 0.9.0-RC6, should be fixed in 0.9.0 -if (!"platform" %in% names(input_values)) { - input_values$platform <- list( - description = "Acts as a regular expression to filter the platform ids specified in the found config files. If this is not provided, all platforms will be used. If no platforms are defined in a config, the native platform will be used. In addition, the path to a platform yaml file can also be specified. Deprecated in Viash 0.9.0, will be removed in Viash 1.0.0.", - required = FALSE - ) -} +input_values$project_directory <- list( + description = "Path to the project directory. This is the directory where the project's `_viash.yaml` file is located. If not provided, the current working directory is used.", + required = FALSE +) input_values$output_file <- list( description = "Path of a file to which the output will be written. If not set, this action will create a file with a random name in `RUNNER_TEMP`.", diff --git a/ns-list/index.js b/ns-list/index.js index 4e9f0ad..a6191f4 100644 --- a/ns-list/index.js +++ b/ns-list/index.js @@ -20,6 +20,12 @@ async function run() { }; options.silent = true; + // set up workdir + const workdir = core.getInput("project_directory"); + if (workdir) { + options.cwd = workdir; + } + // fetch arguments for command // skip "parallel" // todo: can I extract these inputNames from the action.yml? diff --git a/pro/generate-documentation-qmd/README.md b/pro/generate-documentation-qmd/README.md index 5a0fdc0..f77c71b 100644 --- a/pro/generate-documentation-qmd/README.md +++ b/pro/generate-documentation-qmd/README.md @@ -35,6 +35,8 @@ before you run `generate_documentation_qmd`. `{type}`, `{namespace}` and `{name}` wildcards to create a custom folder hierarchy for storing the output for different component. Default: `{type}s/{namespace}/{name}.qmd`. +- `clean`: *(Optional)* Whether or not to start from a clean directory. + Default: `false`. - `ref`: *(Optional)* The git tag. Used to create links to the source code and to build nextflow commands in the generated documentation. Default: `${{ github.ref_name }}`. @@ -49,6 +51,8 @@ before you run `generate_documentation_qmd`. `latest`. - `src`: *(Optional)* An override for the `--src` parameter in `viash ns list`. Example: `src/`. +- `query`: *(Optional)* Filter which components get selected by + component and namespace name. Can be a regex. ## Usage diff --git a/project/build-target/README.md b/project/build-target/README.md index 8762f82..4a4ed23 100644 --- a/project/build-target/README.md +++ b/project/build-target/README.md @@ -13,6 +13,8 @@ built. ### Inputs +- `project_directory`: - *optional*. Path to the project directory. This + is the directory where the project config `_viash.yaml` is located. - `version`: - *optional*. Version name to use for the build. If not specified, `${BRANCH_NAME}_build` will be used. - `target_branch`: - *optional*. Branch to deploy to. If not specified, diff --git a/project/build-target/action.yml b/project/build-target/action.yml index 8078bf9..a45a1a7 100644 --- a/project/build-target/action.yml +++ b/project/build-target/action.yml @@ -6,6 +6,9 @@ description: > containers that need to be built. inputs: + project_directory: + required: false + description: Path to the project directory. This is the directory where the project config `_viash.yaml` is located. version: description: 'Version name to use for the build. If not specified, `${BRANCH_NAME}_build` will be used.' required: false @@ -36,6 +39,7 @@ runs: - name: Determine version tag from branch name shell: bash id: defaults + working-directory: ${{ inputs.project_directory }} run: | BRANCH_NAME=$(echo $GITHUB_REF | sed 's/refs\/heads\///' | sed 's/[^a-zA-Z0-9_]/_/g') VERSION=${{ inputs.version }} @@ -65,12 +69,14 @@ runs: - name: Remove target folder from .gitignore shell: bash + working-directory: ${{ inputs.project_directory }} run: | TARGET_DIR="${{ steps.defaults.outputs.target_dir }}" sed -i "/^\\/*${TARGET_DIR}.*/d" .gitignore - name: Set version in _viash.yaml shell: bash + working-directory: ${{ inputs.project_directory }} run: | yq eval '.version = "${{ steps.defaults.outputs.version }}"' -i _viash.yaml @@ -78,12 +84,13 @@ runs: with: parallel: true config_mod: ${{ steps.defaults.outputs.config_mod }} + project_directory: ${{ inputs.project_directory }} - name: Build nextflow schemas if: ${{ inputs.viash_pro_token != '' }} uses: viash-io/viash-actions/pro/build-nextflow-params@v6 with: - target_dir: ${{ steps.defaults.outputs.target_dir }} + target_dir: ${{ inputs.project_directory }}/${{ steps.defaults.outputs.target_dir }} viash_pro_token: ${{ inputs.viash_pro_token }} tools_version: 'main_build' enable_dataset_input: true @@ -92,13 +99,14 @@ runs: if: ${{ inputs.viash_pro_token != '' }} uses: viash-io/viash-actions/pro/build-nextflow-params@v6 with: - target_dir: ${{ steps.defaults.outputs.target_dir }} + target_dir: ${{ inputs.project_directory }}/${{ steps.defaults.outputs.target_dir }} viash_pro_token: ${{ inputs.viash_pro_token }} tools_version: 'main_build' - name: Find Docker Executables that need to be built id: find_docker_executables shell: bash + working-directory: ${{ inputs.project_directory }} run: | TARGET_DIR="${{ steps.defaults.outputs.target_dir }}" diff --git a/project/detect-changed-components/README.md b/project/detect-changed-components/README.md index f7d6d0f..a35e5bf 100644 --- a/project/detect-changed-components/README.md +++ b/project/detect-changed-components/README.md @@ -12,6 +12,8 @@ has been changed with respect to the default branch. ### Inputs +- `project_directory`: - *optional*. Path to the project directory. This + is the directory where the project config `_viash.yaml` is located. - `input_file`: - *required*. Path to a viash ns list json file ### Outputs diff --git a/project/detect-changed-components/action.yml b/project/detect-changed-components/action.yml index f6ebd59..ae7c27c 100644 --- a/project/detect-changed-components/action.yml +++ b/project/detect-changed-components/action.yml @@ -5,6 +5,9 @@ description: > the component has been changed with respect to the default branch. inputs: + project_directory: + required: false + description: Path to the project directory. This is the directory where the project config `_viash.yaml` is located. input_file: required: true description: 'Path to a viash ns list json file' @@ -32,6 +35,7 @@ runs: - name: Get head git commit message shell: bash id: get_head_commit_message + working-directory: ${{ inputs.project_directory }} run: | head_commit_message=$(git show -s --format=%s ${{ github.event.pull_request.head.sha || github.sha }}) echo "HEAD_COMMIT_MESSAGE=$head_commit_message" >> "$GITHUB_OUTPUT" @@ -39,6 +43,7 @@ runs: - name: Get changed files id: changed-files uses: tj-actions/changed-files@v44 + working-directory: ${{ inputs.project_directory }} with: separator: "," diff_relative: true @@ -77,6 +82,7 @@ runs: - name: Set matrix to only run tests for components that had their config or resources changed. id: filter shell: bash + working-directory: ${{ inputs.project_directory }} run: | # create output path output_file=$(mktemp $RUNNER_TEMP/viash_ns_changed_files.XXXXXX.json) @@ -167,6 +173,7 @@ runs: - id: set_matrix shell: bash + working-directory: ${{ inputs.project_directory }} run: | comp_file="${{ contains(steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE, 'ci force') && inputs.input_file || steps.filter.outputs.output_file }}" matrix=$( diff --git a/project/sync-and-cache/README.md b/project/sync-and-cache/README.md index d548f51..1dc88e8 100644 --- a/project/sync-and-cache/README.md +++ b/project/sync-and-cache/README.md @@ -29,8 +29,8 @@ info: ### Inputs -- `project_config`: - *optional*. Path to the project configuration - file. +- `project_directory`: - *optional*. Path to the project directory. This + is the directory where the project config `_viash.yaml` is located. - `cache_key_prefix`: - *optional*. A prefix for the cache hash key. Prefix is also used for restoring stale cache if no cache hit occurred for key. diff --git a/project/sync-and-cache/action.yml b/project/sync-and-cache/action.yml index fde4e6e..86116c0 100644 --- a/project/sync-and-cache/action.yml +++ b/project/sync-and-cache/action.yml @@ -21,10 +21,9 @@ description: | dest: my-folder ``` inputs: - project_config: + project_directory: required: false - description: Path to the project configuration file. - default: _viash.yaml + description: Path to the project directory. This is the directory where the project config `_viash.yaml` is located. cache_key_prefix: required: false description: A prefix for the cache hash key. Prefix is also used for restoring stale cache if no cache hit occurred for key. @@ -42,6 +41,7 @@ runs: - name: Detect test resources id: test_resources shell: bash + working-directory: ${{ inputs.project_directory }} run: | resources_detected=$(yq e '.info | has("test_resources")' "${{ inputs.project_config }}") if [ "$resources_detected" == "false" ]; then @@ -59,7 +59,7 @@ runs: # fetch the test resource destination paths dest_paths=$( - yq e '.info.test_resources[] | .dest' "${{ inputs.project_config }}" + yq e '.info.test_resources[] | "${{inputs.project_directory}}/" + .dest' "${{ inputs.project_config }}" ) # output multiline string @@ -77,6 +77,7 @@ runs: - name: Create hash key shell: bash id: cache_key + working-directory: ${{ inputs.project_directory }} run: | if [ -z "${{ steps.test_resources.outputs.test_resources }}" ]; then echo "cache_key=" >> $GITHUB_OUTPUT @@ -115,6 +116,7 @@ runs: - name: Print resources shell: bash if: ${{ steps.cache_key.outputs.cache_key != '' }} + working-directory: ${{ inputs.project_directory }} run: | echo "### Cache key: ${{ steps.cache_key.outputs.cache_key }}" echo @@ -132,6 +134,7 @@ runs: # initialize cache - name: Cache resources uses: actions/cache@v4 + working-directory: ${{ inputs.project_directory }} if: ${{ steps.cache_key.outputs.cache_key != '' }} with: path: ${{ steps.test_resources.outputs.dest_paths }} @@ -142,6 +145,7 @@ runs: - name: Sync resources shell: bash if: ${{ steps.cache_key.outputs.cache_key != '' }} + working-directory: ${{ inputs.project_directory }} run: | function sync_s3() { local s3_path="$1" @@ -169,6 +173,7 @@ runs: - name: List resources shell: bash if: ${{ steps.cache_key.outputs.cache_key != '' }} + working-directory: ${{ inputs.project_directory }} run: | echo "${{ steps.test_resources.outputs.test_resources }}" | \ while read -r line; do From 63ab501c9cc6fa3268566e28e72669f1c18b7b13 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Wed, 21 Aug 2024 23:00:22 +0200 Subject: [PATCH 02/12] temporarily switch to this branch for testing purposes --- .github/workflows/README.md | 4 ++-- .github/workflows/README.qmd | 4 ++-- .github/workflows/build.yaml | 6 +++--- .github/workflows/test.yaml | 10 +++++----- ns-build/README.md | 4 ++-- ns-build/README.qmd | 4 ++-- ns-list/README.md | 4 ++-- ns-list/README.qmd | 4 ++-- pro/build-nextflow-params/README.md | 4 ++-- pro/build-nextflow-params/README.qmd | 4 ++-- pro/build-nextflow-schemas/README.md | 4 ++-- pro/build-nextflow-schemas/README.qmd | 4 ++-- pro/generate-documentation-qmd/README.md | 4 ++-- pro/generate-documentation-qmd/README.qmd | 4 ++-- project/build-target/README.md | 4 ++-- project/build-target/README.qmd | 4 ++-- project/build-target/action.yml | 6 +++--- project/check-concurrent-pr/README.md | 2 +- project/check-concurrent-pr/README.qmd | 2 +- project/detect-changed-components/README.md | 4 ++-- project/detect-changed-components/README.qmd | 4 ++-- project/update-docker-engine/README.md | 2 +- project/update-docker-engine/README.qmd | 2 +- setup/README.md | 6 +++--- setup/README.qmd | 6 +++--- 25 files changed, 53 insertions(+), 53 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 5ec5a72..e28fde1 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -15,7 +15,7 @@ on: jobs: test: - uses: viash-io/viash-actions/.github/workflows/test.yaml@v6 + uses: viash-io/viash-actions/.github/workflows/test.yaml@add-working-dir-input ``` ## Build components @@ -49,5 +49,5 @@ on: jobs: test: - uses: viash-io/viash-actions/.github/workflows/build.yaml@v6 + uses: viash-io/viash-actions/.github/workflows/build.yaml@add-working-dir-input ``` diff --git a/.github/workflows/README.qmd b/.github/workflows/README.qmd index b7058e1..7fdcfbb 100644 --- a/.github/workflows/README.qmd +++ b/.github/workflows/README.qmd @@ -17,7 +17,7 @@ on: jobs: test: - uses: viash-io/viash-actions/.github/workflows/test.yaml@v6 + uses: viash-io/viash-actions/.github/workflows/test.yaml@add-working-dir-input ``` @@ -52,5 +52,5 @@ on: jobs: test: - uses: viash-io/viash-actions/.github/workflows/build.yaml@v6 + uses: viash-io/viash-actions/.github/workflows/build.yaml@add-working-dir-input ``` diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 90a0adb..3a7850f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -51,7 +51,7 @@ jobs: fetch-depth: 0 - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: Determine variables id: variables @@ -78,7 +78,7 @@ jobs: echo "target_branch=$TARGET_BRANCH" >> $GITHUB_OUTPUT - - uses: viash-io/viash-actions/project/build-target@v6 + - uses: viash-io/viash-actions/project/build-target@add-working-dir-input id: build-target with: project_directory: ${{ inputs.project_directory }} @@ -116,7 +116,7 @@ jobs: submodules: 'recursive' ref: ${{ needs.target.outputs.target_branch }} - - uses: viash-io/viash-actions/setup@v6 + - uses: viash-io/viash-actions/setup@add-working-dir-input - name: Login to container registry uses: docker/login-action@v3 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 148890b..99e6e01 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -47,22 +47,22 @@ jobs: fetch-depth: 0 submodules: 'recursive' - - uses: viash-io/viash-actions/setup@v6 + - uses: viash-io/viash-actions/setup@add-working-dir-input - - uses: viash-io/viash-actions/project/sync-and-cache@v6 + - uses: viash-io/viash-actions/project/sync-and-cache@add-working-dir-input id: cache with: project_directory: ${{ inputs.project_directory }} - id: ns_list - uses: viash-io/viash-actions/ns-list@v6 + uses: viash-io/viash-actions/ns-list@add-working-dir-input with: project_directory: ${{ inputs.project_directory }} format: json runner: executable - id: ns_list_filter_changed - uses: viash-io/viash-actions/project/detect-changed-components@v6 + uses: viash-io/viash-actions/project/detect-changed-components@add-working-dir-input with: project_directory: ${{ inputs.project_directory }} input_file: "${{ steps.ns_list.outputs.output_file }}" @@ -98,7 +98,7 @@ jobs: fetch-depth: 0 - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input # use cache - name: Cache resources data diff --git a/ns-build/README.md b/ns-build/README.md index bc0b94d..c921f9c 100644 --- a/ns-build/README.md +++ b/ns-build/README.md @@ -80,8 +80,8 @@ jobs: uses: actions/checkout@v3 - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: viash ns build - uses: viash-io/viash-actions/ns-build@v6 + uses: viash-io/viash-actions/ns-build@add-working-dir-input ``` diff --git a/ns-build/README.qmd b/ns-build/README.qmd index 9626936..d7b92d7 100644 --- a/ns-build/README.qmd +++ b/ns-build/README.qmd @@ -63,9 +63,9 @@ jobs: uses: actions/checkout@v3 - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: `r action$name` - uses: viash-io/viash-actions/ns-build@v6 + uses: viash-io/viash-actions/ns-build@add-working-dir-input ``` diff --git a/ns-list/README.md b/ns-list/README.md index 9d13174..e8013cd 100644 --- a/ns-list/README.md +++ b/ns-list/README.md @@ -97,13 +97,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: Check out repository uses: actions/checkout@v3 - name: viash ns list - uses: viash-io/viash-actions/ns-list@v6 + uses: viash-io/viash-actions/ns-list@add-working-dir-input - name: View output run: | diff --git a/ns-list/README.qmd b/ns-list/README.qmd index 9f60ac6..7e1de93 100644 --- a/ns-list/README.qmd +++ b/ns-list/README.qmd @@ -65,13 +65,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: Check out repository uses: actions/checkout@v3 - name: `r action$name` - uses: viash-io/viash-actions/ns-list@v6 + uses: viash-io/viash-actions/ns-list@add-working-dir-input - name: View output run: | diff --git a/pro/build-nextflow-params/README.md b/pro/build-nextflow-params/README.md index bb8f67c..304ec0e 100644 --- a/pro/build-nextflow-params/README.md +++ b/pro/build-nextflow-params/README.md @@ -34,13 +34,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: Check out repository uses: actions/checkout@v3 - name: Build parameter yaml examples for Viash components - uses: viash-io/viash-actions/pro/build-nextflow-params@v6 + uses: viash-io/viash-actions/pro/build-nextflow-params@add-working-dir-input with: target: target/ token: ${{ secrets.VIASH_PRO_TOKEN }} diff --git a/pro/build-nextflow-params/README.qmd b/pro/build-nextflow-params/README.qmd index e2f1f0a..58012be 100644 --- a/pro/build-nextflow-params/README.qmd +++ b/pro/build-nextflow-params/README.qmd @@ -58,13 +58,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: Check out repository uses: actions/checkout@v3 - name: `r action$name` - uses: viash-io/viash-actions/pro/build-nextflow-params@v6 + uses: viash-io/viash-actions/pro/build-nextflow-params@add-working-dir-input with: target: target/ token: ${{ secrets.VIASH_PRO_TOKEN }} diff --git a/pro/build-nextflow-schemas/README.md b/pro/build-nextflow-schemas/README.md index 725d169..d559045 100644 --- a/pro/build-nextflow-schemas/README.md +++ b/pro/build-nextflow-schemas/README.md @@ -36,13 +36,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: Check out repository uses: actions/checkout@v3 - name: Build nf-tower schemas for Viash components - uses: viash-io/viash-actions/pro/build-nextflow-schemas@v6 + uses: viash-io/viash-actions/pro/build-nextflow-schemas@add-working-dir-input with: target: target/ token: ${{ secrets.VIASH_PRO_TOKEN }} diff --git a/pro/build-nextflow-schemas/README.qmd b/pro/build-nextflow-schemas/README.qmd index e89b88e..33f8fdf 100644 --- a/pro/build-nextflow-schemas/README.qmd +++ b/pro/build-nextflow-schemas/README.qmd @@ -58,13 +58,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: Check out repository uses: actions/checkout@v3 - name: `r action$name` - uses: viash-io/viash-actions/pro/build-nextflow-schemas@v6 + uses: viash-io/viash-actions/pro/build-nextflow-schemas@add-working-dir-input with: target: target/ token: ${{ secrets.VIASH_PRO_TOKEN }} diff --git a/pro/generate-documentation-qmd/README.md b/pro/generate-documentation-qmd/README.md index f77c71b..d91c763 100644 --- a/pro/generate-documentation-qmd/README.md +++ b/pro/generate-documentation-qmd/README.md @@ -68,7 +68,7 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: Check out repository uses: actions/checkout@v3 @@ -76,7 +76,7 @@ jobs: path: project - name: Build quarto markdown documentation files for Viash components - uses: viash-io/viash-actions/generate-documentation-qmd@v6 + uses: viash-io/viash-actions/generate-documentation-qmd@add-working-dir-input with: project_dir: project src: src diff --git a/pro/generate-documentation-qmd/README.qmd b/pro/generate-documentation-qmd/README.qmd index aa09f92..040ff86 100644 --- a/pro/generate-documentation-qmd/README.qmd +++ b/pro/generate-documentation-qmd/README.qmd @@ -58,7 +58,7 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: Check out repository uses: actions/checkout@v3 @@ -66,7 +66,7 @@ jobs: path: project - name: `r action$name` - uses: viash-io/viash-actions/generate-documentation-qmd@v6 + uses: viash-io/viash-actions/generate-documentation-qmd@add-working-dir-input with: project_dir: project src: src diff --git a/project/build-target/README.md b/project/build-target/README.md index 4a4ed23..8408225 100644 --- a/project/build-target/README.md +++ b/project/build-target/README.md @@ -44,11 +44,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: Build target directory id: build_target - uses: viash-io/viash-actions/build-target@v6 + uses: viash-io/viash-actions/build-target@add-working-dir-input - name: Check output run: | diff --git a/project/build-target/README.qmd b/project/build-target/README.qmd index 0e118b0..b4ced14 100644 --- a/project/build-target/README.qmd +++ b/project/build-target/README.qmd @@ -55,11 +55,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: viash-io/viash-actions/setup@v6 + uses: viash-io/viash-actions/setup@add-working-dir-input - name: `r action$name` id: build_target - uses: viash-io/viash-actions/build-target@v6 + uses: viash-io/viash-actions/build-target@add-working-dir-input - name: Check output run: | diff --git a/project/build-target/action.yml b/project/build-target/action.yml index a45a1a7..ba8db1d 100644 --- a/project/build-target/action.yml +++ b/project/build-target/action.yml @@ -80,7 +80,7 @@ runs: run: | yq eval '.version = "${{ steps.defaults.outputs.version }}"' -i _viash.yaml - - uses: viash-io/viash-actions/ns-build@v6 + - uses: viash-io/viash-actions/ns-build@add-working-dir-input with: parallel: true config_mod: ${{ steps.defaults.outputs.config_mod }} @@ -88,7 +88,7 @@ runs: - name: Build nextflow schemas if: ${{ inputs.viash_pro_token != '' }} - uses: viash-io/viash-actions/pro/build-nextflow-params@v6 + uses: viash-io/viash-actions/pro/build-nextflow-params@add-working-dir-input with: target_dir: ${{ inputs.project_directory }}/${{ steps.defaults.outputs.target_dir }} viash_pro_token: ${{ inputs.viash_pro_token }} @@ -97,7 +97,7 @@ runs: - name: Build parameter files if: ${{ inputs.viash_pro_token != '' }} - uses: viash-io/viash-actions/pro/build-nextflow-params@v6 + uses: viash-io/viash-actions/pro/build-nextflow-params@add-working-dir-input with: target_dir: ${{ inputs.project_directory }}/${{ steps.defaults.outputs.target_dir }} viash_pro_token: ${{ inputs.viash_pro_token }} diff --git a/project/check-concurrent-pr/README.md b/project/check-concurrent-pr/README.md index a318c0f..6421eaf 100644 --- a/project/check-concurrent-pr/README.md +++ b/project/check-concurrent-pr/README.md @@ -42,7 +42,7 @@ jobs: uses: actions/checkout@v3 - name: Check for concurrent PRs - uses: viash-io/viash-actions/is-pr@v6 + uses: viash-io/viash-actions/is-pr@add-working-dir-input id: is_pr - run: | diff --git a/project/check-concurrent-pr/README.qmd b/project/check-concurrent-pr/README.qmd index f86e30e..a25f930 100644 --- a/project/check-concurrent-pr/README.qmd +++ b/project/check-concurrent-pr/README.qmd @@ -58,7 +58,7 @@ jobs: uses: actions/checkout@v3 - name: `r action$name` - uses: viash-io/viash-actions/is-pr@v6 + uses: viash-io/viash-actions/is-pr@add-working-dir-input id: is_pr - run: | diff --git a/project/detect-changed-components/README.md b/project/detect-changed-components/README.md index a35e5bf..66ef0ca 100644 --- a/project/detect-changed-components/README.md +++ b/project/detect-changed-components/README.md @@ -53,13 +53,13 @@ jobs: - uses: actions/checkout@v3 - id: ns_list - uses: viash-io/viash-actions/ns-list@v6 + uses: viash-io/viash-actions/ns-list@add-working-dir-input with: format: json - name: Detect components with changed files id: ns_list_changed - uses: viash-io/viash-actions/detect-changed-components@v6 + uses: viash-io/viash-actions/detect-changed-components@add-working-dir-input with: input_file: ${{ steps.ns_list.outputs.output_file }} ``` diff --git a/project/detect-changed-components/README.qmd b/project/detect-changed-components/README.qmd index cf75b2a..4a950bf 100644 --- a/project/detect-changed-components/README.qmd +++ b/project/detect-changed-components/README.qmd @@ -57,13 +57,13 @@ jobs: - uses: actions/checkout@v3 - id: ns_list - uses: viash-io/viash-actions/ns-list@v6 + uses: viash-io/viash-actions/ns-list@add-working-dir-input with: format: json - name: `r action$name` id: ns_list_changed - uses: viash-io/viash-actions/detect-changed-components@v6 + uses: viash-io/viash-actions/detect-changed-components@add-working-dir-input with: input_file: ${{ steps.ns_list.outputs.output_file }} ``` diff --git a/project/update-docker-engine/README.md b/project/update-docker-engine/README.md index ebdc28a..17795bc 100644 --- a/project/update-docker-engine/README.md +++ b/project/update-docker-engine/README.md @@ -32,5 +32,5 @@ jobs: uses: actions/checkout@v3 - name: Update Docker Engine - uses: viash-io/viash-actions/project/update-docker-engine@v6 + uses: viash-io/viash-actions/project/update-docker-engine@add-working-dir-input ``` diff --git a/project/update-docker-engine/README.qmd b/project/update-docker-engine/README.qmd index 6dc9829..85b9e9f 100644 --- a/project/update-docker-engine/README.qmd +++ b/project/update-docker-engine/README.qmd @@ -58,6 +58,6 @@ jobs: uses: actions/checkout@v3 - name: `r action$name` - uses: viash-io/viash-actions/project/update-docker-engine@v6 + uses: viash-io/viash-actions/project/update-docker-engine@add-working-dir-input ``` diff --git a/setup/README.md b/setup/README.md index 4536ebf..202a020 100644 --- a/setup/README.md +++ b/setup/README.md @@ -33,19 +33,19 @@ jobs: viash-linux: runs-on: ubuntu-latest steps: - - uses: viash-io/viash-actions/setup@v6 + - uses: viash-io/viash-actions/setup@add-working-dir-input - run: | viash --version viash-windows: runs-on: windows-latest steps: - - uses: viash-io/viash-actions/setup@v6 + - uses: viash-io/viash-actions/setup@add-working-dir-input - run: | viash --version viash-macos: runs-on: macos-latest steps: - - uses: viash-io/viash-actions/setup@v6 + - uses: viash-io/viash-actions/setup@add-working-dir-input - run: | viash --version ``` diff --git a/setup/README.qmd b/setup/README.qmd index a29c416..c841e8e 100644 --- a/setup/README.qmd +++ b/setup/README.qmd @@ -54,19 +54,19 @@ jobs: viash-linux: runs-on: ubuntu-latest steps: - - uses: viash-io/viash-actions/setup@v6 + - uses: viash-io/viash-actions/setup@add-working-dir-input - run: | viash --version viash-windows: runs-on: windows-latest steps: - - uses: viash-io/viash-actions/setup@v6 + - uses: viash-io/viash-actions/setup@add-working-dir-input - run: | viash --version viash-macos: runs-on: macos-latest steps: - - uses: viash-io/viash-actions/setup@v6 + - uses: viash-io/viash-actions/setup@add-working-dir-input - run: | viash --version ``` From ad7f25e3154fd177f4355bd2c6d61017fddd5b8c Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Wed, 21 Aug 2024 23:04:50 +0200 Subject: [PATCH 03/12] fix ci --- project/sync-and-cache/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/project/sync-and-cache/action.yml b/project/sync-and-cache/action.yml index 86116c0..3b7373f 100644 --- a/project/sync-and-cache/action.yml +++ b/project/sync-and-cache/action.yml @@ -134,7 +134,6 @@ runs: # initialize cache - name: Cache resources uses: actions/cache@v4 - working-directory: ${{ inputs.project_directory }} if: ${{ steps.cache_key.outputs.cache_key != '' }} with: path: ${{ steps.test_resources.outputs.dest_paths }} From 75673fe0dd223076c8ca3de5b9d27527e1f8f55c Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Wed, 21 Aug 2024 23:07:46 +0200 Subject: [PATCH 04/12] fix action --- project/detect-changed-components/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/detect-changed-components/action.yml b/project/detect-changed-components/action.yml index ae7c27c..6c5016a 100644 --- a/project/detect-changed-components/action.yml +++ b/project/detect-changed-components/action.yml @@ -43,8 +43,8 @@ runs: - name: Get changed files id: changed-files uses: tj-actions/changed-files@v44 - working-directory: ${{ inputs.project_directory }} with: + path: ${{ inputs.project_directory }} separator: "," diff_relative: true From e7260b76883c69eb24684d770ed7b90d6cd456c7 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Thu, 22 Aug 2024 16:59:12 +0200 Subject: [PATCH 05/12] make test_resources absolute for downstream cache action --- project/sync-and-cache/action.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/project/sync-and-cache/action.yml b/project/sync-and-cache/action.yml index 3b7373f..8f2ce5a 100644 --- a/project/sync-and-cache/action.yml +++ b/project/sync-and-cache/action.yml @@ -43,7 +43,7 @@ runs: shell: bash working-directory: ${{ inputs.project_directory }} run: | - resources_detected=$(yq e '.info | has("test_resources")' "${{ inputs.project_config }}") + resources_detected=$(yq e '.info | has("test_resources")' "_viash.yaml") if [ "$resources_detected" == "false" ]; then echo "No test resources detected." echo "dest_paths=" >> $GITHUB_OUTPUT @@ -54,12 +54,13 @@ runs: test_resources=$( yq e \ '.info.test_resources[] | "{type: " + (.type // "s3") + ", path: " + .path + ", dest: " + .dest + "}"' \ - "${{ inputs.project_config }}" + "_viash.yaml" ) # fetch the test resource destination paths + # todo: convert to absolute paths dest_paths=$( - yq e '.info.test_resources[] | "${{inputs.project_directory}}/" + .dest' "${{ inputs.project_config }}" + yq e '.info.test_resources[] | .dest' "_viash.yaml" | sed "s#.*#$(pwd)/&#" ) # output multiline string From 07b0a41a6d5fda0ef5f554070c4d6d2b9aa6aa81 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Fri, 23 Aug 2024 07:41:40 +0200 Subject: [PATCH 06/12] fix bug --- CHANGELOG.md | 15 +++++++++++++++ project/build-target/action.yml | 8 +++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf3f082..a597e43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# viash-acitons v6.6.0 + +## New functionality + +* Many actions: Add input `project_directory` to allow specifying the project directory (PR #42): + - `ns-build` + - `ns-list` + - `project/build-target` + - `project/detect-changed-components` + - `project/sync-and-cache` + +## Bug fixes + +* `project/build-target`: Do not throw an error if there is no `.gitignore` in place (PR #42). + # viash-actions v6.5.0 ## New functionality diff --git a/project/build-target/action.yml b/project/build-target/action.yml index ba8db1d..0883516 100644 --- a/project/build-target/action.yml +++ b/project/build-target/action.yml @@ -72,7 +72,13 @@ runs: working-directory: ${{ inputs.project_directory }} run: | TARGET_DIR="${{ steps.defaults.outputs.target_dir }}" - sed -i "/^\\/*${TARGET_DIR}.*/d" .gitignore + if [ -f .gitignore ]; then + sed -i "/^\\/*${TARGET_DIR}.*/d" .gitignore + fi + if [ -f "$TARGET_DIR/.gitignore" ]; then + # just remove it + rm "$TARGET_DIR/.gitignore" + fi - name: Set version in _viash.yaml shell: bash From 1411351f8607147865435aa9273509488d2b5e06 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Fri, 23 Aug 2024 08:33:31 +0200 Subject: [PATCH 07/12] If Viash throws an error, make sure that the error message gets printed --- CHANGELOG.md | 2 + ns-build/index.js | 97 ++++++++++++----------- ns-list/index.js | 192 +++++++++++++++++++++++----------------------- 3 files changed, 152 insertions(+), 139 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a597e43..6d69943 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ * `project/build-target`: Do not throw an error if there is no `.gitignore` in place (PR #42). +* `ns-build`, `ns-list`: If Viash throws an error, make sure that the error message gets printed (PR #42). + # viash-actions v6.5.0 ## New functionality diff --git a/ns-build/index.js b/ns-build/index.js index 6bc34e5..c0fc8d2 100644 --- a/ns-build/index.js +++ b/ns-build/index.js @@ -2,59 +2,68 @@ const core = require("@actions/core"); const exec = require("@actions/exec"); async function run() { - try { - // set up listeners - let myOutput = ""; - let myError = ""; + // set up listeners + let myOutput = ""; + let myError = ""; - const options = {}; - options.listeners = { - stdout: (data) => { - myOutput += data.toString(); - }, - stderr: (data) => { - myError += data.toString(); - } - }; + const options = {}; + options.listeners = { + stdout: (data) => { + myOutput += data.toString(); + core.info(data.toString()); + }, + stderr: (data) => { + myError += data.toString(); + core.error(data.toString()); + } + }; - // fetch arguments for command - // skip "parallel" - // todo: can I extract these inputNames from the action.yml? - const inputNames = [ - "query", "query_namespace", "query_name", "src", "platform", - "runner", "engine", "parallel", "config_mod", "target", "setup" - ] - const booleanInputs = ["parallel"] - const multilineInputs = ["config_mod"] - const inputArgs = inputNames.flatMap(function(argName) { - const value = core.getInput(argName) - if (value == "") { - return []; - } else if (booleanInputs.indexOf(argName) >= 0) { - if (value.toLowerCase() == "true") { - return ["--" + argName]; - } else { - return []; - } - } else if (multilineInputs.indexOf(argName) >= 0) { - const values = core.getMultilineInput(argName) - return values.flatMap(function(value) { - return ["--" + argName, value]; - }) + // set up workdir + const workdir = core.getInput("project_directory"); + if (workdir) { + options.cwd = workdir; + } + + // fetch arguments for command + // skip "parallel" + // todo: can I extract these inputNames from the action.yml? + const inputNames = [ + "query", "query_namespace", "query_name", "config", "src", "runner", "engine", + "platform", "parallel", "config_mod", "target", "setup" + ] + const booleanInputs = ["parallel"] + const multilineInputs = ["config_mod"] + const inputArgs = inputNames.flatMap(function(argName) { + const value = core.getInput(argName) + if (value == "") { + return []; + } else if (booleanInputs.indexOf(argName) >= 0) { + if (value.toLowerCase() == "true") { + return ["--" + argName]; } else { - return ["--" + argName, value]; + return []; } - }) - let args = ["ns", "build"].concat(inputArgs); + } else if (multilineInputs.indexOf(argName) >= 0) { + const values = core.getMultilineInput(argName) + return values.flatMap(function(value) { + return ["--" + argName, value]; + }) + } else { + return ["--" + argName, value]; + } + }) + let args = ["ns", "build"].concat(inputArgs); // run command + try { await exec.exec("viash", args, options); - - // pass output - core.setOutput("output", myOutput); } catch (error) { - core.setFailed(error.message); + core.setFailed(myError); + return; } + + // pass output + core.setOutput("output", myOutput); } run(); \ No newline at end of file diff --git a/ns-list/index.js b/ns-list/index.js index a6191f4..e912ee3 100644 --- a/ns-list/index.js +++ b/ns-list/index.js @@ -4,113 +4,115 @@ const fs = require('fs'); const path = require('path'); async function run() { - try { - // set up listeners for 'ns list' - let myOutput = ""; - let myError = ""; - - const options = {}; - options.listeners = { - stdout: (data) => { - myOutput += data.toString(); - }, - stderr: (data) => { - myError += data.toString(); - } - }; - options.silent = true; + // set up listeners for 'ns list' + let myOutput = ""; + let myError = ""; - // set up workdir - const workdir = core.getInput("project_directory"); - if (workdir) { - options.cwd = workdir; + const options = {}; + options.listeners = { + stdout: (data) => { + myOutput += data.toString(); + core.info(data.toString()); + }, + stderr: (data) => { + myError += data.toString(); + core.error(data.toString()); } + }; + options.silent = true; - // fetch arguments for command - // skip "parallel" - // todo: can I extract these inputNames from the action.yml? - const inputNames = [ - "query", "query_namespace", "query_name", "src", "runner", "engine", - "platform", "config_mod", "format", "parse_argument_groups" - ] - const booleanInputs = ["parse_argument_groups"] - const multilineInputs = ["config_mod"] - const inputArgs = inputNames.flatMap(function(argName) { - const value = core.getInput(argName) - if (value == "") { - return []; - } else if (booleanInputs.indexOf(argName) >= 0) { - if (value.toLowerCase() == "true") { - return ["--" + argName]; - } else { - return []; - } - } else if (multilineInputs.indexOf(argName) >= 0) { - const values = core.getMultilineInput(argName) - return values.flatMap(function(value) { - return ["--" + argName, value]; - }) + // set up workdir + const workdir = core.getInput("project_directory"); + if (workdir) { + options.cwd = workdir; + } + + // fetch arguments for command + // skip "parallel" + // todo: can I extract these inputNames from the action.yml? + const inputNames = [ + "query", "query_namespace", "query_name", "config", "src", "runner", + "engine", "platform", "config_mod", "format", "parse_argument_groups" + ] + const booleanInputs = ["parse_argument_groups"] + const multilineInputs = ["config_mod"] + const inputArgs = inputNames.flatMap(function(argName) { + const value = core.getInput(argName) + if (value == "") { + return []; + } else if (booleanInputs.indexOf(argName) >= 0) { + if (value.toLowerCase() == "true") { + return ["--" + argName]; } else { - return ["--" + argName, value]; + return []; } - }) - let args = ["ns", "list"].concat(inputArgs); + } else if (multilineInputs.indexOf(argName) >= 0) { + const values = core.getMultilineInput(argName) + return values.flatMap(function(value) { + return ["--" + argName, value]; + }) + } else { + return ["--" + argName, value]; + } + }) + let args = ["ns", "list"].concat(inputArgs); - // run command + try { await exec.exec("viash", args, options); - - // set output for output_file - const output_file = core.getInput("output_file"); - const extension = "." + core.getInput("format"); - const to_write_to = output_file ? output_file : path.join(process.env.RUNNER_TEMP, Date.now().toString() + extension); - fs.writeFile(to_write_to, myOutput, { flag: 'wx' }, err => { - if (err) {throw err;} - }) - core.setOutput("output_file", to_write_to) + } catch (error) { + core.setFailed(myError); + return; + } - // pass output - core.setOutput("output", myOutput); + // set output for output_file + const output_file = core.getInput("output_file"); + const extension = "." + core.getInput("format"); + const to_write_to = output_file ? output_file : path.join(process.env.RUNNER_TEMP, Date.now().toString() + extension); + fs.writeFile(to_write_to, myOutput, { flag: 'wx' }, err => { + if (err) {throw err;} + }) + core.setOutput("output_file", to_write_to) - // parse json in myOutput - let components = [] - if (core.getInput("format") == "json") { - components = JSON.parse(myOutput); - } else if (core.getInput("format") == "yaml") { - const yaml = require('js-yaml'); - components = yaml.load(myOutput); - } + // pass output + core.setOutput("output", myOutput); - // turn into matrix - const matrix = components.map(function(component) { - const comp_name = component?.name ?? component?.functionality?.name - const comp_namespace = component?.namespace ?? component?.functionality?.namespace - const comp_fullname = comp_namespace ? comp_namespace + "/" + comp_name : comp_name - const comp_config = component?.build_info?.config ?? component?.info?.config - const comp_dir = comp_config ? path.dirname(comp_config) : undefined - const resources = component?.resources ?? component?.functionality?.resources - const comp_main_script_type = resources ? resources[0]?.type : undefined - // todo: if component has a test_resource with a nextflow_script, get the entrypoint? - return { - name: comp_name, - namespace: comp_namespace, - full_name: comp_fullname, - config: comp_config, - dir: comp_dir, - main_script_type: comp_main_script_type - } - }) - // return matrix as json - let matrix_str; - if (core.getInput("format") == "json") { - matrix_str = JSON.stringify(matrix); - } else if (core.getInput("format") == "yaml") { - const yaml = require('js-yaml'); - matrix_str = yaml.dump(matrix); + // parse json in myOutput + let components = [] + if (core.getInput("format") == "json") { + components = JSON.parse(myOutput); + } else if (core.getInput("format") == "yaml") { + const yaml = require('js-yaml'); + components = yaml.load(myOutput); + } + + // turn into matrix + const matrix = components.map(function(component) { + const comp_name = component?.name ?? component?.functionality?.name + const comp_namespace = component?.namespace ?? component?.functionality?.namespace + const comp_fullname = comp_namespace ? comp_namespace + "/" + comp_name : comp_name + const comp_config = component?.build_info?.config ?? component?.info?.config + const comp_dir = comp_config ? path.dirname(comp_config) : undefined + const resources = component?.resources ?? component?.functionality?.resources + const comp_main_script_type = resources ? resources[0]?.type : undefined + // todo: if component has a test_resource with a nextflow_script, get the entrypoint? + return { + name: comp_name, + namespace: comp_namespace, + full_name: comp_fullname, + config: comp_config, + dir: comp_dir, + main_script_type: comp_main_script_type } - core.setOutput("output_matrix", matrix_str); - } catch (error) { - core.setFailed(error.message); + }) + // return matrix as json + let matrix_str; + if (core.getInput("format") == "json") { + matrix_str = JSON.stringify(matrix); + } else if (core.getInput("format") == "yaml") { + const yaml = require('js-yaml'); + matrix_str = yaml.dump(matrix); } + core.setOutput("output_matrix", matrix_str); } run(); \ No newline at end of file From adc839dff113c6a70cd8697d16e68f6fe7e25c13 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Fri, 23 Aug 2024 09:56:39 +0200 Subject: [PATCH 08/12] Fix the action not listening to 'ci force' in commit messages --- CHANGELOG.md | 4 +- project/detect-changed-components/README.md | 5 + project/detect-changed-components/action.yml | 309 ++++++++++--------- 3 files changed, 172 insertions(+), 146 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d69943..d581154 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# viash-acitons v6.6.0 +# viash-actions v6.6.0 ## New functionality @@ -15,6 +15,8 @@ * `ns-build`, `ns-list`: If Viash throws an error, make sure that the error message gets printed (PR #42). +* `project/detect-changed-components`: Fix the action not listening to 'ci force' in commit messages (PR #42). + # viash-actions v6.5.0 ## New functionality diff --git a/project/detect-changed-components/README.md b/project/detect-changed-components/README.md index 66ef0ca..b790c6d 100644 --- a/project/detect-changed-components/README.md +++ b/project/detect-changed-components/README.md @@ -10,6 +10,11 @@ This README was generated by running `make` Filter a json file produced by viash ns list on whether the component has been changed with respect to the default branch. +The action will simply return the contents of the input file if: + +- The current branch is the default branch +- The event is a pull request and the commit message contains ‘ci force’ + ### Inputs - `project_directory`: - *optional*. Path to the project directory. This diff --git a/project/detect-changed-components/action.yml b/project/detect-changed-components/action.yml index 6c5016a..e444cf5 100644 --- a/project/detect-changed-components/action.yml +++ b/project/detect-changed-components/action.yml @@ -1,9 +1,14 @@ name: Detect components with changed files author: Data Intuitive -description: > +description: | Filter a json file produced by viash ns list on whether the component has been changed with respect to the default branch. + + The action will simply return the contents of the input file if: + + - The current branch is the default branch + - The event is a pull request and the commit message contains 'ci force' inputs: project_directory: required: false @@ -32,160 +37,174 @@ outputs: runs: using: 'composite' steps: - - name: Get head git commit message - shell: bash - id: get_head_commit_message - working-directory: ${{ inputs.project_directory }} - run: | - head_commit_message=$(git show -s --format=%s ${{ github.event.pull_request.head.sha || github.sha }}) - echo "HEAD_COMMIT_MESSAGE=$head_commit_message" >> "$GITHUB_OUTPUT" + - name: Decide whether to detect changed components or just return all components + shell: bash + id: detect_changed + working-directory: ${{ inputs.project_directory }} + run: | + # if the commit message contains 'ci force' or the branch is the default branch, detect changed components + if [[ ${{ github.ref }} == 'refs/heads/${{ github.event.repository.default_branch }}' ]]; then + echo "Current branch is the default branch." + echo "detect_changed=true" >> $GITHUB_OUTPUT + exit 0 + fi + if [[ ${{ github.event_name }} == 'pull_request' ]]; then + head_sha="${{(github.event.pull_request.head.sha)}}" + commit_msg=$(git log --format=%B -n 1 $head_sha) + if [[ $commit_msg == *"ci force"* ]]; then + echo "PR commit message contains 'ci force'." + echo "detect_changed=true" >> $GITHUB_OUTPUT + exit 0 + fi + fi - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v44 - with: - path: ${{ inputs.project_directory }} - separator: "," - diff_relative: true + echo "detect_changed=false" >> $GITHUB_OUTPUT - # Note: a component's resources is detected using a jq statement. - # Example usage of the jq statement: - # - # Input: - # functionality: - # resources: - # - type: python_script - # path: script.py - # parent: file:/home/rcannood/workspace/openproblems/openproblems-v2/src/label_projection/methods/knn/config.vsh.yaml - # - type: file - # path: file.txt - # parent: file:///home/rcannood/workspace/openproblems/openproblems-v2/ - # - type: "file" - # path: "resources_test/label_projection/pancreas" - # parent: "file:///home/rcannood/workspace/openproblems/openproblems-v2/" - # test_resources: - # - type: "file" - # path: "LICENSE" - # parent: "file:///home/rcannood/workspace/openproblems/openproblems-v2/" - # - type: "file" - # text: "content" - # dest: "foo.txt" - # info: - # config: /home/rcannood/workspace/openproblems/openproblems-v2/src/label_projection/methods/knn/config.vsh.yaml - # - # Output: - # /home/rcannood/workspace/openproblems/openproblems-v2/src/label_projection/methods/knn/config.vsh.yaml - # /home/rcannood/workspace/openproblems/openproblems-v2/src/label_projection/methods/knn/script.py - # /home/rcannood/workspace/openproblems/openproblems-v2/file.txt - # /home/rcannood/workspace/openproblems/openproblems-v2/resources_test/label_projection/pancreas - # /home/rcannood/workspace/openproblems/openproblems-v2/LICENSE - - name: Set matrix to only run tests for components that had their config or resources changed. - id: filter - shell: bash - working-directory: ${{ inputs.project_directory }} - run: | - # create output path - output_file=$(mktemp $RUNNER_TEMP/viash_ns_changed_files.XXXXXX.json) + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v44 + with: + path: ${{ inputs.project_directory }} + separator: "," + diff_relative: true - if [[ "$GITHUB_REF" == "refs/heads/${{ github.event.repository.default_branch }}" || "${{ contains(github.event.head_commit.message, 'ci force') }}" == "true" ]]; then - cp "${{ inputs.input_file }}" "$output_file" - echo "output_file=$output_file" >> $GITHUB_OUTPUT - exit 0 - fi + # Note: a component's resources is detected using a jq statement. + # Example usage of the jq statement: + # + # Input: + # functionality: + # resources: + # - type: python_script + # path: script.py + # parent: file:/home/rcannood/workspace/openproblems/openproblems-v2/src/label_projection/methods/knn/config.vsh.yaml + # - type: file + # path: file.txt + # parent: file:///home/rcannood/workspace/openproblems/openproblems-v2/ + # - type: "file" + # path: "resources_test/label_projection/pancreas" + # parent: "file:///home/rcannood/workspace/openproblems/openproblems-v2/" + # test_resources: + # - type: "file" + # path: "LICENSE" + # parent: "file:///home/rcannood/workspace/openproblems/openproblems-v2/" + # - type: "file" + # text: "content" + # dest: "foo.txt" + # info: + # config: /home/rcannood/workspace/openproblems/openproblems-v2/src/label_projection/methods/knn/config.vsh.yaml + # + # Output: + # /home/rcannood/workspace/openproblems/openproblems-v2/src/label_projection/methods/knn/config.vsh.yaml + # /home/rcannood/workspace/openproblems/openproblems-v2/src/label_projection/methods/knn/script.py + # /home/rcannood/workspace/openproblems/openproblems-v2/file.txt + # /home/rcannood/workspace/openproblems/openproblems-v2/resources_test/label_projection/pancreas + # /home/rcannood/workspace/openproblems/openproblems-v2/LICENSE + - name: Set matrix to only run tests for components that had their config or resources changed. + id: filter + shell: bash + working-directory: ${{ inputs.project_directory }} + run: | + # create output path + output_file=$(mktemp $RUNNER_TEMP/viash_ns_changed_files.XXXXXX.json) - # create output array - declare -a output_array=() + if [[ "${{steps.detect_changed.outputs.detect_changed}}" == "false" ]]; then + cp "${{ inputs.input_file }}" "$output_file" + echo "output_file=$output_file" >> $GITHUB_OUTPUT + exit 0 + fi - # The output from changed-files is delimited by , - # also remove newline if any - IFS=$',' read -a changed_files <<< "${{ steps.changed-files.outputs.all_changed_files }}" + # create output array + declare -a output_array=() - # read components as array - readarray -t components < <(jq -c '.[]' "${{ inputs.input_file }}") + # The output from changed-files is delimited by , + # also remove newline if any + IFS=$',' read -a changed_files <<< "${{ steps.changed-files.outputs.all_changed_files }}" - # iterate over the components - for component in "${components[@]}"; do - config_path=$(jq -cr '.build_info.config // .info.config' <<< "$component" ) - config_dir=`dirname "$config_path"` - echo "Checking '$config_path'" + # read components as array + readarray -t components < <(jq -c '.[]' "${{ inputs.input_file }}") - # get the components resources - readarray -t resources < <( - jq -cr ' - ( - # viash config - [.build_info.config // (.info.config)] + - # viash >= 0.9 resources - [ - ((.resources // []) + (.test_resources // []))[] - | .path - | sub("^(?[^/])"; "'$config_dir'/" + .match) - | sub("^/"; "") - ] + - # viash < 0.9 resources - [ - (.functionality.resources // [])[], (.functionality.test_resources // [])[] - | select(.path and .parent) - | (.parent | sub("^file:(//)?"; "") | sub("/[^/]*$"; "")) + "/" + .path - ] - )[] - ' <<< "$component" - ) - - # check if resource is in the list of changed resources - should_add_component=0 - for resource in "${resources[@]}"; do - echo "Checking resource: $resource" - if [ ! -e "$resource" ]; then - echo "Resource $resource does not exist." - exit 1 - fi - # resolve paths wrt current dir (only needed for viash < 0.9) - resource_real_path=$(realpath "$resource") - resource_arr=("$resource_real_path") - # Resolve resources that are a directory into files - if [ -d "$resource_real_path" ]; then - echo "Resource is a directory" - files_from_directories=() - readarray -d '' files_from_directories < <(find $resource_real_path -type f -print0) - resource_arr+=(${files_from_directories[@]}) - fi - echo "All resources including files from directories: ${resource_arr[@]}" - for changed_file in ${changed_files[@]}; do - changed_file_real_path="$(pwd)/${changed_file}" - for resource_to_check in ${resource_arr[@]}; do - if [ "$changed_file_real_path" = "$resource_to_check" ]; then - echo "Detected changed component!" - should_add_component=1 - break - fi + # iterate over the components + for component in "${components[@]}"; do + config_path=$(jq -cr '.build_info.config // .info.config' <<< "$component" ) + config_dir=`dirname "$config_path"` + echo "Checking '$config_path'" + + # get the components resources + readarray -t resources < <( + jq -cr ' + ( + # viash config + [.build_info.config // (.info.config)] + + # viash >= 0.9 resources + [ + ((.resources // []) + (.test_resources // []))[] + | .path + | sub("^(?[^/])"; "'$config_dir'/" + .match) + | sub("^/"; "") + ] + + # viash < 0.9 resources + [ + (.functionality.resources // [])[], (.functionality.test_resources // [])[] + | select(.path and .parent) + | (.parent | sub("^file:(//)?"; "") | sub("/[^/]*$"; "")) + "/" + .path + ] + )[] + ' <<< "$component" + ) + + # check if resource is in the list of changed resources + should_add_component=0 + for resource in "${resources[@]}"; do + echo "Checking resource: $resource" + if [ ! -e "$resource" ]; then + echo "Resource $resource does not exist." + exit 1 + fi + # resolve paths wrt current dir (only needed for viash < 0.9) + resource_real_path=$(realpath "$resource") + resource_arr=("$resource_real_path") + # Resolve resources that are a directory into files + if [ -d "$resource_real_path" ]; then + echo "Resource is a directory" + files_from_directories=() + readarray -d '' files_from_directories < <(find $resource_real_path -type f -print0) + resource_arr+=(${files_from_directories[@]}) + fi + echo "All resources including files from directories: ${resource_arr[@]}" + for changed_file in ${changed_files[@]}; do + changed_file_real_path="$(pwd)/${changed_file}" + for resource_to_check in ${resource_arr[@]}; do + if [ "$changed_file_real_path" = "$resource_to_check" ]; then + echo "Detected changed component!" + should_add_component=1 + break + fi + done done done + if [[ "$should_add_component" -eq 1 ]]; then + output_array+="$component" + fi done - if [[ "$should_add_component" -eq 1 ]]; then - output_array+="$component" - fi - done - # reformat as json and write to file - jq -cs '.' <<< "${output_array[*]}" > "$output_file" - echo "output_file=$output_file" >> $GITHUB_OUTPUT + # reformat as json and write to file + jq -cs '.' <<< "${output_array[*]}" > "$output_file" + echo "output_file=$output_file" >> $GITHUB_OUTPUT - - id: set_matrix - shell: bash - working-directory: ${{ inputs.project_directory }} - run: | - comp_file="${{ contains(steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE, 'ci force') && inputs.input_file || steps.filter.outputs.output_file }}" - matrix=$( - jq -c '[ .[] | - { - "name": (.name // .functionality.name), - "namespace": (.namespace // .functionality.namespace // ""), - "config": (.build_info.config // .info.config), - "dir": (.build_info.config // .info.config) | capture("^(?.*\/)").dir, - "main_script_type": (.resources // .functionality.resources)[0].type - } | - .full_name = if .namespace == "" then .name else .namespace + "/" + .name end - ]' $comp_file - ) - echo "matrix=$matrix" >> $GITHUB_OUTPUT + - id: set_matrix + shell: bash + working-directory: ${{ inputs.project_directory }} + run: | + matrix=$( + jq -c '[ .[] | + { + "name": (.name // .functionality.name), + "namespace": (.namespace // .functionality.namespace // ""), + "config": (.build_info.config // .info.config), + "dir": (.build_info.config // .info.config) | capture("^(?.*\/)").dir, + "main_script_type": (.resources // .functionality.resources)[0].type + } | + .full_name = if .namespace == "" then .name else .namespace + "/" + .name end + ]' "${{steps.filter.outputs.output_file }}" + ) + echo "matrix=$matrix" >> $GITHUB_OUTPUT From 315f15f40f3f6b3028ec7b395775032487f2f427 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Fri, 23 Aug 2024 10:12:03 +0200 Subject: [PATCH 09/12] add echo statements --- project/detect-changed-components/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/project/detect-changed-components/action.yml b/project/detect-changed-components/action.yml index e444cf5..42a22fc 100644 --- a/project/detect-changed-components/action.yml +++ b/project/detect-changed-components/action.yml @@ -63,6 +63,7 @@ runs: - name: Get changed files id: changed-files uses: tj-actions/changed-files@v44 + if: steps.detect_changed.outputs.detect_changed == 'true' with: path: ${{ inputs.project_directory }} separator: "," @@ -108,6 +109,7 @@ runs: output_file=$(mktemp $RUNNER_TEMP/viash_ns_changed_files.XXXXXX.json) if [[ "${{steps.detect_changed.outputs.detect_changed}}" == "false" ]]; then + echo "Skip filtering components, returning all components." cp "${{ inputs.input_file }}" "$output_file" echo "output_file=$output_file" >> $GITHUB_OUTPUT exit 0 From a4bd73fdaeaf604e20ba236d4fb130d7528b0745 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Fri, 23 Aug 2024 10:20:42 +0200 Subject: [PATCH 10/12] fix action --- project/detect-changed-components/action.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/project/detect-changed-components/action.yml b/project/detect-changed-components/action.yml index 42a22fc..642a909 100644 --- a/project/detect-changed-components/action.yml +++ b/project/detect-changed-components/action.yml @@ -42,23 +42,26 @@ runs: id: detect_changed working-directory: ${{ inputs.project_directory }} run: | - # if the commit message contains 'ci force' or the branch is the default branch, detect changed components + # if the current branch is the default branch, we don't need to detect changed components if [[ ${{ github.ref }} == 'refs/heads/${{ github.event.repository.default_branch }}' ]]; then echo "Current branch is the default branch." - echo "detect_changed=true" >> $GITHUB_OUTPUT + echo "detect_changed=false" >> $GITHUB_OUTPUT exit 0 fi + + # if the commit message contains 'ci force', we don't need to detect changed components if [[ ${{ github.event_name }} == 'pull_request' ]]; then head_sha="${{(github.event.pull_request.head.sha)}}" commit_msg=$(git log --format=%B -n 1 $head_sha) if [[ $commit_msg == *"ci force"* ]]; then echo "PR commit message contains 'ci force'." - echo "detect_changed=true" >> $GITHUB_OUTPUT + echo "detect_changed=false" >> $GITHUB_OUTPUT exit 0 fi fi - echo "detect_changed=false" >> $GITHUB_OUTPUT + # if we get here, we do need to detect changed components + echo "detect_changed=true" >> $GITHUB_OUTPUT - name: Get changed files id: changed-files From cc2e0243e1217e324aad7af046d7b30cbb4e1aa9 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Fri, 23 Aug 2024 10:51:34 +0200 Subject: [PATCH 11/12] switch back to v6 --- .github/workflows/README.md | 4 ++-- .github/workflows/README.qmd | 4 ++-- .github/workflows/build.yaml | 6 +++--- .github/workflows/test.yaml | 10 +++++----- ns-build/README.md | 4 ++-- ns-build/README.qmd | 4 ++-- ns-list/README.md | 4 ++-- ns-list/README.qmd | 4 ++-- pro/build-nextflow-params/README.md | 4 ++-- pro/build-nextflow-params/README.qmd | 4 ++-- pro/build-nextflow-schemas/README.md | 4 ++-- pro/build-nextflow-schemas/README.qmd | 4 ++-- pro/generate-documentation-qmd/README.md | 4 ++-- pro/generate-documentation-qmd/README.qmd | 4 ++-- project/build-target/README.md | 4 ++-- project/build-target/README.qmd | 4 ++-- project/build-target/action.yml | 6 +++--- project/check-concurrent-pr/README.md | 2 +- project/check-concurrent-pr/README.qmd | 2 +- project/detect-changed-components/README.md | 4 ++-- project/detect-changed-components/README.qmd | 4 ++-- project/update-docker-engine/README.md | 2 +- project/update-docker-engine/README.qmd | 2 +- setup/README.md | 6 +++--- setup/README.qmd | 6 +++--- 25 files changed, 53 insertions(+), 53 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index e28fde1..5ec5a72 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -15,7 +15,7 @@ on: jobs: test: - uses: viash-io/viash-actions/.github/workflows/test.yaml@add-working-dir-input + uses: viash-io/viash-actions/.github/workflows/test.yaml@v6 ``` ## Build components @@ -49,5 +49,5 @@ on: jobs: test: - uses: viash-io/viash-actions/.github/workflows/build.yaml@add-working-dir-input + uses: viash-io/viash-actions/.github/workflows/build.yaml@v6 ``` diff --git a/.github/workflows/README.qmd b/.github/workflows/README.qmd index 7fdcfbb..b7058e1 100644 --- a/.github/workflows/README.qmd +++ b/.github/workflows/README.qmd @@ -17,7 +17,7 @@ on: jobs: test: - uses: viash-io/viash-actions/.github/workflows/test.yaml@add-working-dir-input + uses: viash-io/viash-actions/.github/workflows/test.yaml@v6 ``` @@ -52,5 +52,5 @@ on: jobs: test: - uses: viash-io/viash-actions/.github/workflows/build.yaml@add-working-dir-input + uses: viash-io/viash-actions/.github/workflows/build.yaml@v6 ``` diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3a7850f..90a0adb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -51,7 +51,7 @@ jobs: fetch-depth: 0 - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: Determine variables id: variables @@ -78,7 +78,7 @@ jobs: echo "target_branch=$TARGET_BRANCH" >> $GITHUB_OUTPUT - - uses: viash-io/viash-actions/project/build-target@add-working-dir-input + - uses: viash-io/viash-actions/project/build-target@v6 id: build-target with: project_directory: ${{ inputs.project_directory }} @@ -116,7 +116,7 @@ jobs: submodules: 'recursive' ref: ${{ needs.target.outputs.target_branch }} - - uses: viash-io/viash-actions/setup@add-working-dir-input + - uses: viash-io/viash-actions/setup@v6 - name: Login to container registry uses: docker/login-action@v3 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 99e6e01..148890b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -47,22 +47,22 @@ jobs: fetch-depth: 0 submodules: 'recursive' - - uses: viash-io/viash-actions/setup@add-working-dir-input + - uses: viash-io/viash-actions/setup@v6 - - uses: viash-io/viash-actions/project/sync-and-cache@add-working-dir-input + - uses: viash-io/viash-actions/project/sync-and-cache@v6 id: cache with: project_directory: ${{ inputs.project_directory }} - id: ns_list - uses: viash-io/viash-actions/ns-list@add-working-dir-input + uses: viash-io/viash-actions/ns-list@v6 with: project_directory: ${{ inputs.project_directory }} format: json runner: executable - id: ns_list_filter_changed - uses: viash-io/viash-actions/project/detect-changed-components@add-working-dir-input + uses: viash-io/viash-actions/project/detect-changed-components@v6 with: project_directory: ${{ inputs.project_directory }} input_file: "${{ steps.ns_list.outputs.output_file }}" @@ -98,7 +98,7 @@ jobs: fetch-depth: 0 - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 # use cache - name: Cache resources data diff --git a/ns-build/README.md b/ns-build/README.md index c921f9c..bc0b94d 100644 --- a/ns-build/README.md +++ b/ns-build/README.md @@ -80,8 +80,8 @@ jobs: uses: actions/checkout@v3 - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: viash ns build - uses: viash-io/viash-actions/ns-build@add-working-dir-input + uses: viash-io/viash-actions/ns-build@v6 ``` diff --git a/ns-build/README.qmd b/ns-build/README.qmd index d7b92d7..9626936 100644 --- a/ns-build/README.qmd +++ b/ns-build/README.qmd @@ -63,9 +63,9 @@ jobs: uses: actions/checkout@v3 - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: `r action$name` - uses: viash-io/viash-actions/ns-build@add-working-dir-input + uses: viash-io/viash-actions/ns-build@v6 ``` diff --git a/ns-list/README.md b/ns-list/README.md index e8013cd..9d13174 100644 --- a/ns-list/README.md +++ b/ns-list/README.md @@ -97,13 +97,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: Check out repository uses: actions/checkout@v3 - name: viash ns list - uses: viash-io/viash-actions/ns-list@add-working-dir-input + uses: viash-io/viash-actions/ns-list@v6 - name: View output run: | diff --git a/ns-list/README.qmd b/ns-list/README.qmd index 7e1de93..9f60ac6 100644 --- a/ns-list/README.qmd +++ b/ns-list/README.qmd @@ -65,13 +65,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: Check out repository uses: actions/checkout@v3 - name: `r action$name` - uses: viash-io/viash-actions/ns-list@add-working-dir-input + uses: viash-io/viash-actions/ns-list@v6 - name: View output run: | diff --git a/pro/build-nextflow-params/README.md b/pro/build-nextflow-params/README.md index 304ec0e..bb8f67c 100644 --- a/pro/build-nextflow-params/README.md +++ b/pro/build-nextflow-params/README.md @@ -34,13 +34,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: Check out repository uses: actions/checkout@v3 - name: Build parameter yaml examples for Viash components - uses: viash-io/viash-actions/pro/build-nextflow-params@add-working-dir-input + uses: viash-io/viash-actions/pro/build-nextflow-params@v6 with: target: target/ token: ${{ secrets.VIASH_PRO_TOKEN }} diff --git a/pro/build-nextflow-params/README.qmd b/pro/build-nextflow-params/README.qmd index 58012be..e2f1f0a 100644 --- a/pro/build-nextflow-params/README.qmd +++ b/pro/build-nextflow-params/README.qmd @@ -58,13 +58,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: Check out repository uses: actions/checkout@v3 - name: `r action$name` - uses: viash-io/viash-actions/pro/build-nextflow-params@add-working-dir-input + uses: viash-io/viash-actions/pro/build-nextflow-params@v6 with: target: target/ token: ${{ secrets.VIASH_PRO_TOKEN }} diff --git a/pro/build-nextflow-schemas/README.md b/pro/build-nextflow-schemas/README.md index d559045..725d169 100644 --- a/pro/build-nextflow-schemas/README.md +++ b/pro/build-nextflow-schemas/README.md @@ -36,13 +36,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: Check out repository uses: actions/checkout@v3 - name: Build nf-tower schemas for Viash components - uses: viash-io/viash-actions/pro/build-nextflow-schemas@add-working-dir-input + uses: viash-io/viash-actions/pro/build-nextflow-schemas@v6 with: target: target/ token: ${{ secrets.VIASH_PRO_TOKEN }} diff --git a/pro/build-nextflow-schemas/README.qmd b/pro/build-nextflow-schemas/README.qmd index 33f8fdf..e89b88e 100644 --- a/pro/build-nextflow-schemas/README.qmd +++ b/pro/build-nextflow-schemas/README.qmd @@ -58,13 +58,13 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: Check out repository uses: actions/checkout@v3 - name: `r action$name` - uses: viash-io/viash-actions/pro/build-nextflow-schemas@add-working-dir-input + uses: viash-io/viash-actions/pro/build-nextflow-schemas@v6 with: target: target/ token: ${{ secrets.VIASH_PRO_TOKEN }} diff --git a/pro/generate-documentation-qmd/README.md b/pro/generate-documentation-qmd/README.md index d91c763..f77c71b 100644 --- a/pro/generate-documentation-qmd/README.md +++ b/pro/generate-documentation-qmd/README.md @@ -68,7 +68,7 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: Check out repository uses: actions/checkout@v3 @@ -76,7 +76,7 @@ jobs: path: project - name: Build quarto markdown documentation files for Viash components - uses: viash-io/viash-actions/generate-documentation-qmd@add-working-dir-input + uses: viash-io/viash-actions/generate-documentation-qmd@v6 with: project_dir: project src: src diff --git a/pro/generate-documentation-qmd/README.qmd b/pro/generate-documentation-qmd/README.qmd index 040ff86..aa09f92 100644 --- a/pro/generate-documentation-qmd/README.qmd +++ b/pro/generate-documentation-qmd/README.qmd @@ -58,7 +58,7 @@ jobs: steps: - name: Install Viash - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: Check out repository uses: actions/checkout@v3 @@ -66,7 +66,7 @@ jobs: path: project - name: `r action$name` - uses: viash-io/viash-actions/generate-documentation-qmd@add-working-dir-input + uses: viash-io/viash-actions/generate-documentation-qmd@v6 with: project_dir: project src: src diff --git a/project/build-target/README.md b/project/build-target/README.md index 8408225..4a4ed23 100644 --- a/project/build-target/README.md +++ b/project/build-target/README.md @@ -44,11 +44,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: Build target directory id: build_target - uses: viash-io/viash-actions/build-target@add-working-dir-input + uses: viash-io/viash-actions/build-target@v6 - name: Check output run: | diff --git a/project/build-target/README.qmd b/project/build-target/README.qmd index b4ced14..0e118b0 100644 --- a/project/build-target/README.qmd +++ b/project/build-target/README.qmd @@ -55,11 +55,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: viash-io/viash-actions/setup@add-working-dir-input + uses: viash-io/viash-actions/setup@v6 - name: `r action$name` id: build_target - uses: viash-io/viash-actions/build-target@add-working-dir-input + uses: viash-io/viash-actions/build-target@v6 - name: Check output run: | diff --git a/project/build-target/action.yml b/project/build-target/action.yml index 0883516..dbce071 100644 --- a/project/build-target/action.yml +++ b/project/build-target/action.yml @@ -86,7 +86,7 @@ runs: run: | yq eval '.version = "${{ steps.defaults.outputs.version }}"' -i _viash.yaml - - uses: viash-io/viash-actions/ns-build@add-working-dir-input + - uses: viash-io/viash-actions/ns-build@v6 with: parallel: true config_mod: ${{ steps.defaults.outputs.config_mod }} @@ -94,7 +94,7 @@ runs: - name: Build nextflow schemas if: ${{ inputs.viash_pro_token != '' }} - uses: viash-io/viash-actions/pro/build-nextflow-params@add-working-dir-input + uses: viash-io/viash-actions/pro/build-nextflow-params@v6 with: target_dir: ${{ inputs.project_directory }}/${{ steps.defaults.outputs.target_dir }} viash_pro_token: ${{ inputs.viash_pro_token }} @@ -103,7 +103,7 @@ runs: - name: Build parameter files if: ${{ inputs.viash_pro_token != '' }} - uses: viash-io/viash-actions/pro/build-nextflow-params@add-working-dir-input + uses: viash-io/viash-actions/pro/build-nextflow-params@v6 with: target_dir: ${{ inputs.project_directory }}/${{ steps.defaults.outputs.target_dir }} viash_pro_token: ${{ inputs.viash_pro_token }} diff --git a/project/check-concurrent-pr/README.md b/project/check-concurrent-pr/README.md index 6421eaf..a318c0f 100644 --- a/project/check-concurrent-pr/README.md +++ b/project/check-concurrent-pr/README.md @@ -42,7 +42,7 @@ jobs: uses: actions/checkout@v3 - name: Check for concurrent PRs - uses: viash-io/viash-actions/is-pr@add-working-dir-input + uses: viash-io/viash-actions/is-pr@v6 id: is_pr - run: | diff --git a/project/check-concurrent-pr/README.qmd b/project/check-concurrent-pr/README.qmd index a25f930..f86e30e 100644 --- a/project/check-concurrent-pr/README.qmd +++ b/project/check-concurrent-pr/README.qmd @@ -58,7 +58,7 @@ jobs: uses: actions/checkout@v3 - name: `r action$name` - uses: viash-io/viash-actions/is-pr@add-working-dir-input + uses: viash-io/viash-actions/is-pr@v6 id: is_pr - run: | diff --git a/project/detect-changed-components/README.md b/project/detect-changed-components/README.md index b790c6d..4ea3fdd 100644 --- a/project/detect-changed-components/README.md +++ b/project/detect-changed-components/README.md @@ -58,13 +58,13 @@ jobs: - uses: actions/checkout@v3 - id: ns_list - uses: viash-io/viash-actions/ns-list@add-working-dir-input + uses: viash-io/viash-actions/ns-list@v6 with: format: json - name: Detect components with changed files id: ns_list_changed - uses: viash-io/viash-actions/detect-changed-components@add-working-dir-input + uses: viash-io/viash-actions/detect-changed-components@v6 with: input_file: ${{ steps.ns_list.outputs.output_file }} ``` diff --git a/project/detect-changed-components/README.qmd b/project/detect-changed-components/README.qmd index 4a950bf..cf75b2a 100644 --- a/project/detect-changed-components/README.qmd +++ b/project/detect-changed-components/README.qmd @@ -57,13 +57,13 @@ jobs: - uses: actions/checkout@v3 - id: ns_list - uses: viash-io/viash-actions/ns-list@add-working-dir-input + uses: viash-io/viash-actions/ns-list@v6 with: format: json - name: `r action$name` id: ns_list_changed - uses: viash-io/viash-actions/detect-changed-components@add-working-dir-input + uses: viash-io/viash-actions/detect-changed-components@v6 with: input_file: ${{ steps.ns_list.outputs.output_file }} ``` diff --git a/project/update-docker-engine/README.md b/project/update-docker-engine/README.md index 17795bc..ebdc28a 100644 --- a/project/update-docker-engine/README.md +++ b/project/update-docker-engine/README.md @@ -32,5 +32,5 @@ jobs: uses: actions/checkout@v3 - name: Update Docker Engine - uses: viash-io/viash-actions/project/update-docker-engine@add-working-dir-input + uses: viash-io/viash-actions/project/update-docker-engine@v6 ``` diff --git a/project/update-docker-engine/README.qmd b/project/update-docker-engine/README.qmd index 85b9e9f..6dc9829 100644 --- a/project/update-docker-engine/README.qmd +++ b/project/update-docker-engine/README.qmd @@ -58,6 +58,6 @@ jobs: uses: actions/checkout@v3 - name: `r action$name` - uses: viash-io/viash-actions/project/update-docker-engine@add-working-dir-input + uses: viash-io/viash-actions/project/update-docker-engine@v6 ``` diff --git a/setup/README.md b/setup/README.md index 202a020..4536ebf 100644 --- a/setup/README.md +++ b/setup/README.md @@ -33,19 +33,19 @@ jobs: viash-linux: runs-on: ubuntu-latest steps: - - uses: viash-io/viash-actions/setup@add-working-dir-input + - uses: viash-io/viash-actions/setup@v6 - run: | viash --version viash-windows: runs-on: windows-latest steps: - - uses: viash-io/viash-actions/setup@add-working-dir-input + - uses: viash-io/viash-actions/setup@v6 - run: | viash --version viash-macos: runs-on: macos-latest steps: - - uses: viash-io/viash-actions/setup@add-working-dir-input + - uses: viash-io/viash-actions/setup@v6 - run: | viash --version ``` diff --git a/setup/README.qmd b/setup/README.qmd index c841e8e..a29c416 100644 --- a/setup/README.qmd +++ b/setup/README.qmd @@ -54,19 +54,19 @@ jobs: viash-linux: runs-on: ubuntu-latest steps: - - uses: viash-io/viash-actions/setup@add-working-dir-input + - uses: viash-io/viash-actions/setup@v6 - run: | viash --version viash-windows: runs-on: windows-latest steps: - - uses: viash-io/viash-actions/setup@add-working-dir-input + - uses: viash-io/viash-actions/setup@v6 - run: | viash --version viash-macos: runs-on: macos-latest steps: - - uses: viash-io/viash-actions/setup@add-working-dir-input + - uses: viash-io/viash-actions/setup@v6 - run: | viash --version ``` From 8224b57d5b44f4dcdbe72b833cbd696365abc7ed Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Fri, 23 Aug 2024 13:25:21 +0200 Subject: [PATCH 12/12] be less verbose --- ns-build/index.js | 1 - ns-list/index.js | 2 -- 2 files changed, 3 deletions(-) diff --git a/ns-build/index.js b/ns-build/index.js index c0fc8d2..0b49750 100644 --- a/ns-build/index.js +++ b/ns-build/index.js @@ -14,7 +14,6 @@ async function run() { }, stderr: (data) => { myError += data.toString(); - core.error(data.toString()); } }; diff --git a/ns-list/index.js b/ns-list/index.js index e912ee3..1f97728 100644 --- a/ns-list/index.js +++ b/ns-list/index.js @@ -12,11 +12,9 @@ async function run() { options.listeners = { stdout: (data) => { myOutput += data.toString(); - core.info(data.toString()); }, stderr: (data) => { myError += data.toString(); - core.error(data.toString()); } }; options.silent = true;