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

github(workflows): add package size checks, add auto demo deploy #1048

Merged
merged 45 commits into from
Feb 9, 2021

Conversation

williaster
Copy link
Collaborator

@williaster williaster commented Feb 5, 2021

🏠 Internal

Trying to automate some more workflows, this PR updates our github workflow to

  • split out the CI workflow into push + pull_request workflows since this difference is more relevant now
  • updates the pull_request workflow to
    • run a node script to compute and post package size diffs on PRs
  • updates the push workflow to
    • not run lint, jest, code coverage, or happo on this action type
    • commit package size file
    • auto-deploy the demo site upon PR merge

@kristw @hshoff

@williaster williaster added this to the 1.5.0 milestone Feb 5, 2021
.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Feb 5, 2021

Pull Request Test Coverage Report for Build 541442101

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 61.824%

Totals Coverage Status
Change from base Build 538820361: 0.0%
Covered Lines: 1791
Relevant Lines: 2758

💛 - Coveralls

"type-one": "nimbus typescript --build",
"prepare-release": "git checkout master && git pull --rebase origin master && lerna updated",
"release": "yarn run prepare-release && lerna publish --exact"
"ts": "ts-node --project ./tsconfig.node.json",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ts-node allows running TypeScript scripts. requires the TS config to understand commonjs module format.

