fix: fix #137 #132
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
pull_request: | |
branches: | |
- '**' | |
paths-ignore: | |
- '**/*.md' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
env: | |
IS_UBUNTU: false | |
NODE_VERSION: v0.0.0 | |
NPM_CACHE_DIR: ~/.npm | |
NPM_VERSION: 0.0.0 | |
jobs: | |
lint: | |
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)')" | |
env: | |
IS_UBUNTU: ${{ contains(matrix.os, 'ubuntu') }} | |
name: lint - ${{ matrix.os }} ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 120 | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
target: [16.x, 18.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: List versions | |
run: | | |
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 | |
id: npm-cache | |
uses: actions/cache@v3 | |
with: | |
# See this glob workaround at https://github.com/actions/toolkit/issues/713. | |
path: | | |
${{ env.NPM_CACHE_DIR }}/* | |
!${{ env.NPM_CACHE_DIR }}/_npx | |
key: ${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }} | |
- name: Install dependencies | |
run: | | |
npm pkg delete scripts.postinstall | |
npm ci | |
sh $(npm root)/@reallyland/tools/list-npx-cache.sh | |
- name: Lint | |
run: | | |
npm run lint:build | |
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)')" | |
env: | |
IS_UBUNTU: ${{ contains(matrix.os, 'ubuntu') }} | |
name: test - ${{ matrix.os }} ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 120 | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
target: [16.x, 18.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# - name: Setup node@${{ matrix.target }} | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: ${{ matrix.target }} | |
- name: List versions | |
run: | | |
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 | |
id: npm-cache | |
uses: actions/cache@v3 | |
with: | |
# See this glob workaround at https://github.com/actions/toolkit/issues/713. | |
path: | | |
${{ env.NPM_CACHE_DIR }}/* | |
!${{ env.NPM_CACHE_DIR }}/_npx | |
key: ${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }} | |
- name: Install dependencies | |
run: | | |
npm pkg delete scripts.postinstall | |
npm ci | |
sh $(npm root)/@reallyland/tools/list-npx-cache.sh | |
- name: Test | |
if: env.IS_UBUNTU == 'false' | |
run: | | |
npm t -- --no-coverage --no-watch | |
- name: Test with coverage | |
if: env.IS_UBUNTU != 'false' | |
run: | | |
npm t -- --color --no-watch | |
- name: Upload coverage to codecov | |
if: env.IS_UBUNTU != 'false' && success() | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage/lcov.info | |
flags: unit_tests | |
bench: | |
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)')" | |
env: | |
IS_UBUNTU: ${{ contains(matrix.os, 'ubuntu') }} | |
name: bench - ${{ matrix.os }} ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 120 | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
target: [16.x, 18.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: List versions | |
run: | | |
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 | |
id: npm-cache | |
uses: actions/cache@v3 | |
with: | |
# See this glob workaround at https://github.com/actions/toolkit/issues/713. | |
path: | | |
${{ env.NPM_CACHE_DIR }}/* | |
!${{ env.NPM_CACHE_DIR }}/_npx | |
key: ${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }} | |
- name: Install dependencies | |
run: | | |
npm pkg delete scripts.postinstall | |
npm ci | |
sh $(npm root)/@reallyland/tools/list-npx-cache.sh | |
- name: Benchmark | |
run: | | |
npm run bench -- --no-watch |