Skip to content

Commit

Permalink
chore: upload code-coverage during build process
Browse files Browse the repository at this point in the history
by decoupling test running from publishing; we now always run the tests when pushed to main
this should help us get a correct baseline
  • Loading branch information
TkDodo committed Jan 30, 2023
1 parent aa97c2b commit d37e64e
Show file tree
Hide file tree
Showing 14 changed files with 9 additions and 20 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ jobs:
node-version: 16.14.2
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
- run: |
pnpm --filter "./packages/**" --filter query --prefer-offline install
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- name: Run Tests
run: pnpm run test:ci
- name: Publish
run: |
git config --global user.name 'Tanner Linsley'
git config --global user.email 'tannerlinsley@users.noreply.github.com'
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
Expand All @@ -38,3 +42,5 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
TAG: ${{ inputs.tag }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
"preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...'); process.exit(1)}\" || npx -y only-allow pnpm",
"install:csb": "pnpm install --frozen-lockfile",
"test": "pnpm run test:ci",
"test:ci": "pnpm run test:format && pnpm run test:eslint && pnpm run test:lib:publish && pnpm run test:types",
"test:ci": "pnpm run test:format && pnpm run test:eslint && pnpm run test:lib && pnpm run test:types",
"test:react:17": "pnpm --filter \"./packages/react-*\" run test:lib",
"test:eslint": "pnpm --filter \"./packages/**\" run test:eslint",
"test:format": "pnpm run prettier --check",
"test:lib": "pnpm --filter \"./packages/**\" run test:lib",
"test:lib:dev": "pnpm --filter \"./packages/**\" run test:lib:dev",
"test:lib:publish": "pnpm --filter \"./packages/**\" run test:lib:publish",
"test:size": "pnpm run build && bundlewatch",
"test:types": "pnpm --filter \"./packages/**\" run test:types",
"build": "rollup --config rollup.config.js && pnpm --filter \"./packages/**\" run build && pnpm run build:types",
Expand Down
1 change: 0 additions & 1 deletion packages/eslint-plugin-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"test:types": "tsc",
"test:lib": "jest --config ./jest.config.ts",
"test:lib:dev": "pnpm run test:lib --watch",
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
"build": "tsup --minify"
},
"files": [
Expand Down
1 change: 0 additions & 1 deletion packages/query-async-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"test:types": "tsc",
"test:lib": "jest --config ./jest.config.ts",
"test:lib:dev": "pnpm run test:lib --watch",
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
"build:types": "tsc --build"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/query-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"test:types": "tsc",
"test:lib": "jest --config ./jest.config.ts",
"test:lib:dev": "pnpm run test:lib --watch",
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
"build:types": "tsc --build"
}
}
1 change: 0 additions & 1 deletion packages/query-persist-client-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"test:types": "tsc",
"test:lib": "jest --config ./jest.config.ts",
"test:lib:dev": "pnpm run test:lib --watch",
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
"build:types": "tsc --build"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/query-sync-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"test:types": "tsc",
"test:lib": "jest --config ./jest.config.ts",
"test:lib:dev": "pnpm run test:lib --watch",
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
"build:types": "tsc --build"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/react-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"test:types": "tsc",
"test:lib": "jest --config ./jest.config.ts",
"test:lib:dev": "pnpm run test:lib --watch",
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
"build:types": "tsc --build && cp build/lib/index.d.ts build/lib/index.prod.d.ts"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/react-query-persist-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"test:types": "tsc",
"test:lib": "jest --config ./jest.config.ts",
"test:lib:dev": "pnpm run test:lib --watch",
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
"build:types": "tsc --build"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"test:types": "tsc",
"test:lib": "jest --config ./jest.config.ts",
"test:lib:dev": "pnpm run test:lib --watch",
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
"build:types": "tsc --build"
},
"files": [
Expand Down
2 changes: 0 additions & 2 deletions packages/solid-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
"test:types": "tsc",
"test:lib": "jest --config ./jest.config.ts",
"test:lib:dev": "pnpm run test:lib --watch",
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
"build:types": "tsc --build"
},
"files": [
"build/lib/*",
Expand Down
1 change: 0 additions & 1 deletion packages/svelte-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"test:eslint": "eslint --ext .svelte,.ts ./src",
"test:lib": "vitest run --coverage true",
"test:lib:dev": "vitest watch",
"test:lib:publish": "vitest run --coverage false",
"build": "svelte-package && rimraf ./build/lib/package.json"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/vue-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"test:types": "tsc",
"test:lib": "jest --config ./jest.config.ts",
"test:lib:dev": "pnpm run test:lib --watch",
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
"build:types": "tsc --build"
},
"files": [
Expand Down
4 changes: 0 additions & 4 deletions scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,6 @@ async function run() {
return
}

console.info('Testing packages...')
execSync(`pnpm run test:ci`, { encoding: 'utf8', stdio: 'inherit' })
console.info('')

console.info('Building packages...')
execSync(`pnpm run build`, { encoding: 'utf8', stdio: 'inherit' })
console.info('')
Expand Down

0 comments on commit d37e64e

Please sign in to comment.