-
-
Notifications
You must be signed in to change notification settings - Fork 717
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
CI improvements #42
CI improvements #42
Conversation
uses: actions/setup-node@v2-beta | ||
with: | ||
node-version: 10 | ||
architecture: x64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these steps are copy/pasted between each job. I went down a rabbit hole of trying to extract them into composite actions working but couldn't get it working. We could also pull them into sequential steps in fewer jobs if we don't care about running them in parallel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing you may want to consider is introducing some simple shell scripts -- this way you will have as little logic as possible inside the workflows themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about this ... you can't factor-out the "checkout", "use node", or "yarn install" steps, so the most promising option looked like moving the "command to run" into the strategy matrix (simplifying multi-step jobs to a single shell script). The problem is they need to produce different artifacts and I couldn't figure out how to get a strategy matrix to bind a variable to multiple values. Any thoughts there? Otherwise I'm inclined to leave as-is for now.
.github/workflows/ci.yml
Outdated
- run: yarn install --frozen-lockfile | ||
- run: yarn run test-expressions | ||
|
||
# TODO: need a new data provider for these to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need map data to run. We should figure out our plan for what where dev map data comes from for local testing before attempting to re-enable this.
- run: yarn run test-expressions | ||
|
||
# TODO this is timing-out | ||
# collect-stats: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collecting performance metrics on each change seems important. I'm not sure exactly what this step is doing, but it hangs forever and likely also needs map data.
"test-unit": "build/run-tap --reporter classic --no-coverage test/unit", | ||
"test-build": "build/run-tap --no-coverage test/build/**/*.test.js", | ||
"test-browser": "build/run-tap --reporter spec --no-coverage test/browser/**/*.test.js", | ||
"test-unit": "cross-env build/run-tap --reporter classic --no-coverage test/unit", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to use cross-env here to get these working on windows. Alternatively could use bash
which seems a bit less robust, but would eliminate adding any dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at some point perhaps we ought to make a decision of not targeting building on Windows at all - will make everyone's life easier :)
path: ./test/integration/query-tests | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
path: ./test/integration/query-tests/index.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any suggestions on making artifacts from the job easily viewable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have had a long discussion with github about this -- you can upload them to artifacts (just like you do here), and use a separate "watcher" job that will be triggered when this job finished. The important difference is that the triggered job (on job completion, or something like that) will run as read-write
, having access to the github write token of the maplibre repo. The PR job on the other hand always runs with a read
token (because someone malicious could create it). So in the triggered follow up job you can inspect the artifacts and post them to the pull request's comments.
types: | ||
- completed | ||
|
||
jobs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nyurik I think I understand github actions permissions a bit better now. I've attempted to implement an action here that reports the bundle size diff in a comment to the PR after the build workflow completes. Does this look reasonable to you? I tested it locally but do you have any ideas on how to test it before landing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I think I got this working - here's an example on a pull request to a separate forked repo: msbarry/maplibre-gl-js-fork#1 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great progress, thanks, left a few minor comments, but i think it is almost ready to merge
.github/workflows/analyze.yml
Outdated
|
||
# Attempt to post a comment with the bundle size report on the PR | ||
# Or update the comment on subsequent changes | ||
- name: Find Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might find https://github.com/marketplace/actions/sticky-pull-request-comment easier for this usecase -- it simply keeps a hidden comment inside the comment, making it easy to post updates to it with one action. Up to you if you want to use it, but it will keep things simpler IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I tried using this. The workflow definitely ends up simpler, but it keeps on appending to the previous version of the comment https://github.com/msbarry/maplibre-gl-js-fork/pull/2#issuecomment-749750812 with this config:
- uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
append: false
path: comment-body.txt
number: ${{ github.event.workflow_run.pull_requests[0].number }}
Any pointers there? Or alternatively, do you think we want it to post new comments/append to the previous comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msbarry I see two edits to that comment. If you look at the raw content of the comment, do you see a hidden comment there with an ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like sticky-pull-request-comment doesn't let you set any yaml boolean property to false due to actions/toolkit#361 - I fixed that issue here marocchino/sticky-pull-request-comment#215
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I recommend removing append: false
part from settings.
- uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
path: comment-body.txt
number: ${{ github.event.workflow_run.pull_requests[0].number }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! Looks like append will correctly default to false. Thanks.
uses: actions/setup-node@v2-beta | ||
with: | ||
node-version: 10 | ||
architecture: x64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing you may want to consider is introducing some simple shell scripts -- this way you will have as little logic as possible inside the workflows themselves.
"test-unit": "build/run-tap --reporter classic --no-coverage test/unit", | ||
"test-build": "build/run-tap --no-coverage test/build/**/*.test.js", | ||
"test-browser": "build/run-tap --reporter spec --no-coverage test/browser/**/*.test.js", | ||
"test-unit": "cross-env build/run-tap --reporter classic --no-coverage test/unit", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at some point perhaps we ought to make a decision of not targeting building on Windows at all - will make everyone's life easier :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome work, love it!
Here's a proposal to fix #39. There's a simple job to ensure you can lint, build, and test on windows and mac then separate more thorough targets (from circleci config on 1.13 branch) that run on ubuntu-latest.
At first I thought it was wasteful to do yarn install on each separate jobs running in parallel, but it seems to be pretty heavily optimized (30-40s) so it would actually take longer to use a cache, or upload/download node_modules as an artifact between runs. The downside here is that yarn install result could be slightly different between these runs. For CI this is probably fine though.
After this PR lands:
Left to do after #21 lands and we have a map data source to use for development