prebuild before run tests

cache across runs

remove ls command

ignore more scripts

unit test runs too many tests

remove args?

move unit to a separate mocha config file

attempt again?

remove pretest build

feat: update ci

feat: update ci yml

split prebuild to different os

install without building

install without building

fix ci.yml

fix test

add comment
pull/7933/head
tanhauhau 4 years ago
parent 6ac7038e47
commit 312e4ceb00

@ -3,7 +3,40 @@ on: [push, pull_request]
permissions: permissions:
contents: read # to fetch code (actions/checkout) contents: read # to fetch code (actions/checkout)
jobs: jobs:
Setup:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2
with:
node-version: 16
cache: npm
- run: npm install --ignore-scripts
- run: npm run build
env:
PUBLISH: true
- uses: actions/cache@v3
with:
# cache key based on OS as the full path for each OS may be different
# and windows is not able to reuse the cache from ubuntu
key: output-${{ github.run_id }}-${{ matrix.os }}
path: |
index.*
compiler.*
ssr.*
action/
animate/
easing/
internal/
motion/
store/
transition/
types/
Tests: Tests:
needs: Setup
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 15 timeout-minutes: 15
strategy: strategy:
@ -16,7 +49,22 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: npm cache: npm
- run: npm install - uses: actions/cache@v3
with:
key: output-${{ github.run_id }}-${{ matrix.os }}
path: |
index.*
compiler.*
ssr.*
action/
animate/
easing/
internal/
motion/
store/
transition/
types/
- run: npm install --ignore-scripts
- run: npm test - run: npm test
env: env:
CI: true CI: true
@ -40,4 +88,5 @@ jobs:
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
cache: npm cache: npm
- run: 'npm i && npm run test:unit' - run: npm install --ignore-scripts
- run: npm run test:unit

@ -1,7 +1,7 @@
const is_unit_test = process.env.UNIT_TEST;
module.exports = { module.exports = {
file: [ file: is_unit_test ? [] : ['test/test.ts'],
'test/test.ts'
],
require: [ require: [
'sucrase/register' 'sucrase/register'
] ]

@ -0,0 +1,15 @@
module.exports = {
spec: [
'src/**/__test__.ts',
],
require: [
'sucrase/register'
],
recursive: true,
};
// add coverage options when running 'npx c8 mocha'
if (process.env.NODE_V8_COVERAGE) {
module.exports.fullTrace = true;
module.exports.require.push('source-map-support/register');
}

@ -87,14 +87,13 @@
"types": "types/runtime/index.d.ts", "types": "types/runtime/index.d.ts",
"scripts": { "scripts": {
"test": "mocha --exit", "test": "mocha --exit",
"test:unit": "mocha --require sucrase/register --recursive src/**/__test__.ts --exit", "test:unit": "mocha --config .mocharc.unit.js --exit",
"quicktest": "mocha", "quicktest": "mocha --exit",
"build": "rollup -c && npm run tsd", "build": "rollup -c && npm run tsd",
"prepare": "npm run build", "prepare": "npm run build",
"dev": "rollup -cw", "dev": "rollup -cw",
"pretest": "npm run build",
"posttest": "agadoo internal/index.mjs", "posttest": "agadoo internal/index.mjs",
"prepublishOnly": "node check_publish_env.js && npm run lint && npm test", "prepublishOnly": "node check_publish_env.js && npm run lint && npm run build && npm test",
"tsd": "node ./generate-type-definitions.js", "tsd": "node ./generate-type-definitions.js",
"lint": "eslint \"{src,test}/**/*.{ts,js}\"" "lint": "eslint \"{src,test}/**/*.{ts,js}\""
}, },

Loading…
Cancel
Save