@williaster williaster marked this pull request as draft February 5, 2021 02:37
@williaster williaster marked this pull request as ready for review February 5, 2021 02:57
@williaster williaster closed this Feb 5, 2021
@williaster williaster reopened this Feb 5, 2021
@@ -67,7 +67,8 @@ export default function Example({
showControls = true,
}: AxisProps) {
// use non-animated components if prefers-reduced-motion is set
const prefersReducedMotionQuery = window?.matchMedia('(prefers-reduced-motion: reduce)');
const prefersReducedMotionQuery =
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

window.? was throwing in next's SSR environment

@williaster
Copy link
Collaborator Author

@hshoff @kristw this should finally be good to go. I validated that the push step on this branch before updating to master, and tested the gh-pages logic on a [gh-test`](https://github.com/airbnb/visx/tree/gh-test) branch.

Had to go through a bunch of hoops to create gh-pages as a worktree within master (left a lot of comments so hopefully it's readable by all).

@kristw
Copy link
Collaborator

kristw commented Feb 9, 2021

still failing?
image

@github-actions
Copy link

github-actions bot commented Feb 9, 2021

Size Changes

Package Diff ESM Prev ESM CJS Prev CJS
visx-axis +0.1% 20.24 KB 20.22 KB 24.54 KB 24.52 KB
visx-visx 🔻 -42.5% 970 B 1.65 KB 8.05 KB 11.18 KB

Compared to master. File sizes are unminified and ungzipped.

View raw build stats

Previous (master)

{
  "visx-annotation": {
    "esm": 27301,
    "lib": 37249
  },
  "visx-axis": {
    "esm": 20708,
    "lib": 25108
  },
  "visx-bounds": {
    "esm": 2842,
    "lib": 3264
  },
  "visx-brush": {
    "esm": 44087,
    "lib": 47832
  },
  "visx-chord": {
    "esm": 3459,
    "lib": 4688
  },
  "visx-clip-path": {
    "esm": 4421,
    "lib": 5978
  },
  "visx-curve": {
    "esm": 323,
    "lib": 1464
  },
  "visx-demo": {
    "esm": 0,
    "lib": 0
  },
  "visx-drag": {
    "esm": 6263,
    "lib": 8300
  },
  "visx-event": {
    "esm": 3797,
    "lib": 5172
  },
  "visx-geo": {
    "esm": 12986,
    "lib": 16246
  },
  "visx-glyph": {
    "esm": 14893,
    "lib": 19789
  },
  "visx-gradient": {
    "esm": 17800,
    "lib": 22517
  },
  "visx-grid": {
    "esm": 8565,
    "lib": 10291
  },
  "visx-group": {
    "esm": 1619,
    "lib": 2246
  },
  "visx-heatmap": {
    "esm": 7286,
    "lib": 8622
  },
  "visx-hierarchy": {
    "esm": 12266,
    "lib": 18076
  },
  "visx-legend": {
    "esm": 26999,
    "lib": 34033
  },
  "visx-marker": {
    "esm": 8962,
    "lib": 11197
  },
  "visx-mock-data": {
    "esm": 326005,
    "lib": 329416
  },
  "visx-network": {
    "esm": 4546,
    "lib": 6706
  },
  "visx-pattern": {
    "esm": 11779,
    "lib": 15910
  },
  "visx-point": {
    "esm": 819,
    "lib": 1094
  },
  "visx-react-spring": {
    "esm": 13450,
    "lib": 17991
  },
  "visx-responsive": {
    "esm": 21872,
    "lib": 26932
  },
  "visx-scale": {
    "esm": 18443,
    "lib": 29701
  },
  "visx-shape": {
    "esm": 83000,
    "lib": 103973
  },
  "visx-stats": {
    "esm": 13911,
    "lib": 15494
  },
  "visx-text": {
    "esm": 8413,
    "lib": 10624
  },
  "visx-threshold": {
    "esm": 2911,
    "lib": 3820
  },
  "visx-tooltip": {
    "esm": 14147,
    "lib": 20326
  },
  "visx-visx": {
    "esm": 1687,
    "lib": 11449
  },
  "visx-voronoi": {
    "esm": 2286,
    "lib": 3005
  },
  "visx-xychart": {
    "esm": 166614,
    "lib": 231961
  },
  "visx-zoom": {
    "esm": 15726,
    "lib": 17398
  }
}

Current

{
  "visx-annotation": {
    "esm": 27301,
    "lib": 37327
  },
  "visx-axis": {
    "esm": 20727,
    "lib": 25127
  },
  "visx-bounds": {
    "esm": 2842,
    "lib": 3264
  },
  "visx-brush": {
    "esm": 44087,
    "lib": 47832
  },
  "visx-chord": {
    "esm": 3459,
    "lib": 4688
  },
  "visx-clip-path": {
    "esm": 4421,
    "lib": 5978
  },
  "visx-curve": {
    "esm": 323,
    "lib": 1464
  },
  "visx-demo": {
    "esm": 0,
    "lib": 0
  },
  "visx-drag": {
    "esm": 6263,
    "lib": 8300
  },
  "visx-event": {
    "esm": 3797,
    "lib": 5172
  },
  "visx-geo": {
    "esm": 12986,
    "lib": 16246
  },
  "visx-glyph": {
    "esm": 14893,
    "lib": 19789
  },
  "visx-gradient": {
    "esm": 17800,
    "lib": 22517
  },
  "visx-grid": {
    "esm": 8565,
    "lib": 10291
  },
  "visx-group": {
    "esm": 1619,
    "lib": 2246
  },
  "visx-heatmap": {
    "esm": 7286,
    "lib": 8622
  },
  "visx-hierarchy": {
    "esm": 12266,
    "lib": 18076
  },
  "visx-legend": {
    "esm": 26999,
    "lib": 34033
  },
  "visx-marker": {
    "esm": 8962,
    "lib": 11197
  },
  "visx-mock-data": {
    "esm": 326005,
    "lib": 329416
  },
  "visx-network": {
    "esm": 4546,
    "lib": 6706
  },
  "visx-pattern": {
    "esm": 11779,
    "lib": 15910
  },
  "visx-point": {
    "esm": 819,
    "lib": 1094
  },
  "visx-react-spring": {
    "esm": 13450,
    "lib": 17991
  },
  "visx-responsive": {
    "esm": 21872,
    "lib": 26932
  },
  "visx-scale": {
    "esm": 18443,
    "lib": 29701
  },
  "visx-shape": {
    "esm": 83000,
    "lib": 103973
  },
  "visx-stats": {
    "esm": 13911,
    "lib": 15494
  },
  "visx-text": {
    "esm": 8413,
    "lib": 10581
  },
  "visx-threshold": {
    "esm": 2911,
    "lib": 3820
  },
  "visx-tooltip": {
    "esm": 14147,
    "lib": 20413
  },
  "visx-visx": {
    "esm": 970,
    "lib": 8243
  },
  "visx-voronoi": {
    "esm": 2286,
    "lib": 3005
  },
  "visx-xychart": {
    "esm": 166614,
    "lib": 232628
  },
  "visx-zoom": {
    "esm": 15726,
    "lib": 17398
  }
}

@williaster
Copy link
Collaborator Author

^somethings up with the visx/visx package, but I think it will stabilize when this is merged.

# - commit the demo site within gh-pages-root-dir/ onto the gh-pages-branch
# - push gh-pages-branch to visx as gh-pages. we overwrite history every time so it must be forced
run: |
git config user.name github-actions
Copy link
Collaborator

Choose a reason for hiding this comment

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

I usually use this package to handle deployment to github pages.
Would it simplify the script here?
https://www.npmjs.com/package/gh-pages

"scripts": {
  "deploy": "gh-pages -d dist"
}
yarn build
yarn deploy

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Currently we deploy to gh-pages with a simple script in @visx/demo that is similar to these commands. the complexity comes from the creation of a new git worktree without history in the action environment.

tbh I spent so much time on this already I'd rather just leave it. I tried a gh-pages action someone made and it worked, but it requires special handling of credentials which then causes the package size commit to fail. so would have to duplicate the yarn && yarn build steps multiple times which isn't ideal.

@williaster williaster merged commit 3d8a245 into master Feb 9, 2021
@williaster williaster deleted the chris--moar-ci branch February 9, 2021 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants