From 803336a7c3c06a5ad638267546373a6c2bd349bd Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 13:51:51 +0800 Subject: [PATCH 01/13] feat: add build templates workflow --- .github/workflows/build.yaml | 83 ++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..fbd12f3b --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,83 @@ +name: Build templates + +on: + workflow_dispatch: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + matrix-setup: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Get examples from directories + id: get-matrix + env: + DIRS: '[templates]' # add more dirs here if needed + run: | + # Get examples from each directory + all_examples=$(for dir in $(echo $DIRS | jq -r '.[]'); do + for example in $(ls ./$dir/); do + echo "{\"example\": \"$example\", \"path\": \"$dir\"}" + done + done | jq -s -c '.') + + echo "matrix=$all_examples" >> $GITHUB_OUTPUT + + outputs: + matrix: ${{ steps.get-matrix.outputs.matrix }} + + build: + needs: [matrix-setup] + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + fail-fast: true + matrix: + include: ${{fromJson(needs.matrix-setup.outputs.matrix)}} + env: + EXAMPLE_DIR: ${{ github.workspace }}/dest/${{ matrix.example }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Set up Yarn + uses: threeal/setup-yarn-action@v2.0.0 + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: | + ${{ env.EXAMPLE_DIR }}/node_modules + key: ${{ runner.os }}-modules-${{ matrix.example }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-modules-${{ matrix.example }}- + + - name: Cache NextJS + uses: actions/cache@v4 + with: + path: | + ${{ env.EXAMPLE_DIR }}/.next/cache + key: ${{ runner.os }}-nextjs-${{ matrix.example }}-${{ hashFiles(format('{0}/{1}/**/*.{js,jsx,ts,tsx}', matrix.path, matrix.example)) }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ matrix.example }}- + + - name: Build example + run: | + echo "Building example: ${{ matrix.example }} from /${{ matrix.path }}" + + mkdir -p ${{ env.EXAMPLE_DIR }} + cp -r ./${{ matrix.path }}/${{ matrix.example }}/ ${{ env.EXAMPLE_DIR }} + + cd ${{ env.EXAMPLE_DIR }} + ls -la + yarn install + yarn build From 8e0a63009255bed3f59c9050123d4fdc544af316 Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 14:00:01 +0800 Subject: [PATCH 02/13] fix: build --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fbd12f3b..1fe25b69 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,7 +15,7 @@ jobs: - name: Get examples from directories id: get-matrix env: - DIRS: '[templates]' # add more dirs here if needed + DIRS: '["templates"]' # Add more dirs here if needed run: | # Get examples from each directory all_examples=$(for dir in $(echo $DIRS | jq -r '.[]'); do From 8ed862c1a951abe70cb008fc9d7192c4b54255a8 Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 14:21:04 +0800 Subject: [PATCH 03/13] fix: build --- .github/workflows/build.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1fe25b69..dc13c7b6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -6,7 +6,7 @@ on: types: [opened, reopened, synchronize] jobs: - matrix-setup: + setup: runs-on: ubuntu-latest steps: - name: Checkout repository @@ -30,13 +30,13 @@ jobs: matrix: ${{ steps.get-matrix.outputs.matrix }} build: - needs: [matrix-setup] + needs: [setup] runs-on: ubuntu-latest strategy: max-parallel: 4 fail-fast: true matrix: - include: ${{fromJson(needs.matrix-setup.outputs.matrix)}} + include: ${{fromJson(needs.setup.outputs.matrix)}} env: EXAMPLE_DIR: ${{ github.workspace }}/dest/${{ matrix.example }} @@ -51,6 +51,8 @@ jobs: - name: Set up Yarn uses: threeal/setup-yarn-action@v2.0.0 + with: + version: 4.1.0 - name: Cache dependencies uses: actions/cache@v4 From 29664ad93010f974c3bf6f200ed1312f5ce2ef1f Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 14:37:14 +0800 Subject: [PATCH 04/13] fix: build --- .github/workflows/build.yaml | 2 -- templates/chain-admin/.yarnrc.yml | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 templates/chain-admin/.yarnrc.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dc13c7b6..bbc8ae1c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -51,8 +51,6 @@ jobs: - name: Set up Yarn uses: threeal/setup-yarn-action@v2.0.0 - with: - version: 4.1.0 - name: Cache dependencies uses: actions/cache@v4 diff --git a/templates/chain-admin/.yarnrc.yml b/templates/chain-admin/.yarnrc.yml new file mode 100644 index 00000000..e77cd95f --- /dev/null +++ b/templates/chain-admin/.yarnrc.yml @@ -0,0 +1,9 @@ +nodeLinker: node-modules + +logFilters: + # Suppress "has no field" type-checking warnings + - code: YN0002 + level: discard + # Suppress "missing peer dependency" warnings + - code: YN0086 + level: discard From 76b4ab64dae32175fb1ebf44caa82db2098fb989 Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 14:50:12 +0800 Subject: [PATCH 05/13] fix: types --- templates/chain-admin/package.json | 2 +- templates/chain-admin/yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/templates/chain-admin/package.json b/templates/chain-admin/package.json index 827eb2ce..d45acd2d 100644 --- a/templates/chain-admin/package.json +++ b/templates/chain-admin/package.json @@ -49,7 +49,7 @@ }, "devDependencies": { "@chain-registry/types": "0.44.3", - "@keplr-wallet/types": "^0.12.111", + "@keplr-wallet/types": "0.12.121", "@starship-ci/cli": "^2.10.2", "@tanstack/react-query-devtools": "4.32.0", "@types/node": "18.11.9", diff --git a/templates/chain-admin/yarn.lock b/templates/chain-admin/yarn.lock index 86373972..3a95b4bb 100644 --- a/templates/chain-admin/yarn.lock +++ b/templates/chain-admin/yarn.lock @@ -2300,21 +2300,21 @@ __metadata: languageName: node linkType: hard -"@keplr-wallet/types@npm:0.12.28": - version: 0.12.28 - resolution: "@keplr-wallet/types@npm:0.12.28" +"@keplr-wallet/types@npm:0.12.121": + version: 0.12.121 + resolution: "@keplr-wallet/types@npm:0.12.121" dependencies: long: "npm:^4.0.0" - checksum: 10c0/a541088e55ee0a57ac0e5a9c56e8b788d6325f438fcb4f0a478ba4ce76e336660774d8373a2c3dc6b53e4c6d7b5d91be3128102f340728c71a25448d35245980 + checksum: 10c0/8e7927b70cea95f9f78550a27f1233bde9b929edf1b1e4fe387be4e5e46f064dd26227a2217acb0130c49730825b28a5f583028ab6bb24a370087c65ca9a36eb languageName: node linkType: hard -"@keplr-wallet/types@npm:^0.12.111": - version: 0.12.111 - resolution: "@keplr-wallet/types@npm:0.12.111" +"@keplr-wallet/types@npm:0.12.28": + version: 0.12.28 + resolution: "@keplr-wallet/types@npm:0.12.28" dependencies: long: "npm:^4.0.0" - checksum: 10c0/45988cafc2ae3197509c78545b50f8e37bb47290ed566ea85f501eb47c608f0b67339f3a7badae6e79e04db7dbd5c6f8ef6904ad6e518c900650fdb984d41338 + checksum: 10c0/a541088e55ee0a57ac0e5a9c56e8b788d6325f438fcb4f0a478ba4ce76e336660774d8373a2c3dc6b53e4c6d7b5d91be3128102f340728c71a25448d35245980 languageName: node linkType: hard @@ -5886,7 +5886,7 @@ __metadata: "@cosmos-kit/react": "npm:2.18.0" "@interchain-ui/react": "npm:1.23.31" "@interchain-ui/react-no-ssr": "npm:0.1.2" - "@keplr-wallet/types": "npm:^0.12.111" + "@keplr-wallet/types": "npm:0.12.121" "@starship-ci/cli": "npm:^2.10.2" "@tanstack/react-query": "npm:4.32.0" "@tanstack/react-query-devtools": "npm:4.32.0" From 467a016e3c77200ec5727289d5430aa5d6310a67 Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 15:16:27 +0800 Subject: [PATCH 06/13] fix: build --- .github/workflows/build.yaml | 2 +- templates/chain-admin/.yarnrc.yml | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 templates/chain-admin/.yarnrc.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bbc8ae1c..939eb740 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -79,5 +79,5 @@ jobs: cd ${{ env.EXAMPLE_DIR }} ls -la - yarn install + yarn install --immutable=false yarn build diff --git a/templates/chain-admin/.yarnrc.yml b/templates/chain-admin/.yarnrc.yml deleted file mode 100644 index e77cd95f..00000000 --- a/templates/chain-admin/.yarnrc.yml +++ /dev/null @@ -1,9 +0,0 @@ -nodeLinker: node-modules - -logFilters: - # Suppress "has no field" type-checking warnings - - code: YN0002 - level: discard - # Suppress "missing peer dependency" warnings - - code: YN0086 - level: discard From 159731df77429af7aa351c2d871f1ac7e98f1158 Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 15:20:08 +0800 Subject: [PATCH 07/13] fix: build --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 939eb740..6c0a6247 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -79,5 +79,5 @@ jobs: cd ${{ env.EXAMPLE_DIR }} ls -la - yarn install --immutable=false + yarn install --no-immutable yarn build From 1779e80c14ac24bd592a40148c29f4d6f06b3563 Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 15:29:16 +0800 Subject: [PATCH 08/13] fix: build --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6c0a6247..35a32082 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -39,6 +39,7 @@ jobs: include: ${{fromJson(needs.setup.outputs.matrix)}} env: EXAMPLE_DIR: ${{ github.workspace }}/dest/${{ matrix.example }} + YARN_ENABLE_IMMUTABLE_INSTALLS: false steps: - name: Checkout repository From c4720eab689fda5731ed2222896035b9ac744abe Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 16:02:53 +0800 Subject: [PATCH 09/13] fix: build --- .github/workflows/build.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 35a32082..02144563 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -67,7 +67,12 @@ jobs: with: path: | ${{ env.EXAMPLE_DIR }}/.next/cache - key: ${{ runner.os }}-nextjs-${{ matrix.example }}-${{ hashFiles(format('{0}/{1}/**/*.{js,jsx,ts,tsx}', matrix.path, matrix.example)) }} + key: ${{ runner.os }}-nextjs-${{ matrix.example }}-${{ hashFiles( + '${{ env.EXAMPLE_DIR }}/**/*.{js,jsx,ts,tsx}', + '!${{ env.EXAMPLE_DIR }}/node_modules/**', + '!${{ env.EXAMPLE_DIR }}/.next/**', + '!${{ env.EXAMPLE_DIR }}/.yarn/**' + ) }} restore-keys: | ${{ runner.os }}-nextjs-${{ matrix.example }}- From 37ae60da49d78dd9100df0fdba930b2b667bf02f Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 16:31:27 +0800 Subject: [PATCH 10/13] fix: build --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 02144563..b8a6ba11 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -81,9 +81,9 @@ jobs: echo "Building example: ${{ matrix.example }} from /${{ matrix.path }}" mkdir -p ${{ env.EXAMPLE_DIR }} - cp -r ./${{ matrix.path }}/${{ matrix.example }}/ ${{ env.EXAMPLE_DIR }} - + cp -r ./${{ matrix.path }}/${{ matrix.example }}/* ${{ env.EXAMPLE_DIR }}/ cd ${{ env.EXAMPLE_DIR }} ls -la - yarn install --no-immutable + + yarn install yarn build From 06cae264ce097bca58d393781901c6bf23a62996 Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 17:14:07 +0800 Subject: [PATCH 11/13] feat: cha CLI tests workflow --- .github/workflows/cha-cli-tests.yaml | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/cha-cli-tests.yaml diff --git a/.github/workflows/cha-cli-tests.yaml b/.github/workflows/cha-cli-tests.yaml new file mode 100644 index 00000000..4eef3c6a --- /dev/null +++ b/.github/workflows/cha-cli-tests.yaml @@ -0,0 +1,39 @@ +name: Run Tests Prod + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + run-tests: + runs-on: ubuntu-latest + + steps: + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Set up Yarn + uses: threeal/setup-yarn-action@v2.0.0 + with: + cache: false + + - name: Install Dependencies + run: | + echo "YARN_ENABLE_IMMUTABLE_INSTALLS=false" >> $GITHUB_ENV + npm install -g create-hyperweb-app + + - name: hyperweb + run: | + cha --template hyperweb --name hyperweb + cd hyperweb + yarn build + + - name: chain-admin + run: | + cha --template chain-admin --name chain-admin + cd chain-admin + yarn build From 27e83d6682b79cd9d073b2bc9b76c12005898c33 Mon Sep 17 00:00:00 2001 From: luca Date: Fri, 1 Nov 2024 17:26:42 +0800 Subject: [PATCH 12/13] fix: rename --- .github/workflows/{cha-cli-tests.yaml => prod-tests.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{cha-cli-tests.yaml => prod-tests.yaml} (100%) diff --git a/.github/workflows/cha-cli-tests.yaml b/.github/workflows/prod-tests.yaml similarity index 100% rename from .github/workflows/cha-cli-tests.yaml rename to .github/workflows/prod-tests.yaml From c63bfd9be6fed9a5f7a408678a9437be06e0ed1b Mon Sep 17 00:00:00 2001 From: luca Date: Mon, 4 Nov 2024 19:14:38 +0800 Subject: [PATCH 13/13] fix: build --- templates/chain-admin/package.json | 2 +- templates/chain-admin/yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/templates/chain-admin/package.json b/templates/chain-admin/package.json index d45acd2d..827eb2ce 100644 --- a/templates/chain-admin/package.json +++ b/templates/chain-admin/package.json @@ -49,7 +49,7 @@ }, "devDependencies": { "@chain-registry/types": "0.44.3", - "@keplr-wallet/types": "0.12.121", + "@keplr-wallet/types": "^0.12.111", "@starship-ci/cli": "^2.10.2", "@tanstack/react-query-devtools": "4.32.0", "@types/node": "18.11.9", diff --git a/templates/chain-admin/yarn.lock b/templates/chain-admin/yarn.lock index 3a95b4bb..86373972 100644 --- a/templates/chain-admin/yarn.lock +++ b/templates/chain-admin/yarn.lock @@ -2300,21 +2300,21 @@ __metadata: languageName: node linkType: hard -"@keplr-wallet/types@npm:0.12.121": - version: 0.12.121 - resolution: "@keplr-wallet/types@npm:0.12.121" +"@keplr-wallet/types@npm:0.12.28": + version: 0.12.28 + resolution: "@keplr-wallet/types@npm:0.12.28" dependencies: long: "npm:^4.0.0" - checksum: 10c0/8e7927b70cea95f9f78550a27f1233bde9b929edf1b1e4fe387be4e5e46f064dd26227a2217acb0130c49730825b28a5f583028ab6bb24a370087c65ca9a36eb + checksum: 10c0/a541088e55ee0a57ac0e5a9c56e8b788d6325f438fcb4f0a478ba4ce76e336660774d8373a2c3dc6b53e4c6d7b5d91be3128102f340728c71a25448d35245980 languageName: node linkType: hard -"@keplr-wallet/types@npm:0.12.28": - version: 0.12.28 - resolution: "@keplr-wallet/types@npm:0.12.28" +"@keplr-wallet/types@npm:^0.12.111": + version: 0.12.111 + resolution: "@keplr-wallet/types@npm:0.12.111" dependencies: long: "npm:^4.0.0" - checksum: 10c0/a541088e55ee0a57ac0e5a9c56e8b788d6325f438fcb4f0a478ba4ce76e336660774d8373a2c3dc6b53e4c6d7b5d91be3128102f340728c71a25448d35245980 + checksum: 10c0/45988cafc2ae3197509c78545b50f8e37bb47290ed566ea85f501eb47c608f0b67339f3a7badae6e79e04db7dbd5c6f8ef6904ad6e518c900650fdb984d41338 languageName: node linkType: hard @@ -5886,7 +5886,7 @@ __metadata: "@cosmos-kit/react": "npm:2.18.0" "@interchain-ui/react": "npm:1.23.31" "@interchain-ui/react-no-ssr": "npm:0.1.2" - "@keplr-wallet/types": "npm:0.12.121" + "@keplr-wallet/types": "npm:^0.12.111" "@starship-ci/cli": "npm:^2.10.2" "@tanstack/react-query": "npm:4.32.0" "@tanstack/react-query-devtools": "npm:4.32.0"