Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Add a system/workflow to keep ts interfaces in sync with Zarf structs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Rodriguez committed Oct 27, 2023
1 parent 6c433d8 commit ec05816
Show file tree
Hide file tree
Showing 12 changed files with 2,216 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"node_modules",
"dist",
"hack",
"build"
"build",
"capabilities/zarf-types.ts"
],
"root": true
}
23 changes: 23 additions & 0 deletions .github/workflows/scan-gen-schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Validate Schema Generation
on:
pull_request:

permissions:
contents: read

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0

- name: Setup Go
uses: defenseunicorns/zarf/.github/actions/golang@main

- name: Check that 'make gen-schema' was ran
run: make test-gen-schema

- name: Save logs
if: always()
uses: defenseunicorns/zarf/.github/actions/save-logs@main
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,19 @@ build-module: ## Build the ECR Pepr module
test-module: ## Test the ECR Pepr module
npm run unit-test

# Run "npm ci" in each directory containing a "package.json" file
install-node-deps:
install-node-deps: # Run "npm ci" in each directory containing a "package.json" file
npm ci;
cd iam && npm ci;
cd hack/update-zarf-config && npm ci;

gen-schema: ## Generate TypeScript interfaces from Zarf structs
hack/gen-schema/gen-schema.sh

# INTERNAL: used to test that a dev has ran `make gen-schema` in their PR
test-gen-schema:
$(MAKE) gen-schema
hack/gen-schema/check-gen-schema.sh

# Note: the path to the main.go file is not used due to https://github.com/golang/go/issues/51831#issuecomment-1074188363
build-credential-helper-linux-amd: ## Build the ECR credential helper binary for Linux on AMD64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/zarf-ecr-credential-helper
Expand Down
Loading

0 comments on commit ec05816

Please sign in to comment.