From 133059db5dee398ac14c4b6946759c9cb2055cd2 Mon Sep 17 00:00:00 2001 From: Qiwei Yang Date: Wed, 13 Sep 2023 10:56:43 +0800 Subject: [PATCH 1/8] deploy web-test to pages --- .github/workflows/deploy-web-test.yml | 68 +++++++++++++++++++++++++++ packages/web-test/package.json | 1 + packages/web-test/vite.config.js | 1 + 3 files changed, 70 insertions(+) create mode 100644 .github/workflows/deploy-web-test.yml diff --git a/.github/workflows/deploy-web-test.yml b/.github/workflows/deploy-web-test.yml new file mode 100644 index 00000000..bdc45b7a --- /dev/null +++ b/.github/workflows/deploy-web-test.yml @@ -0,0 +1,68 @@ +name: Deploy Web Test + +on: + push: + branches: + - master + pull-request: + branches: + - master + +# Grant GITHUB_TOKEN the permissions required to make a Pages deployment +permissions: + contents: read + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + executor/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install toolchain + uses: dtolnay/rust-toolchain@nightly + with: + toolchain: nightly-2022-10-30 + components: rustfmt + target: wasm32-unknown-unknown + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: 'yarn' + - name: Build packages + - run: | + yarn --immutable + yarn check + yarn build-wasm + yarn build + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: './packages/web-test/dist' + + deploy: + # Add a dependency to the build job + needs: build + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/packages/web-test/package.json b/packages/web-test/package.json index a51af2aa..0e4ac552 100644 --- a/packages/web-test/package.json +++ b/packages/web-test/package.json @@ -4,6 +4,7 @@ "license": "Apache-2.0", "private": true, "scripts": { + "build": "npx vite build", "vite:serve": "npx vite --port 3000 --host", "parcel:serve": "npx parcel serve index.html --port 3000", "test": "npx playwright test" diff --git a/packages/web-test/vite.config.js b/packages/web-test/vite.config.js index 908f5f08..08e1522e 100644 --- a/packages/web-test/vite.config.js +++ b/packages/web-test/vite.config.js @@ -3,4 +3,5 @@ import tsconfigPaths from 'vite-tsconfig-paths' export default defineConfig({ plugins: [tsconfigPaths()], + base: '/chopsticks-1/', }) From a083b16e982cc58a3f62db478c0e45acb7398183 Mon Sep 17 00:00:00 2001 From: Qiwei Yang Date: Wed, 13 Sep 2023 11:09:31 +0800 Subject: [PATCH 2/8] fix: workflow syntax --- .github/workflows/deploy-web-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-web-test.yml b/.github/workflows/deploy-web-test.yml index bdc45b7a..25beea09 100644 --- a/.github/workflows/deploy-web-test.yml +++ b/.github/workflows/deploy-web-test.yml @@ -4,7 +4,7 @@ on: push: branches: - master - pull-request: + pull_request: branches: - master From 5d99c7d030796055b6a4b07381696c067d5d33d5 Mon Sep 17 00:00:00 2001 From: Qiwei Yang Date: Wed, 13 Sep 2023 11:10:57 +0800 Subject: [PATCH 3/8] fix: workflow syntax --- .github/workflows/deploy-web-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-web-test.yml b/.github/workflows/deploy-web-test.yml index 25beea09..03eaba7b 100644 --- a/.github/workflows/deploy-web-test.yml +++ b/.github/workflows/deploy-web-test.yml @@ -42,7 +42,7 @@ jobs: node-version: 18.x cache: 'yarn' - name: Build packages - - run: | + run: | yarn --immutable yarn check yarn build-wasm From d834e99893fea639ae9bca07d994d235868b598b Mon Sep 17 00:00:00 2001 From: Qiwei Yang Date: Wed, 13 Sep 2023 11:41:44 +0800 Subject: [PATCH 4/8] fix: rename --- .../{deploy-web-test.yml => deploy.yml} | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) rename .github/workflows/{deploy-web-test.yml => deploy.yml} (90%) diff --git a/.github/workflows/deploy-web-test.yml b/.github/workflows/deploy.yml similarity index 90% rename from .github/workflows/deploy-web-test.yml rename to .github/workflows/deploy.yml index 03eaba7b..8765f8ae 100644 --- a/.github/workflows/deploy-web-test.yml +++ b/.github/workflows/deploy.yml @@ -1,12 +1,10 @@ -name: Deploy Web Test +name: Deploy on: push: - branches: - - master + branches: [ master ] pull_request: - branches: - - master + branches: [ master ] # Grant GITHUB_TOKEN the permissions required to make a Pages deployment permissions: @@ -15,8 +13,9 @@ permissions: id-token: write # to verify the deployment originates from an appropriate source jobs: - build: + setup: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 with: @@ -54,7 +53,7 @@ jobs: with: path: './packages/web-test/dist' - deploy: + deploy-web-test: # Add a dependency to the build job needs: build # Deploy to the github-pages environment @@ -62,6 +61,9 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest + # Only deploy on pushes to master + if: github.ref == 'refs/heads/deploy-web-test' + steps: - name: Deploy to GitHub Pages id: deployment From 5efa11ff7797204f50fd0c272fa8626daec854d7 Mon Sep 17 00:00:00 2001 From: Qiwei Yang Date: Wed, 13 Sep 2023 11:49:16 +0800 Subject: [PATCH 5/8] fix: action --- .github/workflows/deploy.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8765f8ae..4a40ac77 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -54,8 +54,7 @@ jobs: path: './packages/web-test/dist' deploy-web-test: - # Add a dependency to the build job - needs: build + needs: setup # Deploy to the github-pages environment environment: name: github-pages From 11366c6f4be8747caf7c7b3a9ef9c27d4db9da81 Mon Sep 17 00:00:00 2001 From: Qiwei Yang Date: Wed, 13 Sep 2023 11:58:13 +0800 Subject: [PATCH 6/8] fix --- .github/workflows/deploy.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4a40ac77..661dea79 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,7 +15,6 @@ permissions: jobs: setup: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 with: @@ -61,8 +60,7 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest # Only deploy on pushes to master - if: github.ref == 'refs/heads/deploy-web-test' - + if: ${{ github.ref_name == 'deploy-web-test' }} steps: - name: Deploy to GitHub Pages id: deployment From c931fae5cba032479af2f06bafc1faeff71a5b6e Mon Sep 17 00:00:00 2001 From: Qiwei Yang Date: Wed, 13 Sep 2023 12:05:48 +0800 Subject: [PATCH 7/8] fix --- .github/workflows/deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 661dea79..f39127c4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -59,8 +59,6 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest - # Only deploy on pushes to master - if: ${{ github.ref_name == 'deploy-web-test' }} steps: - name: Deploy to GitHub Pages id: deployment From bd02c399b7dadd789c4160e74dd93ca67dea4cf7 Mon Sep 17 00:00:00 2001 From: Qiwei Yang Date: Wed, 13 Sep 2023 12:51:26 +0800 Subject: [PATCH 8/8] fix for upstream --- .github/workflows/deploy.yml | 2 -- packages/web-test/vite.config.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f39127c4..3c1af7c7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,8 +3,6 @@ name: Deploy on: push: branches: [ master ] - pull_request: - branches: [ master ] # Grant GITHUB_TOKEN the permissions required to make a Pages deployment permissions: diff --git a/packages/web-test/vite.config.js b/packages/web-test/vite.config.js index 08e1522e..892c8993 100644 --- a/packages/web-test/vite.config.js +++ b/packages/web-test/vite.config.js @@ -3,5 +3,5 @@ import tsconfigPaths from 'vite-tsconfig-paths' export default defineConfig({ plugins: [tsconfigPaths()], - base: '/chopsticks-1/', + base: '/chopsticks/', })