From 9b898c4e9546c186a1f2a15482bf9eb8d9255b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B6=9B?= Date: Mon, 25 Nov 2024 14:36:55 +0800 Subject: [PATCH 1/4] feat: restructure GitHub Actions workflow for site builds and deployments --- .github/workflows/pr-preview.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 750c5c58..65c473cc 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -6,7 +6,7 @@ on: - main jobs: - build-and-deploy: + checkout-install: runs-on: ubuntu-latest steps: @@ -24,21 +24,37 @@ jobs: - name: Set ARCO_SITE_DOMAIN run: echo "ARCO_SITE_DOMAIN=preview-${{ github.event.number }}-arco-design-mobile.surge.sh" >> $GITHUB_ENV + build-home: + runs-on: ubuntu-latest + needs: checkout-install + steps: - name: Build site:home run: npm run site:home env: ARCO_SITE_DOMAIN: ${{ env.ARCO_SITE_DOMAIN }} + build-pc: + runs-on: ubuntu-latest + needs: checkout-install + steps: - name: Build site:pc run: npm run site:pc env: ARCO_SITE_DOMAIN: ${{ env.ARCO_SITE_DOMAIN }} + build-mobile: + runs-on: ubuntu-latest + needs: checkout-install + steps: - name: Build site:mobile run: npm run site:mobile env: ARCO_SITE_DOMAIN: ${{ env.ARCO_SITE_DOMAIN }} + merge-and-deploy: + runs-on: ubuntu-latest + needs: [build-home, build-pc, build-mobile] + steps: - name: Merge output directories run: | # 合并文件 From e62b883e6c33148294ce0cfec4ed15f95e96b1b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B6=9B?= Date: Mon, 25 Nov 2024 14:43:59 +0800 Subject: [PATCH 2/4] feat: consolidate site build jobs into a single concurrent step in GitHub Actions workflow --- .github/workflows/pr-preview.yml | 36 +++++++------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 65c473cc..92e6a0c4 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -6,7 +6,7 @@ on: - main jobs: - checkout-install: + build-and-deploy: runs-on: ubuntu-latest steps: @@ -24,37 +24,15 @@ jobs: - name: Set ARCO_SITE_DOMAIN run: echo "ARCO_SITE_DOMAIN=preview-${{ github.event.number }}-arco-design-mobile.surge.sh" >> $GITHUB_ENV - build-home: - runs-on: ubuntu-latest - needs: checkout-install - steps: - - name: Build site:home - run: npm run site:home - env: - ARCO_SITE_DOMAIN: ${{ env.ARCO_SITE_DOMAIN }} - - build-pc: - runs-on: ubuntu-latest - needs: checkout-install - steps: - - name: Build site:pc - run: npm run site:pc - env: - ARCO_SITE_DOMAIN: ${{ env.ARCO_SITE_DOMAIN }} - - build-mobile: - runs-on: ubuntu-latest - needs: checkout-install - steps: - - name: Build site:mobile - run: npm run site:mobile + - name: Build sites concurrently + run: | + npm run site:home & + npm run site:pc & + npm run site:mobile & + wait env: ARCO_SITE_DOMAIN: ${{ env.ARCO_SITE_DOMAIN }} - merge-and-deploy: - runs-on: ubuntu-latest - needs: [build-home, build-pc, build-mobile] - steps: - name: Merge output directories run: | # 合并文件 From 7fdf5a70c9dc9648e2a6288dced5d601e3298c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B6=9B?= Date: Mon, 25 Nov 2024 14:49:02 +0800 Subject: [PATCH 3/4] feat: removing obsolete test workflow and adding unit test workflow --- .github/workflows/pr-preview.yml | 2 -- .github/workflows/test.yml | 27 --------------------------- .github/workflows/unit-test.yml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/unit-test.yml diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 92e6a0c4..3bdf9cce 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -2,8 +2,6 @@ name: PR Preview on: pull_request: - branches: - - main jobs: build-and-deploy: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 28f84b21..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: test -on: [push, pull_request] - -jobs: - run: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: setup node - uses: actions/setup-node@v2 - with: - node-version: 16 - - - name: install - run: npm install - - - name: test and collect coverage - run: npm run test - - - name: upload coverage to Codecov - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 00000000..203a6366 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,31 @@ +name: Unit Test +on: + push: + branches: + - main + pull_request: + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: setup node + uses: actions/setup-node@v2 + with: + node-version: 16 + + - name: install + run: npm install + + - name: test and collect coverage + run: npm run test + + - name: upload coverage to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 4354eb88ce937cdc2b6dfc97d460d3ddb4d8c6fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B6=9B?= Date: Mon, 25 Nov 2024 14:53:12 +0800 Subject: [PATCH 4/4] feat: rename job from 'run' to 'run-test' in unit test workflow --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 203a6366..82efe44d 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -6,7 +6,7 @@ on: pull_request: jobs: - run: + run-test: runs-on: ubuntu-latest steps: - name: checkout