Skip to content
Merged
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
176 changes: 164 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,82 @@ jobs:

- name: Check action files exist
run: |
test -f action.yml
test -f plan/action.yml
test -f run/action.yml
test -f validate/action.yml
echo "::group::Check required files"
for f in action.yml plan/action.yml run/action.yml validate/action.yml; do
if [ -f "$f" ]; then
echo " ✓ $f"
else
echo "::error::Missing required file: $f"
exit 1
fi
done
echo "::endgroup::"

- name: Validate YAML syntax
run: |
echo "::group::Validate YAML"
python3 -c "
import yaml, sys, pathlib
files = ['action.yml','plan/action.yml','run/action.yml','validate/action.yml']
ok = True
for f in files:
try:
yaml.safe_load(pathlib.Path(f).read_text())
print(f'OK: {f}')
data = yaml.safe_load(pathlib.Path(f).read_text())
assert 'name' in data, 'missing name field'
assert 'runs' in data, 'missing runs field'
print(f' ✓ {f} ({data[\"name\"]})')
except Exception as e:
print(f'FAIL: {f}: {e}', file=sys.stderr)
sys.exit(1)
print(f' ✗ {f}: {e}', file=sys.stderr)
ok = False
if not ok:
sys.exit(1)
"
echo "::endgroup::"

smoke-setup:
name: Smoke — setup action
- name: Validate action schema
run: |
echo "::group::Schema validation"
python3 -c "
import yaml, sys, pathlib

def validate_action(path):
data = yaml.safe_load(pathlib.Path(path).read_text())
errors = []
if 'description' not in data:
errors.append('missing description')
if 'runs' not in data:
errors.append('missing runs')
elif data['runs'].get('using') != 'composite':
errors.append('not a composite action')
elif 'steps' not in data['runs']:
errors.append('missing steps in runs')
if data.get('inputs'):
for name, spec in data['inputs'].items():
if 'description' not in spec:
errors.append(f'input \"{name}\" missing description')
if data.get('outputs'):
for name, spec in data['outputs'].items():
if 'description' not in spec:
errors.append(f'output \"{name}\" missing description')
return errors

files = ['action.yml','plan/action.yml','run/action.yml','validate/action.yml']
ok = True
for f in files:
errs = validate_action(f)
if errs:
for e in errs:
print(f' ✗ {f}: {e}', file=sys.stderr)
ok = False
else:
print(f' ✓ {f}')
if not ok:
sys.exit(1)
"
echo "::endgroup::"

test-setup:
name: Test setup — ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -46,5 +101,102 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Run setup action (dry-run via PATH check skipped — orun not published yet)
run: echo "Setup action structure validated on ${{ matrix.os }}"
- name: Install orun (latest)
uses: ./
id: setup

- name: Verify orun is in PATH
run: |
echo "::group::Verify installation"
which orun
orun --help || true
echo "::endgroup::"

- name: Verify version output
run: |
VERSION="${{ steps.setup.outputs.version }}"
echo "Reported version: $VERSION"
if [ -z "$VERSION" ]; then
echo "::error::Setup action returned empty version"
exit 1
fi
echo "::notice::Setup verified — orun $VERSION on ${{ matrix.os }}"

test-setup-pinned:
name: Test setup — pinned version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install orun (pinned)
uses: ./
id: setup
with:
version: v1.12.6

- name: Verify pinned version
run: |
VERSION="${{ steps.setup.outputs.version }}"
echo "Reported version: $VERSION"
if [ -z "$VERSION" ]; then
echo "::error::Expected a version string, got empty"
exit 1
fi
echo "::notice::Pinned install verified — $VERSION"

test-validate:
name: Test validate
runs-on: ubuntu-latest
needs: [test-setup]
steps:
- uses: actions/checkout@v4

- name: Create test intent
run: |
cat > test-intent.yaml << 'EOF'
version: "1"
name: ci-test
components:
- name: hello
type: service
path: .
jobs:
- id: greet
steps:
- run: echo "hello world"
EOF

- name: Validate intent
uses: ./validate
id: validate
with:
intent: test-intent.yaml

- name: Check output
run: |
if [ "${{ steps.validate.outputs.valid }}" != "true" ]; then
echo "::error::Expected valid=true"
exit 1
fi

test-validate-missing-file:
name: Test validate — missing file
runs-on: ubuntu-latest
needs: [test-setup]
steps:
- uses: actions/checkout@v4

- name: Validate non-existent file (expect failure)
uses: ./validate
id: validate
continue-on-error: true
with:
intent: does-not-exist.yaml

- name: Verify failure
run: |
if [ "${{ steps.validate.outputs.valid }}" = "true" ]; then
echo "::error::Expected validation to fail for missing file"
exit 1
fi
echo "::notice::Correctly rejected missing file"
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
id: plan
with:
intent: intent.yaml
version: v1.12.4

