Skip to content

Commit

Permalink
ci: add publish workflow and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Aug 7, 2024
1 parent d7a6e4d commit c81118a
Show file tree
Hide file tree
Showing 14 changed files with 842 additions and 75 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: CI

on:
push:
branches:
- main

pull_request:
branches:
- main

workflow_dispatch:

concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/ms-playwright

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

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Set node version to ${{ inputs.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}

- name: Install
run: pnpm i

- name: Lint
run: pnpm run lint

test:
runs-on: ${{ matrix.os }}

timeout-minutes: 30

strategy:
matrix:
os: [ubuntu-latest]
node_version: [20]
include:
- os: macos-14
node_version: 20
- os: windows-latest
node_version: 20
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Set node version to ${{ inputs.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}

- name: Install
run: pnpm i

- name: Install Playwright Dependencies
run: pnpm exec playwright install chromium --with-deps

- name: Build
run: pnpm run build

- name: Test
run: pnpm run test
48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Package

on:
push:
tags:
- 'v*'

permissions:
contents: write
id-token: write

jobs:
publish:
if: github.repository == 'vitest-dev/vitest-browser-utils'
runs-on: ubuntu-latest
environment: Release
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

- name: Publish to npm
run: pnpm run publish-ci ${{ github.ref_name }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Generate Changelog
run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default antfu(
'no-empty-pattern': 'off',
'antfu/indent-binary-ops': 'off',
'unused-imports/no-unused-imports': 'error',
'ts/method-signature-style': 'off',
'style/member-delimiter-style': [
'error',
{
Expand Down
30 changes: 22 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vitest-browser-vue",
"type": "module",
"version": "0.0.1",
"description": "Wrapper around @vue/test-utils for Vitest's Browser Mode",
"description": "Render Vue components in Vitest Browser Mode",
"author": "Vitest Team",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
Expand All @@ -18,6 +18,10 @@
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./pure": {
"types": "./dist/pure.d.ts",
"default": "./dist/pure.js"
}
},
"main": "./dist/index.js",
Expand All @@ -34,25 +38,35 @@
"scripts": {
"build": "tsup",
"dev": "tsup --watch --sourcemap",
"lint": "eslint . --fix"
"test": "vitest",
"publish-ci": "tsx scripts/publish-ci.ts",
"release": "tsx scripts/release.ts",
"lint": "eslint --cache .",
"lint:fix": "pnpm lint --fix"
},
"peerDependencies": {
"@vitest/browser": "^2.0.5",
"vitest": "^2.0.5",
"@vitest/browser": "^2.1.0-beta.1",
"vitest": "^2.1.0-beta.1",
"vue": "^3.0.0"
},
"dependencies": {
"@vitest/pretty-format": "^2.0.5",
"@vitest/pretty-format": "^2.1.0-beta.1",
"@vue/test-utils": "^2.4.6",
"vitest-browser-utils": "^0.0.1"
},
"devDependencies": {
"@antfu/eslint-config": "^2.24.1",
"@vitest/browser": "^2.0.5",
"@vitejs/plugin-vue": "^5.1.2",
"@vitest/browser": "^2.1.0-beta.1",
"bumpp": "^9.4.2",
"changelogithub": "^0.13.9",
"eslint": "^9.8.0",
"playwright": "^1.46.0",
"tsup": "^8.2.4",
"tsx": "^4.16.5",
"typescript": "^5.5.4",
"vitest": "^2.0.5",
"vue": "^3.4.35"
"vitest": "^2.1.0-beta.1",
"vue": "^3.4.35",
"zx": "^8.1.4"
}
}
Loading

0 comments on commit c81118a

Please sign in to comment.