Skip to content

Commit

Permalink
init: static schemas package (#2225)
Browse files Browse the repository at this point in the history
# Goal
The goal of this PR is create a new js package for schema name and ID
mappings

Closes #2176 

# Discussion
- This only generates data for `dsnp` schemas from chain. The issue is
that currently there is no easy way to get all schema names without
providing namespaces. We can get all using raw state but then we would
need to scale decode it.

---------

Co-authored-by: Joe Caputo <joseph.caputo@unfinished.com>
  • Loading branch information
aramikm and JoeCap08055 authored Nov 21, 2024
1 parent deac3bf commit 0c34adc
Show file tree
Hide file tree
Showing 25 changed files with 4,734 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,35 @@ jobs:
path: js/api-augment/dist
if-no-files-found: error

build-js-schemas:
name: Build JS Schemas
runs-on: ubuntu-22.04
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
- name: Set up NodeJs
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: js/schemas/package-lock.json
- name: Install
run: npm install
working-directory: js/schemas
- name: Build
run: npm run build
working-directory: js/schemas
- name: Upload Dist Dir
uses: actions/upload-artifact@v4
with:
name: js-schemas-${{github.run_id}}
path: js/schemas/dist
if-no-files-found: error

test-version-matches-release:
needs: build-binaries
name: Test Version Matches Release
Expand Down Expand Up @@ -619,6 +648,7 @@ jobs:
test-version-matches-release,
build-rust-developer-docs,
build-js-api-augment,
build-js-schemas,
]
name: Wait for All Builds to Finish
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -1051,3 +1081,44 @@ jobs:
working-directory: ./js/api-augment/dist
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}

release-js-schemas:
needs: wait-for-all-builds
name: Release JS Schemas
runs-on: ubuntu-22.04
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
- name: Set up NodeJs
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: js/schemas/package-lock.json
- name: Download Dist Dir
id: download
uses: actions/download-artifact@v4
with:
name: js-schemas-${{github.run_id}}
path: js/schemas/dist
- name: Version Package
if: env.TEST_RUN != 'true'
run: npm version --new-version "${{env.NEW_RELEASE_TAG}}" --no-git-tag-version
working-directory: js/schemas/dist
- name: Release on NPM @latest
if: env.TEST_RUN != 'true' &&
steps.is-full-release.outputs.is-full-release == 'true'
run: npm publish --tag latest --access public
working-directory: ./js/schemas/dist
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
- name: Release Candidate on NPM
if: env.TEST_RUN != 'true' &&
steps.is-full-release.outputs.is-full-release != 'true'
run: npm publish --tag next --access public
working-directory: ./js/schemas/dist
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
38 changes: 38 additions & 0 deletions .github/workflows/verify-pr-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,44 @@ jobs:
path: js/api-augment/dist/frequency-chain-api-augment-0.0.0.tgz
if-no-files-found: error

verify-js-schemas:
name: Verify JS Schemas
runs-on: ubuntu-22.04
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Set up NodeJs
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: js/schemas/package-lock.json
- name: Install Latest Versions
run: npm install
working-directory: js/schemas
- name: Lint
run: npm run lint
working-directory: js/schemas
- name: Test
run: npm test
working-directory: js/schemas
- name: Build
run: npm run build
working-directory: js/schemas
- name: Publish Dry Run
run: npm publish --dry-run
working-directory: js/schemas/dist
- name: Generate npm tarball
run: npm pack
working-directory: js/schemas/dist
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: artifacts-schemas-${{github.run_id}}
path: js/schemas/dist/frequency-chain-schemas-0.0.0.tgz
if-no-files-found: error

verify-node-docker-images:
needs: build-binaries
name: Verify Node Docker Images
Expand Down
Loading

0 comments on commit 0c34adc

Please sign in to comment.