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

[core] Enable the CI #12

Merged
merged 14 commits into from
Apr 16, 2024
98 changes: 49 additions & 49 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ jobs:
- install_js
- run:
name: Tests fake browser
command: pnpm build && pnpm test:coverage:ci
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the script to include the building

- run:
name: Check coverage generated
command: |
if ! [[ -s coverage/lcov.info ]]
then
exit 1
fi
command: pnpm test:coverage:ci
# - run:
mnajdova marked this conversation as resolved.
Show resolved Hide resolved
# name: Check coverage generated
# command: |
# if ! [[ -s coverage/lcov.info ]]
# then
# exit 1
# fi
- run:
name: Coverage
command: |
Expand Down Expand Up @@ -259,37 +259,37 @@ jobs:
# We assume that the target branch is `next` and that declaration files are persisted in commit order.
# "If there are multiple matches, the most recently generated cache will be used."
- typescript-declaration-files-next
test_browser:
<<: *default-job
resource_class: 'medium+'
docker:
- image: mcr.microsoft.com/playwright:v1.43.0-focal
environment:
NODE_ENV: development # Needed if playwright is in `devDependencies`
steps:
- checkout
- install_js:
browsers: true
- run:
name: Tests real browsers
command: pnpm test:karma
- run:
name: Check coverage generated
command: |
if ! [[ -s coverage/lcov.info ]]
then
exit 1
fi
- run:
name: Coverage
command: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${CODECOV_TOKEN} -Z -F "$REACT_VERSION-browser"
- store_artifacts:
# hardcoded in karma-webpack
path: /tmp/_karma_webpack_
destination: artifact-file
# test_browser:
mnajdova marked this conversation as resolved.
Show resolved Hide resolved
# <<: *default-job
# resource_class: 'medium+'
# docker:
# - image: mcr.microsoft.com/playwright:v1.43.0-focal
# environment:
# NODE_ENV: development # Needed if playwright is in `devDependencies`
# steps:
# - checkout
# - install_js:
# browsers: true
# - run:
# name: Tests real browsers
# command: pnpm test:karma
# - run:
# name: Check coverage generated
# command: |
# if ! [[ -s coverage/lcov.info ]]
# then
# exit 1
# fi
# - run:
# name: Coverage
# command: |
# curl -Os https://uploader.codecov.io/latest/linux/codecov
# chmod +x codecov
# ./codecov -t ${CODECOV_TOKEN} -Z -F "$REACT_VERSION-browser"
# - store_artifacts:
# # hardcoded in karma-webpack
# path: /tmp/_karma_webpack_
# destination: artifact-file
test_profile:
<<: *default-job
docker:
Expand Down Expand Up @@ -341,10 +341,10 @@ workflows:
<<: *default-context
requires:
- checkout
- test_browser:
<<: *default-context
requires:
- checkout
# - test_browser:
# <<: *default-context
# requires:
# - checkout
profile:
when:
equal: [profile, << pipeline.parameters.workflow >>]
Expand All @@ -363,9 +363,9 @@ workflows:
- test_unit:
<<: *default-context
react-version: ^17.0.0
- test_browser:
<<: *default-context
react-version: ^17.0.0
# - test_browser:
# <<: *default-context
# react-version: ^17.0.0
react-next:
triggers:
- schedule:
Expand All @@ -378,9 +378,9 @@ workflows:
- test_unit:
<<: *default-context
react-version: next
- test_browser:
<<: *default-context
react-version: next
# - test_browser:
# <<: *default-context
# react-version: next
typescript-next:
triggers:
- schedule:
Expand Down
23 changes: 23 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to add this in the previous PR.

"buildCommand": "build:codesandbox",
"installCommand": "install:codesandbox",
"node": "18",
"packages": [
"packages/pigment-css-react",
"packages/pigment-css-unplugin",
"packages/pigment-css-nextjs-plugin",
"packages/pigment-css-vite-plugin"
],
"publishDirectory": {
"@pigment-css/react": "packages/pigment-css-react/build",
"@pigment-css/unplugin": "packages/pigment-css-unplugin/build",
"@pigment-css/nextjs-plugin": "packages/pigment-css-nextjs-plugin/build",
"@pigment-css/vite-plugin": "packages/pigment-css-vite-plugin/build"
},
"sandboxes": [
"/examples/pigment-css-nextjs-ts",
"/examples/pigment-css-remix-ts",
"/examples/pigment-css-vite-ts"
],
"silent": true
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
"test": "node scripts/test.mjs",
"tc": "node test/cli.js",
"test:extended": "pnpm eslint && pnpm typescript && pnpm test:coverage",
"test:coverage": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=text mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}'",
"test:coverage:ci": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=lcov mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}'",
"test:coverage:html": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=html mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}'",
"test:karma": "cross-env NODE_ENV=test karma start test/karma.conf.js",
"test:karma:profile": "cross-env NODE_ENV=test karma start test/karma.conf.profile.js",
"test:coverage": "pnpm build && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=text mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}'",
"test:coverage:ci": "pnpm build && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=lcov mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}'",
"test:coverage:html": "pnpm build && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=html mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}'",
"test:karma": "pnpm build && cross-env NODE_ENV=test karma start test/karma.conf.js",
"test:karma:profile": "pnpm build && cross-env NODE_ENV=test karma start test/karma.conf.profile.js",
"test:regressions": "cross-env NODE_ENV=production pnpm test:regressions:build && concurrently --success first --kill-others \"pnpm test:regressions:run\" \"pnpm test:regressions:server\"",
"test:regressions:build": "webpack --config test/regressions/webpack.config.js",
"test:regressions:dev": "concurrently \"pnpm test:regressions:build --watch\" \"pnpm test:regressions:server\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/pigment-css-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"watch": "tsup --watch --clean false",
"copy-license": "node ../../scripts/pigment-license.mjs",
"build": "tsup",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/pigment-css-react/**/*.test.{js,ts,tsx}'",
"test": "cd ../../ && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=text mocha 'packages/pigment-css-react/**/*.test.{js,ts,tsx}'",
"test:update": "cd ../../ && cross-env NODE_ENV=test UPDATE_FIXTURES=true mocha 'packages/pigment-css-react/**/*.test.{js,ts,tsx}'",
"test:ci": "cd ../../ && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=lcov --report-dir=./coverage/pigment-css-react mocha 'packages/pigment-css-react/**/*.test.{js,ts,tsx}'",
"typecheck": "tsc --noEmit -p ."
Expand Down
2 changes: 1 addition & 1 deletion test/karma.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '@mui/internal-test-utils/init';
import '@mui/internal-test-utils/setupKarma';

const pigmentCssContext = require.context(
'../packages/pigment-css-react/src/',
'../packages/pigment-css-react/tests/',
true,
/\.test\.(js|ts|tsx)$/,
);
Expand Down