Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: migrate to playwright #1576

Merged
merged 12 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 11 additions & 11 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [["@milkdown/*"]],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [["@milkdown/*"]],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
}
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ We appreciate you spending the time to work on these changes.
⚠️ If you're adding a new plugin, please make sure you've already created issues or discussions where we have discussed about it. Currently we encourage you to publish your own community plugins. And we're very cautious about adding new official plugins.
-->

- [ ] I read the contributing guide <!-- https://github.com/Saul-Mirone/milkdown/blob/main/CONTRIBUTING.md -->
- [ ] I agree to follow the code of conduct <!-- https://github.com/Saul-Mirone/milkdown/blob/main/CODE_OF_CONDUCT.md -->
- [ ] I read the contributing guide <!-- https://github.com/Saul-Mirone/milkdown/blob/main/CONTRIBUTING.md -->
- [ ] I agree to follow the code of conduct <!-- https://github.com/Saul-Mirone/milkdown/blob/main/CODE_OF_CONDUCT.md -->

## Summary

Expand Down
30 changes: 30 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Setup
description: Setup the environment

inputs:
node-version:
description: The version of node.js
required: false
default: '20'

runs:
using: composite
steps:
- uses: pnpm/[email protected]
with:
run_install: false

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: pnpm
registry-url: 'https://registry.npmjs.org'

- name: Install
run: pnpm install
shell: bash

- name: Build packages
run: pnpm build
shell: bash
75 changes: 0 additions & 75 deletions .github/workflows/ci-for-pr.yml

This file was deleted.

61 changes: 16 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,50 @@
name: On Push
name: ci

on:
push:
branches: main
branches: [main]
pull_request:
branches: [main]

env:
CI: true
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
build-test-release:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: setup node.js
uses: actions/setup-node@v4
with:
node-version: 20.11.0

- uses: pnpm/[email protected]
with:
run_install: false

- name: get pnpm store directory
id: pnpm-cache
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: load cache
uses: actions/cache@v4
with:
path: |
~/.cache/Cypress
${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}

- uses: nrwl/nx-set-shas@v4

- run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --require-explicit-completion
- uses: ./.github/actions/setup

- name: install dependencies
run: pnpm install

- name: run unit tests
run: pnpm test:unit

# build all the packages to prepare for release
- name: build packs
run: pnpm build

- name: run lint
run: pnpm test:lint --format github

- name: run unit tests
run: pnpm test:unit
- name: install browsers
run: pnpm --filter=@milkdown/e2e test:install

- name: run cypress
run: pnpm nx affected -t e2e-ci @milkdown/e2e

- run: npx nx-cloud complete-ci-run
if: always()

- name: create versions or publish to npm registry
uses: changesets/action@v1
with:
publish: pnpm release
commit: 'ci(changeset): release milkdown'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: run playwright
run: pnpm test:e2e

- name: Upload test results
- name: upload test results
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-results-main
path: dist/cypress
if-no-files-found: ignore
path: e2e/playwright-report/
retention-days: 7
22 changes: 22 additions & 0 deletions .github/workflows/fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://autofix.ci/setup

name: autofix.ci

on:
pull_request:

permissions:
contents: read

jobs:
fix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/setup

- name: Fix
run: pnpm fix

- uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c
53 changes: 0 additions & 53 deletions .github/workflows/release-package.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: release

on:
push:
branches: [main]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: build packs
run: pnpm build

- name: Create versions or publish to npm registry
uses: changesets/action@v1
with:
publish: pnpm release
commit: 'ci(changeset): release milkdown'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
39 changes: 0 additions & 39 deletions .github/workflows/start-nx-cloud.yml

This file was deleted.

Loading
Loading