Skip to content
Draft
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
33 changes: 33 additions & 0 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Smoke test

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
config-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Build fixture through the local action
id: sourcey
uses: ./
with:
version: "3.6.5"
config: test/fixture/sourcey.config.ts
output: test/fixture/generated docs

- name: Verify output
env:
OUTPUT_DIR: ${{ steps.sourcey.outputs.output-dir }}
run: |
test "$OUTPUT_DIR" = "test/fixture/generated docs"
test -f "$OUTPUT_DIR/index.html"
test -f "$OUTPUT_DIR/search-index.json"
32 changes: 20 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,31 @@ runs:

- name: Install Sourcey
shell: bash
run: npm install -g sourcey@${{ inputs.version }}
env:
SOURCEY_VERSION: ${{ inputs.version }}
run: npm install --no-save --package-lock=false "sourcey@$SOURCEY_VERSION"

- name: Build docs
id: build
shell: bash
env:
INPUT_ARGS: ${{ inputs.args }}
INPUT_CONFIG: ${{ inputs.config }}
INPUT_OUTPUT: ${{ inputs.output }}
INPUT_SPEC: ${{ inputs.spec }}
run: |
ARGS=""
if [ -n "${{ inputs.config }}" ]; then
ARGS="--config ${{ inputs.config }}"
elif [ -n "${{ inputs.spec }}" ]; then
ARGS="${{ inputs.spec }}"
ARGS=()
if [ -n "$INPUT_CONFIG" ]; then
ARGS+=(--config "$INPUT_CONFIG")
elif [ -n "$INPUT_SPEC" ]; then
ARGS+=("$INPUT_SPEC")
fi
if [ -n "${{ inputs.output }}" ]; then
ARGS="$ARGS --output ${{ inputs.output }}"
if [ -n "$INPUT_OUTPUT" ]; then
ARGS+=(--output "$INPUT_OUTPUT")
fi
if [ -n "${{ inputs.args }}" ]; then
ARGS="$ARGS ${{ inputs.args }}"
if [ -n "$INPUT_ARGS" ]; then
read -r -a EXTRA_ARGS <<< "$INPUT_ARGS"
ARGS+=("${EXTRA_ARGS[@]}")
fi
sourcey build $ARGS
echo "output-dir=${{ inputs.output }}" >> "$GITHUB_OUTPUT"
"$GITHUB_WORKSPACE/node_modules/.bin/sourcey" build "${ARGS[@]}"
echo "output-dir=$INPUT_OUTPUT" >> "$GITHUB_OUTPUT"
12 changes: 12 additions & 0 deletions test/fixture/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
openapi: 3.1.0
info:
title: Sourcey action fixture
version: 1.0.0
paths:
/health:
get:
operationId: getHealth
summary: Check service health
responses:
"200":
description: The service is healthy
14 changes: 14 additions & 0 deletions test/fixture/sourcey.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig, openapi } from "sourcey";

export default defineConfig({
name: "Sourcey action fixture",
navigation: {
tabs: [
{
tab: "API Reference",
slug: "api",
source: openapi("./openapi.yaml"),
},
],
},
});