Skip to content

Commit

Permalink
Merge branch 'main' into fix/go-generator-timestamp-syntax-err
Browse files Browse the repository at this point in the history
  • Loading branch information
dannysheridan authored Jan 11, 2025
2 parents 1bbeaa9 + 2256c53 commit 04dfda4
Show file tree
Hide file tree
Showing 19,932 changed files with 963,876 additions and 120,028 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ build
dist
.yarn
.husky
.github
.turbo
.vscode
node_modules
generated
__snapshots__
bundle.c?js
.pnp*
packages/ir-sdk/**
Expand Down
9 changes: 2 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,7 @@ module.exports = {
ignoreRestSiblings: true
}
],
"@typescript-eslint/no-namespace": [
"error",
{
allowDeclarations: true
}
],
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{
Expand Down Expand Up @@ -129,7 +124,7 @@ module.exports = {
{
files: ['**/*.test.ts', '**/*.spec.ts'],
rules: {
'no-console': 'off'
'no-console': 'off'
}
}
]
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ generators/openapi/* @dsinghvi

# Specific rules for packages
packages/cli/* @amckinney
packages/cli/api-importers/* @eyw520
packages/generators/cli/* @dsinghvi
packages/generators/docker/* @dsinghvi
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 }}
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"

jobs:
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -82,9 +86,6 @@ jobs:
- name: Install protoc-gen-openapi
run: go install github.com/google/gnostic/cmd/[email protected]

- name: Compile
run: pnpm compile

- name: Run tests
run: pnpm test

Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/preview-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Checkout PR
if: github.event_name == 'pull_request_target'
run: |
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }}
git checkout pr-${{ github.event.pull_request.number }}
- name: Install
uses: ./.github/actions/install

Expand All @@ -47,20 +53,18 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
COMMENT_TAG="<!-- docs-preview-link -->"
PREVIEW_URL=$(cat preview_url.txt)
# Get existing comments
EXISTING_COMMENT=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
--jq ".[] | select(.body | contains(\"${COMMENT_TAG}\")) | .id")
--jq ".[] | select(.body | contains(\"Preview your docs\")) | .id")
if [ -z "$EXISTING_COMMENT" ]; then
# No existing comment, create one
gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-f body="${COMMENT_TAG}🌿 Preview your docs: $PREVIEW_URL"
-f "body"="🌿 Preview your docs: [$PREVIEW_URL]($PREVIEW_URL)"
else
# Update existing comment
gh api repos/${{ github.repository }}/issues/comments/$EXISTING_COMMENT \
-X PATCH \
-f body="${COMMENT_TAG}🌿 Preview your docs: $PREVIEW_URL"
-f "body"="🌿 Preview your docs: [$PREVIEW_URL]($PREVIEW_URL)"
fi
34 changes: 34 additions & 0 deletions .github/workflows/publish-docs-parsers-fern-definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: publish-docs-parsers-fern-definition

on:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install
uses: ./.github/actions/install

- name: Install Fern
run: npm install -g fern-api

- name: Get current version and compute next version
id: version
run: |
CURRENT_VERSION=$(npm view @fern-fern/docs-parsers-fern-definition version)
# Split version into parts
IFS='.' read -r major minor patch <<< "$CURRENT_VERSION"
# Increment patch version
NEW_VERSION="$major.$minor.$((patch + 1))"
echo "next_version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Generate docs parsers
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
fern generate --api fern-definition --group docs-parsers --version ${{ steps.version.outputs.next_version }}
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: publish-docs

on:
workflow_dispatch: # Added manual trigger
push:
paths:
- "fern/**"
Expand All @@ -11,7 +12,6 @@ on:
jobs:
run:
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/heads/main')
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/publish-snippets-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish @fern-api/snippets-core

on:
workflow_dispatch:
inputs:
version:
description: "The version of the library to publish."
required: true
type: string

env:
PACKAGE_NAME: "@fern-api/snippets-core"
GITHUB_TOKEN: ${{ secrets.FERN_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}

jobs:
publish:
runs-on: ubuntu-latest
if: ${{ inputs.version != null }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-tags: true

- name: 📥 Install
uses: ./.github/actions/install

- uses: bufbuild/[email protected]
with:
github_token: ${{ github.token }}

- uses: actions/setup-go@v5
with:
go-version: "stable"

- name: Install protoc-gen-openapi
run: go install github.com/google/gnostic/cmd/[email protected]

- name: 🧪 Build
run: pnpm --filter=${{ env.PACKAGE_NAME }} compile

- name: 🧪 Test
run: pnpm --filter=${{ env.PACKAGE_NAME }} test

- name: Publish @fern-api/snippets-core
run: |
cd packages/snippets/core
pnpm --filter=${{ env.PACKAGE_NAME }} dist ${{ inputs.version }}
cd dist
echo "//registry.npmjs.org/:_authToken=${{ env.NPM_TOKEN }}" > ~/.npmrc
npm publish --access public
52 changes: 52 additions & 0 deletions .github/workflows/publish-ts-dynamic-snippets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish @fern-api/typescript-dynamic-snippets

on:
workflow_dispatch:
inputs:
version:
description: "The version of the library to publish."
required: true
type: string

env:
PACKAGE_NAME: "@fern-api/typescript-dynamic-snippets"
GITHUB_TOKEN: ${{ secrets.FERN_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}

jobs:
publish:
runs-on: ubuntu-latest
if: ${{ inputs.version != null }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-tags: true

- name: 📥 Install
uses: ./.github/actions/install

- uses: bufbuild/[email protected]
with:
github_token: ${{ github.token }}

- uses: actions/setup-go@v5
with:
go-version: "stable"

- name: Install protoc-gen-openapi
run: go install github.com/google/gnostic/cmd/[email protected]

- name: 🧪 Build
run: pnpm --filter=${{ env.PACKAGE_NAME }} compile

- name: 🧪 Test
run: pnpm --filter=${{ env.PACKAGE_NAME }} test

- name: Publish @fern-api/typescript-dynamic-snippets
run: |
cd generators/typescript-v2/dynamic-snippets
pnpm --filter=${{ env.PACKAGE_NAME }} dist ${{ inputs.version }}
cd dist
echo "//registry.npmjs.org/:_authToken=${{ env.NPM_TOKEN }}" > ~/.npmrc
npm publish --access public
8 changes: 6 additions & 2 deletions .github/workflows/python-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ on:

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

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.5

- name: Install Dependencies
working-directory: ./generators/python
Expand All @@ -31,13 +33,15 @@ jobs:
run: poetry run pre-commit run --all-files

test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.5

- name: Update models for testing
working-directory: ./generators/python
Expand Down
Loading

0 comments on commit 04dfda4

Please sign in to comment.