execute:
needs: plan
Expand All @@ -77,8 +76,6 @@ jobs:
download-artifact: true
remote-state: true
backend-url: ${{ vars.ORUN_BACKEND_URL }}
exec-id: ${{ github.run_id }}-${{ github.run_attempt }}
version: v1.12.4
```

## Inputs
Expand All @@ -87,7 +84,7 @@ jobs:

| Input | Default | Description |
|---|---|---|
| `version` | `latest` | orun version tag or `latest` |
| `version` | `latest` | orun version tag or `latest` (auto-resolves to newest release) |
| `install-dir` | `~/.local/bin` | Directory to install the binary |
| `install-url` | upstream | Override install script URL (air-gapped) |

Expand Down Expand Up @@ -146,25 +143,33 @@ jobs:
## Version pinning

```yaml
# Floating major (convenience)
# Floating major (convenience — always gets latest orun)
- uses: sourceplane/orun-action/plan@v1

# Pinned semver (recommended)
- uses: sourceplane/orun-action/plan@v1.0.0
- uses: sourceplane/orun-action/plan@v1.1.0

# Pinned SHA (high-assurance / supply-chain audited)
- uses: sourceplane/orun-action/plan@<commit-sha> # v1.0.0
- uses: sourceplane/orun-action/plan@<commit-sha> # v1.1.0
```

The `v1` floating tag is force-pushed on every patch and minor release. Major version increments only on breaking input/output changes.

## Caching

The orun binary is cached by `runner.os`, `runner.arch`, and `version`. A pinned version produces a stable cache hit for the lifetime of the runner image. Optionally cache composition archives:
The orun binary is cached by `runner.os`, `runner.arch`, and the resolved version tag. When `version: latest` is used, the action resolves the actual release tag first so the cache key stays stable until a new orun release is published.

Optionally cache composition archives:

```yaml
- uses: actions/cache@v4
with:
path: .orun/cache
key: orun-compositions-${{ hashFiles('.orun/compositions.lock.yaml') }}
```

## Log output

All actions use GitHub Actions [log grouping](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines) for clean, collapsible output. Key events are surfaced as `::notice::` annotations and failures use `::error::` annotations with file-level targeting where applicable.

Each action writes a structured [job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary) with execution results.
58 changes: 49 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,32 @@ outputs:
runs:
using: composite
steps:
- name: Resolve version
id: version
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "::group::Resolve orun version"
VERSION="${{ inputs.version }}"
if [ "$VERSION" = "latest" ] || [ -z "$VERSION" ]; then
AUTH_HEADER=""
if [ -n "$GH_TOKEN" ]; then
AUTH_HEADER="Authorization: Bearer $GH_TOKEN"
fi
VERSION=$(curl -fsSL \
-H "Accept: application/vnd.github+json" \
${AUTH_HEADER:+-H "$AUTH_HEADER"} \
https://api.github.com/repos/sourceplane/orun/releases/latest \
| python3 -c "import sys,json; print(json.load(sys.stdin)['tag_name'])")
echo "Resolved latest → $VERSION"
fi
echo "tag=$VERSION" >> "$GITHUB_OUTPUT"
echo "::endgroup::"

- name: Resolve install dir
id: dirs
shell: sh
shell: bash
run: |
INSTALL_DIR=$(echo "${{ inputs.install-dir }}" | sed "s|^~|$HOME|")
mkdir -p "$INSTALL_DIR"
Expand All @@ -33,21 +56,38 @@ runs:
uses: actions/cache@v4
with:
path: ${{ steps.dirs.outputs.path }}/orun
key: orun-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }}
key: orun-${{ runner.os }}-${{ runner.arch }}-${{ steps.version.outputs.tag }}

- name: Install orun
if: steps.cache.outputs.cache-hit != 'true'
shell: sh
shell: bash
env:
ORUN_VERSION: ${{ inputs.version }}
ORUN_VERSION: ${{ steps.version.outputs.tag }}
ORUN_INSTALL_DIR: ${{ steps.dirs.outputs.path }}
run: curl -fsSL "${{ inputs.install-url }}" | sh
run: |
echo "::group::Install orun ${{ steps.version.outputs.tag }}"
curl -fsSL "${{ inputs.install-url }}" | sh
echo "::endgroup::"

- name: Add to PATH
shell: sh
shell: bash
run: echo "${{ steps.dirs.outputs.path }}" >> "$GITHUB_PATH"

- name: Resolve installed version
- name: Verify installation
id: resolve
shell: sh
run: echo "version=$(orun version 2>/dev/null || echo unknown)" >> "$GITHUB_OUTPUT"
shell: bash
run: |
echo "::group::Verify orun"
ORUN_BIN="${{ steps.dirs.outputs.path }}/orun"
if [ ! -x "$ORUN_BIN" ]; then
echo "::error::orun installation failed — binary not found at $ORUN_BIN"
exit 1
fi
INSTALLED_VERSION=$("$ORUN_BIN" version 2>&1 || "$ORUN_BIN" --version 2>&1 || echo "${{ steps.version.outputs.tag }}")
INSTALLED_VERSION=$(echo "$INSTALLED_VERSION" | grep -oE 'v?[0-9]+\.[0-9]+\.[0-9]+' | head -1)
if [ -z "$INSTALLED_VERSION" ]; then
INSTALLED_VERSION="${{ steps.version.outputs.tag }}"
fi
echo "version=$INSTALLED_VERSION" >> "$GITHUB_OUTPUT"
echo "::notice::orun $INSTALLED_VERSION ready"
echo "::endgroup::"
Loading
Loading