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
55 changes: 0 additions & 55 deletions .earthlyignore

This file was deleted.

3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_env_if_exists ".envrc.local"
use flake . --impure
dotenv_if_exists ".env"
20 changes: 0 additions & 20 deletions .github/actions/env/action.yml

This file was deleted.

22 changes: 11 additions & 11 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ permissions:
contents: write

jobs:
OpenAPI:
Release:
runs-on: "ubuntu-latest"
steps:
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: "latest"
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
- name: Setup Env
uses: ./.github/actions/env
- name: Generate OpenAPI final specification
run: >
earthly +build-final-spec --version=${{github.ref_name}}
- uses: cachix/install-nix-action@v31
- name: Build OpenAPI spec and events
run: nix develop --impure --command just build ${{github.ref_name}}
env:
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
- name: Create Release
run: gh release create ${{github.ref_name}} --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add the OpenAPI file to the release assets
run: >
run: |
gh release upload ${{github.ref_name}} ./releases/build/generate.json#openapi.json
gh release upload ${{github.ref_name}} ./events/generated/all.json#events.json
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish OpenAPI to Speakeasy Registry
run: nix develop --impure --command speakeasy run -s all --registry-tags ${{github.ref_name}},LATEST_RELEASE
env:
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ worktrees
.env


# Earthly
.tmp-earthly-out
# Downloaded OpenAPI specs
components/
.DS_Store
openapi/node_modules
node_modules/


.kubeconfig
Expand Down
41 changes: 41 additions & 0 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
speakeasyVersion: 1.759.3
sources:
stacks-source:
sourceNamespace: stacks-source
sourceRevisionDigest: sha256:cbe386daae9f188190ef706592b7d8f47d08842b64db2b7425a5f26192c3b80d
sourceBlobDigest: sha256:43596c6d78adb93167d2c34236981efe1f1ed199738110e3e2e9f2b194128db5
tags:
- latest
- SDK_VERSION
targets: {}
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
stacks-source:
inputs:
- location: ./components/auth.openapi.yaml
modelNamespace: auth
- location: ./components/gateway.openapi.yaml
modelNamespace: gateway
- location: ./components/ledger.openapi.yaml
modelNamespace: ledger
- location: ./components/payments.openapi.yaml
modelNamespace: payments
- location: ./components/search.openapi.yaml
modelNamespace: search
- location: ./components/webhooks.openapi.yaml
modelNamespace: webhooks
- location: ./components/wallets.openapi.yaml
modelNamespace: wallets
- location: ./components/orchestration.openapi.yaml
modelNamespace: orchestration
- location: ./components/reconciliation.openapi.yaml
modelNamespace: reconciliation
- location: ./releases/base.yaml
overlays:
- location: ./releases/overlays/shared.overlay.yaml
output: ./releases/build/generate.json
registry:
location: registry.speakeasyapi.dev/formance/formance/stacks-source
targets: {}
30 changes: 30 additions & 0 deletions .speakeasy/workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
stacks-source:
inputs:
- location: ./components/auth.openapi.yaml
modelNamespace: auth
- location: ./components/gateway.openapi.yaml
modelNamespace: gateway
- location: ./components/ledger.openapi.yaml
modelNamespace: ledger
- location: ./components/payments.openapi.yaml
modelNamespace: payments
- location: ./components/search.openapi.yaml
modelNamespace: search
- location: ./components/webhooks.openapi.yaml
modelNamespace: webhooks
- location: ./components/wallets.openapi.yaml
modelNamespace: wallets
- location: ./components/orchestration.openapi.yaml
modelNamespace: orchestration
- location: ./components/reconciliation.openapi.yaml
modelNamespace: reconciliation
- location: ./releases/base.yaml
overlays:
- location: ./releases/overlays/shared.overlay.yaml
output: ./releases/build/generate.json
registry:
location: registry.speakeasyapi.dev/formance/formance/stacks-source
targets: {}
69 changes: 0 additions & 69 deletions Earthfile

This file was deleted.

55 changes: 55 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Component versions
LEDGER_VERSION := "v2.4.3"
PAYMENTS_VERSION := "v3.2.0"
WALLETS_VERSION := "v2.1.5"
WEBHOOKS_VERSION := "v2.2.0"
AUTH_VERSION := "v2.4.3"
SEARCH_VERSION := "v2.1.0"
ORCHESTRATION_VERSION := "v2.4.1"
RECONCILIATION_VERSION := "v2.2.2"
GATEWAY_VERSION := "v2.2.0"

# Download all component OpenAPI specs from GitHub releases
download-specs:
mkdir -p components
wget -q https://github.com/formancehq/ledger/releases/download/{{LEDGER_VERSION}}/openapi.yaml -O components/ledger.openapi.yaml
wget -q https://github.com/formancehq/payments/releases/download/{{PAYMENTS_VERSION}}/openapi.yaml -O components/payments.openapi.yaml
wget -q https://github.com/formancehq/gateway/releases/download/{{GATEWAY_VERSION}}/openapi.yaml -O components/gateway.openapi.yaml
wget -q https://github.com/formancehq/auth/releases/download/{{AUTH_VERSION}}/openapi.yaml -O components/auth.openapi.yaml
wget -q https://github.com/formancehq/search/releases/download/{{SEARCH_VERSION}}/openapi.yaml -O components/search.openapi.yaml
wget -q https://github.com/formancehq/webhooks/releases/download/{{WEBHOOKS_VERSION}}/openapi.yaml -O components/webhooks.openapi.yaml
wget -q https://github.com/formancehq/wallets/releases/download/{{WALLETS_VERSION}}/openapi.yaml -O components/wallets.openapi.yaml
wget -q https://github.com/formancehq/reconciliation/releases/download/{{RECONCILIATION_VERSION}}/openapi.yaml -O components/reconciliation.openapi.yaml
wget -q https://github.com/formancehq/flows/releases/download/{{ORCHESTRATION_VERSION}}/openapi.yaml -O components/orchestration.openapi.yaml

# Prepend API path prefix to each component spec
prepend-paths: download-specs
yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/auth" + .key) | from_entries)' components/auth.openapi.yaml
yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/ledger" + .key) | from_entries)' components/ledger.openapi.yaml
yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/payments" + .key) | from_entries)' components/payments.openapi.yaml
yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/search" + .key) | from_entries)' components/search.openapi.yaml
yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/webhooks" + .key) | from_entries)' components/webhooks.openapi.yaml
yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/wallets" + .key) | from_entries)' components/wallets.openapi.yaml
yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/orchestration" + .key) | from_entries)' components/orchestration.openapi.yaml
yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/reconciliation" + .key) | from_entries)' components/reconciliation.openapi.yaml

# Build the merged OpenAPI spec using Speakeasy
build-openapi version="v0.0.0": prepend-paths
mkdir -p releases/build
speakeasy run -s all
cd releases && sed -i'' -e 's/SDK_VERSION/{{version}}/g' build/generate.json

# Generate event schemas
generate-events:
cd events && npm install
cd events && node index.js

# Build everything (OpenAPI spec + events)
build version="v0.0.0": (build-openapi version) generate-events

# Publish OpenAPI spec to Speakeasy Registry
publish-speakeasy version: prepend-paths
speakeasy run -s all --registry-tags {{version}},LATEST_RELEASE

# Pre-commit: build spec and generate events
pre-commit: (build-openapi) generate-events
60 changes: 0 additions & 60 deletions events/Earthfile

This file was deleted.

Loading
Loading