From 22d2d046e5e326b7d43b28cb8183df28824291ad Mon Sep 17 00:00:00 2001 From: userquin Date: Mon, 19 Aug 2024 16:34:57 +0200 Subject: [PATCH 1/7] chore: add `pkg-pr-new` --- .github/PULL_REQUEST_TEMPLATE.md | 5 ++++ .github/workflows/cr-comment.yml | 18 +++++++++++++ .github/workflows/cr.yml | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 .github/workflows/cr-comment.yml create mode 100644 .github/workflows/cr.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9204d25b1488..c48924a5f608 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -17,3 +17,8 @@ ### Changesets - [ ] Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with `feat:`, `fix:`, `perf:`, `docs:`, or `chore:`. + +--- + +> [!TIP] +> The author of this PR can publish a _preview release_ by commenting `/publish` below. diff --git a/.github/workflows/cr-comment.yml b/.github/workflows/cr-comment.yml new file mode 100644 index 000000000000..203b7e11a252 --- /dev/null +++ b/.github/workflows/cr-comment.yml @@ -0,0 +1,18 @@ +name: Add continuous release label + +on: + issue_comment: + types: [created] + +permissions: + pull-requests: write + +jobs: + label: + if: ${{ github.event.issue.pull_request && (github.event.comment.user.id == github.event.issue.user.id || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR') && startsWith(github.event.comment.body, '/publish') }} + runs-on: ubuntu-latest + + steps: + - run: gh issue edit ${{ github.event.issue.number }} --add-label cr-tracked --repo ${{ github.repository }} + env: + GITHUB_TOKEN: ${{ secrets.CR_PAT }} diff --git a/.github/workflows/cr.yml b/.github/workflows/cr.yml new file mode 100644 index 000000000000..34d336c94adc --- /dev/null +++ b/.github/workflows/cr.yml @@ -0,0 +1,45 @@ +name: CR + +on: + pull_request: + branches: [main] + types: [opened, synchronize, labeled, ready_for_review] + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number }} + cancel-in-progress: true + +jobs: + release: + if: ${{ !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'cr-tracked') }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Set node version to 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + cache: pnpm + + - name: Install + run: pnpm install --frozen-lockfile --prefer-offline + env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' + + - name: Build + run: pnpm build + env: + NO_VITE_TEST_WATCHER_DEBUG: '1' + + - name: Publish to StackBlitz + run: pnpx pkg-pr-new publish --compact --no-template --pnpm './packages/*' From 514f1c6bc925e921ab8e4c87a8aa467c93ef4906 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Thu, 26 Sep 2024 18:57:27 +0900 Subject: [PATCH 2/7] ci: run cr on main --- .github/workflows/cr.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cr.yml b/.github/workflows/cr.yml index 34d336c94adc..aea12aa57af6 100644 --- a/.github/workflows/cr.yml +++ b/.github/workflows/cr.yml @@ -1,6 +1,8 @@ name: CR on: + push: + branches: [main] pull_request: branches: [main] types: [opened, synchronize, labeled, ready_for_review] @@ -13,7 +15,9 @@ concurrency: jobs: release: - if: ${{ !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'cr-tracked') }} + # - run always on main push + # - for PRs, require non draft and 'cr-tracked' label + if: github.ref === 'refs/heads/main' || (!github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'cr-tracked')) runs-on: ubuntu-latest steps: From beb4a573281228a66f6bd463ccd186fcbe184c5e Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Thu, 26 Sep 2024 18:58:22 +0900 Subject: [PATCH 3/7] chore: remove cr-comment.ymml --- .github/PULL_REQUEST_TEMPLATE.md | 5 ----- .github/workflows/cr-comment.yml | 18 ------------------ 2 files changed, 23 deletions(-) delete mode 100644 .github/workflows/cr-comment.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c48924a5f608..9204d25b1488 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -17,8 +17,3 @@ ### Changesets - [ ] Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with `feat:`, `fix:`, `perf:`, `docs:`, or `chore:`. - ---- - -> [!TIP] -> The author of this PR can publish a _preview release_ by commenting `/publish` below. diff --git a/.github/workflows/cr-comment.yml b/.github/workflows/cr-comment.yml deleted file mode 100644 index 203b7e11a252..000000000000 --- a/.github/workflows/cr-comment.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Add continuous release label - -on: - issue_comment: - types: [created] - -permissions: - pull-requests: write - -jobs: - label: - if: ${{ github.event.issue.pull_request && (github.event.comment.user.id == github.event.issue.user.id || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR') && startsWith(github.event.comment.body, '/publish') }} - runs-on: ubuntu-latest - - steps: - - run: gh issue edit ${{ github.event.issue.number }} --add-label cr-tracked --repo ${{ github.repository }} - env: - GITHUB_TOKEN: ${{ secrets.CR_PAT }} From ea2af4da26615c18276ba43e2701d0b59a62c986 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Thu, 26 Sep 2024 19:06:14 +0900 Subject: [PATCH 4/7] ci: fix action --- .github/workflows/cr.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cr.yml b/.github/workflows/cr.yml index aea12aa57af6..aff0d05714ff 100644 --- a/.github/workflows/cr.yml +++ b/.github/workflows/cr.yml @@ -15,9 +15,7 @@ concurrency: jobs: release: - # - run always on main push - # - for PRs, require non draft and 'cr-tracked' label - if: github.ref === 'refs/heads/main' || (!github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'cr-tracked')) + if: github.ref == 'refs/heads/main' || (!github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'cr-tracked')) runs-on: ubuntu-latest steps: From 4a457899b1e0054961106e9b8812350b835915be Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Fri, 27 Sep 2024 11:02:11 +0900 Subject: [PATCH 5/7] chore: remove non-draft check --- .github/workflows/cr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cr.yml b/.github/workflows/cr.yml index aff0d05714ff..4a9bffa8a36b 100644 --- a/.github/workflows/cr.yml +++ b/.github/workflows/cr.yml @@ -5,7 +5,7 @@ on: branches: [main] pull_request: branches: [main] - types: [opened, synchronize, labeled, ready_for_review] + types: [opened, synchronize, labeled] permissions: {} @@ -15,7 +15,7 @@ concurrency: jobs: release: - if: github.ref == 'refs/heads/main' || (!github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'cr-tracked')) + if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'cr-tracked') runs-on: ubuntu-latest steps: From b6467eb95f0d225dc89b9e187f0695a8a7424b70 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 1 Oct 2024 08:42:42 +0900 Subject: [PATCH 6/7] docs: update --- docs/guide/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/guide/index.md b/docs/guide/index.md index 60bfccbbfc80..311defd89742 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -286,7 +286,9 @@ Thanks for choosing Vitest! ## Using Unreleased Commits -If you can't wait for a new release to test the latest features, you will need to clone the [vitest repo](https://github.com/vitest-dev/vitest) to your local machine and then build and link it yourself ([pnpm](https://pnpm.io/) is required): +Each commit on main branch and a PR with a `cr-tracked` label are published to [pkg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new). You can install it by `npm i https://pkg.pr.new/vitest@{commit}`. + +If you want to test your own modification locally, you can build and link it yourself ([pnpm](https://pnpm.io/) is required): ```bash git clone https://github.com/vitest-dev/vitest.git From 094916af9ee22a3713ca8dacedb239e029845fc4 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 1 Oct 2024 08:46:31 +0900 Subject: [PATCH 7/7] ci: tweak --- .github/workflows/cr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cr.yml b/.github/workflows/cr.yml index 4a9bffa8a36b..0853468a891f 100644 --- a/.github/workflows/cr.yml +++ b/.github/workflows/cr.yml @@ -4,7 +4,6 @@ on: push: branches: [main] pull_request: - branches: [main] types: [opened, synchronize, labeled] permissions: {} @@ -15,7 +14,7 @@ concurrency: jobs: release: - if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'cr-tracked') + if: github.repository == 'vitest-dev/vitest' && (github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'cr-tracked')) runs-on: ubuntu-latest steps: