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

Migrate to Vitest #60

Merged
merged 6 commits into from
Jun 26, 2022
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@
"disallowTypeAnnotations": false
}
],
"comma-spacing": "off",
"@typescript-eslint/comma-spacing": [
"error", {
"before": false,
"after": true
}
],
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error"
}
Expand Down
57 changes: 24 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,60 +17,53 @@ defaults:
shell: bash

env:
CI_SKIP: false
GITHUB_COMMIT_MESSAGE: ''
IS_UBUNTU: false
NODE_VERSION: v0.0.0
NPM_CACHE_DIR: ~/.npm
NPM_VERSION: 0.0.0

jobs:
build:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'doc:')"
test:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'docs:') && !contains(github.event.head_commit.message, 'chore(release)')"
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
env:
GITHUB_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
IS_UBUNTU: ${{ contains(matrix.os, 'ubuntu') }}
name: ${{ matrix.os }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
os: [ubuntu-latest]
target: [16.x]

steps:
- name: CI skip check
run: |
if [[ -n "$(echo $GITHUB_COMMIT_MESSAGE | grep -iE '^[0-9]+[.]{1,}[0-9]+[.]{1,}[0-9]+')" ]]; then
echo "[INFO] SKIP CI"
echo "CI_SKIP=true" >> $GITHUB_ENV
fi

- name: Checkout
if: env.CI_SKIP == 'false'
uses: actions/checkout@v2

- name: Setup node@${{ matrix.target }}
if: env.CI_SKIP == 'false'
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.target }}
# - name: Setup node@${{ matrix.target }}
# uses: actions/setup-node@v2
# with:
# node-version: ${{ matrix.target }}

# - name: Install latest npm
# if: env.CI_SKIP == 'false'
# run: |
# npm i -g npm@latest

- name: List versions
if: env.CI_SKIP == 'false'
run: |
pwd && ls -la
echo "IS_UBUNTU=${{ contains(matrix.os, 'ubuntu') }}" >> $GITHUB_ENV
echo "NODE_VERSION=$(node -v)" >> $GITHUB_ENV
echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
echo "NPM_VERSION=$(npm -v)" >> $GITHUB_ENV

echo "${{ github.workflow }}-${{ github.ref || github.run_id }}"
pwd
ls -la
which npm
# npm x -y -- envinfo@latest

- name: Cache dependencies
if: env.CI_SKIP == 'false'
id: npm-cache
uses: actions/cache@v2
with:
Expand All @@ -83,29 +76,27 @@ jobs:
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}

- name: Install dependencies
if: env.CI_SKIP == 'false'
run: |
bash ./list-npx-cache.bash
npm ci
bash ./list-npx-cache.bash
# sh $(npm root)/@reallyland/tools/list-npx-cache.sh
sh ./list-npx-cache.sh

- name: Lint
if: env.CI_SKIP == 'false'
run: |
npm run lint:build

- name: Test
if: env.CI_SKIP == 'false' && env.IS_UBUNTU == 'false'
if: env.IS_UBUNTU == 'false'
run: |
npm t
npm t -- --no-coverage

- name: Test with coverage
if: env.CI_SKIP == 'false' && env.IS_UBUNTU != 'false'
if: env.IS_UBUNTU != 'false'
run: |
npm run test:coverage
npm t

- name: Upload coverage to codecov
if: env.CI_SKIP == 'false' && env.IS_UBUNTU != 'false' && success()
if: env.IS_UBUNTU != 'false' && success()
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
15 changes: 0 additions & 15 deletions .swcrc

This file was deleted.

Loading