Skip to content

Commit

Permalink
chore: separated ci tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Sep 20, 2024
1 parent e149ba1 commit 177cfe8
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 29 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: build

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

jobs:
test:
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
- name: Install dependencies
run: pnpm install
- run: pnpm run lint
- run: pnpm run prettier . --check

- run: pnpm run build
35 changes: 35 additions & 0 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Any Commit
on:
push:
branches:
- '**'
tags:
- '!**'

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- run: pnpx pkg-pr-new publish --compact --pnpm
35 changes: 17 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
name: Release CI

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI

on:
push:
branches: [main, next, beta]
pull_request:
branches: [main, next, beta]

jobs:
release:
publish:
name: Publish to npm
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
node-version: 20
cache: pnpm
- name: Install dependencies
run: npm ci
- name: Build lib
run: npm run build
- name: Jest run
run: npm run test:unit
- name: Cypress run
run: npm run test:e2e
- name: Release
working-directory: lib
run: pnpm install
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
run: npx semantic-release@22.0.12
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Run Tests
on: [push]

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI

jobs:
test:
name: Tests
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Run Unit tests
run: pnpm run test
- name: Run E2E tests
env:
VITE_ACCESS_TOKEN: ${{ secrets.VITE_ACCESS_TOKEN }}
VITE_OAUTH_TOKEN: ${{ secrets.VITE_OAUTH_TOKEN }}
VITE_SPACE_ID: ${{ vars.VITE_SPACE_ID }}
run: pnpm run build && pnpm run test:e2e
12 changes: 1 addition & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"scripts": {
"dev": "vite build --watch",
"build": "vite build && tsc",
"test": "npm run test:unit && npm run test:e2e",
"test:unit": "vitest run",
"test": "vitest run",
"test:e2e": "start-server-and-test cy:playground http://localhost:5173/ cy:run",
"test:e2e-watch": "start-server-and-test cy:playground http://localhost:5173/ cy:open",
"cy:playground": "npm run demo --prefix ./playground/vanilla",
Expand Down Expand Up @@ -65,15 +64,6 @@
]
]
},
"jest": {
"moduleFileExtensions": [
"js",
"json"
],
"transform": {
"^.+\\.js$": "babel-jest"
}
},
"release": {
"branches": [
"main",
Expand Down

0 comments on commit 177cfe8

Please sign in to comment.