Skip to content

Commit

Permalink
Merge branch 'main' into mintlify-migrator-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
chdeskur authored Dec 25, 2024
2 parents c2e3002 + 26d4e44 commit 4879a95
Show file tree
Hide file tree
Showing 202 changed files with 3,210 additions and 796 deletions.
80 changes: 80 additions & 0 deletions .github/actions/cached-seed/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Cached Seed Generation
description: Run seed generation with caching for a specific generator.

inputs:
generator-name:
description: Generator to use (e.g., go-sdk, ruby-sdk)
required: true
generator-path:
description: The path to the source code of the generator (e.g., generators/go, generators/ruby)
required: true

runs:
using: "composite"
steps:
- name: Generate input hash
id: hash
shell: bash
run: |
HASH=$(./scripts/hash.sh \
packages/seed \
test-definitions \
packages/ir-sdk/fern/apis \
packages/cli/generation/ir-generator \
${{ inputs.generator-path }} \
seed/${{ inputs.generator-name }}/seed.yml \
--exclude versions.yml)
echo "hash=${HASH}" >> $GITHUB_OUTPUT
- name: Check cache
id: cache
uses: actions/cache/restore@v4
with:
path: seed/${{ inputs.generator-name }}
key: seed-${{ inputs.generator-name }}-${{ steps.hash.outputs.hash }}

- name: Install
if: steps.cache.outputs.cache-hit != 'true'
uses: ./.github/actions/install

- uses: bufbuild/[email protected]
if: steps.cache.outputs.cache-hit != 'true'
with:
github_token: ${{ github.token }}

- uses: actions/setup-go@v5
if: steps.cache.outputs.cache-hit != 'true'
with:
go-version: "stable"

- name: Install protoc-gen-openapi
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: go install github.com/google/gnostic/cmd/[email protected]

- name: Seed Test
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
env:
FORCE_COLOR: "2"
run: |
pnpm seed:local test --generator ${{ inputs.generator-name }} --parallel 16
- name: Validate results
id: validate
shell: bash
run: |
if git --no-pager diff --exit-code -- ":(exclude)seed/*/.mock/*"; then
echo "Results are valid, saving to cache if not already."
echo "valid=true" >> $GITHUB_OUTPUT
else
echo "Changes detected in git-tracked files."
exit 1
fi
- name: Save cache
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: seed/${{ inputs.generator-name }}
key: seed-${{ inputs.generator-name }}-${{ steps.hash.outputs.hash }}
Loading

0 comments on commit 4879a95

Please sign in to comment.