Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/actions/compile-argdump/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# compile-argdump action

A reusable GitHub composite action that compiles an [argdump](https://niwrap.dev/)
descriptor into target-language wrappers using the published
[`@styx-api/cli`](https://www.npmjs.com/package/@styx-api/cli). It runs the
standard compile pipeline (with the default optimization passes: flatten →
remove-empty → simplify, run to fixpoint) and, by default, emits a **Boutiques
descriptor**.

No source build is required - the action `npx`-runs the published CLI.

## Usage

```yaml
- name: Compile argdump to Boutiques
id: styx
uses: styx-api/styx2/.github/actions/compile-argdump@main
with:
argdump-file: path/to/my_tool_dump.json

- name: Use the descriptor
run: cat "${{ steps.styx.outputs.descriptor }}"
```

Upload the result as an artifact:

```yaml
- uses: styx-api/styx2/.github/actions/compile-argdump@main
id: styx
with:
argdump-file: path/to/my_tool_dump.json
- uses: actions/upload-artifact@v4
with:
name: descriptor
path: ${{ steps.styx.outputs.output-dir }}
```

## Inputs

| Input | Required | Default | Description |
| -------------- | -------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `argdump-file` | yes | - | Path to the argdump JSON file to compile. |
| `backend` | no | `boutiques` | Backend(s) to emit, comma-separated. Known: `python`, `typescript`, `ts`, `schema`, `json-schema`, `boutiques`, `nipype`, `pydra`. |
| `output-dir` | no | `styx-out` | Output directory. Per-backend files land in `<output-dir>/<backend>/`. |
| `mode` | no | `scripts` | Emit tiers: `scripts` (app only) \| `single` (+ package) \| `multi` (+ project). |
| `styx-version` | no | `latest` | Version of `@styx-api/cli` to run (npm dist-tag or exact version). Pin for reproducible builds. |
| `node-version` | no | `22` | Node.js version to set up. |

## Outputs

| Output | Description |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `output-dir` | Directory the generated files were written to. |
| `descriptor` | Path to the generated Boutiques descriptor (`<output-dir>/boutiques/descriptor.json`). Meaningful only when `boutiques` is among the requested backends. |

## Notes

- Pin `styx-version` (e.g. `0.5.0`) for reproducible output; `latest` tracks the newest published CLI.
- The action's output layout follows `styx build`: each backend writes under its own subdirectory of `output-dir`.
69 changes: 69 additions & 0 deletions .github/actions/compile-argdump/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: "Compile argdump"
description: >-
Compile an argdump descriptor into target-language wrappers (Boutiques by
default) using the published @styx-api/cli, with the default optimization
pipeline applied.

inputs:
argdump-file:
description: "Path to the argdump JSON file to compile."
required: true
backend:
description: >-
Backend(s) to emit (comma-separated). Known: python, typescript, ts,
schema, json-schema, boutiques, nipype, pydra.
required: false
default: "boutiques"
output-dir:
description: >-
Directory to write generated files into. Per-backend output lands in
<output-dir>/<backend>/ (e.g. <output-dir>/boutiques/descriptor.json).
required: false
default: "styx-out"
mode:
description: "Emit tiers: scripts (app only) | single (+ package) | multi (+ project)."
required: false
default: "scripts"
styx-version:
description: "Version of @styx-api/cli to run (npm dist-tag or exact version)."
required: false
default: "latest"
node-version:
description: "Node.js version to set up."
required: false
default: "22"

outputs:
output-dir:
description: "The directory generated files were written to."
value: ${{ inputs.output-dir }}
descriptor:
description: >-
Path to the generated Boutiques descriptor (<output-dir>/boutiques/descriptor.json).
Only meaningful when 'boutiques' is among the requested backends.
value: ${{ inputs.output-dir }}/boutiques/descriptor.json

runs:
using: "composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}

- name: Compile argdump
shell: bash
run: |
set -euo pipefail
if [ ! -f "${{ inputs.argdump-file }}" ]; then
echo "::error::argdump-file not found: ${{ inputs.argdump-file }}"
exit 1
fi
echo "Compiling ${{ inputs.argdump-file }} -> ${{ inputs.output-dir }} (backend: ${{ inputs.backend }}, mode: ${{ inputs.mode }})"
npx -y --package "@styx-api/cli@${{ inputs.styx-version }}" styx build \
"${{ inputs.argdump-file }}" \
--out "${{ inputs.output-dir }}" \
--backend "${{ inputs.backend }}" \
--mode "${{ inputs.mode }}"
echo "Generated files:"
find "${{ inputs.output-dir }}" -type f | sort
45 changes: 45 additions & 0 deletions .github/workflows/compile-argdump-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Compile argdump (example)

# Demonstrates and smoke-tests the reusable compile-argdump action by compiling
# the bundled fmriprep argdump into a Boutiques descriptor and uploading it as
# an artifact. Runs on manual dispatch and when the action itself changes.

on:
workflow_dispatch:
inputs:
argdump-file:
description: "Path to an argdump JSON file in the repo to compile"
required: false
default: "playground/public/examples/fmriprep_25.2.3_dump.json"
backend:
description: "Backend(s) to emit (comma-separated)"
required: false
default: "boutiques"
pull_request:
paths:
- ".github/actions/compile-argdump/**"
- ".github/workflows/compile-argdump-example.yml"

permissions:
contents: read

jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Compile argdump
id: compile
uses: ./.github/actions/compile-argdump
with:
argdump-file: ${{ inputs.argdump-file || 'playground/public/examples/fmriprep_25.2.3_dump.json' }}
backend: ${{ inputs.backend || 'boutiques' }}
output-dir: styx-out

- name: Upload generated files
uses: actions/upload-artifact@v4
with:
name: styx-output
path: ${{ steps.compile.outputs.output-dir }}
Loading