Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
skip-release
  • Loading branch information
ArcherGu committed Aug 16, 2022
1 parent 536ffaf commit d3a9e32
Show file tree
Hide file tree
Showing 14 changed files with 685 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"overrides": [
{
"files": [
"src/log.ts"
"src/log.ts",
"tests/**/*.ts"
],
"rules": {
"no-console": "off"
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI

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

jobs:
test:
if: '!contains(github.event.head_commit.message, ''skip-ci'')'

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [14.x, 16.x]

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

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Cache ~/.pnpm-store
uses: actions/cache@v3
env:
cache-name: cache-pnpm-store
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.node-version }}-test-
${{ runner.os }}-
- name: Install pnpm
run: npm i -g pnpm

- name: Install deps
run: pnpm i

# Runs a set of commands using the runners shell
- name: Build and Test
run: pnpm build && pnpm test

release:
runs-on: ubuntu-latest
needs: [test]
if: '!contains(github.event.head_commit.message, ''skip-release'') && !contains(github.event.head_commit.message, ''skip-ci'') && github.event_name != ''pull_request'''
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
- name: Cache ~/.pnpm-store
uses: actions/cache@v3
env:
cache-name: cache-pnpm-store
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ matrix.node-version }}-release-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-release-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.node-version }}-release-
${{ runner.os }}-
- run: npm i -g pnpm
- run: pnpm i
- run: pnpx semantic-release --branches main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@
"@types/node": "18.7.5",
"electron": "^20.0.2",
"eslint": "8.22.0",
"execa": "^6.1.0",
"lint-staged": "13.0.3",
"simple-git-hooks": "2.8.0",
"tsup": "6.2.2",
"typescript": "4.7.4",
"vite": "^3.0.7",
"vite-plugin-doubleshot": "0.1.0-beta.1",
"vitest": "0.22.0"
},
"simple-git-hooks": {
Expand Down
Loading

0 comments on commit d3a9e32

Please sign in to comment.