-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Move ICFY stat generation to Github Actions #39646
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
d71fa34
Move ICFY stat generation to Github Actions
blowery 124c601
shell escaping is weird.
blowery d95b6cd
fetch all the revs
blowery b2d40df
fetch all the remotes
blowery 0679ffa
yaml is the best
blowery 37ed21a
Clean up whitespace
sirreal db5a047
Try to get secret right
sirreal 386e16d
Turn off curl globbing
sirreal cf6bcc5
Split out env vars
sirreal ee11449
Store icfy assets
sirreal 9996e28
Optimize head fetching
sirreal c77ef8e
DROPME: Debug sha/branch
sirreal 847eca8
Add from:gh-action for ICFY
sirreal 325a77b
DROPME: Debug workers on GH actions
sirreal a280d48
Limit workers to 2
sirreal 709875e
Files have moved, assume completion
sirreal 3f4ade9
Remove no fail comment
sirreal 61b7a27
Unshallow
sirreal 9f954fa
Allow error
sirreal bf06060
Revert "DROPME: Debug workers on GH actions"
sirreal ff7609b
fixup! Unshallow
sirreal 6eb7023
Remove sha debug
sirreal 77e5c9f
Rename zip
sirreal 0e50332
add github_run_id
blowery 3f1eae4
Pass from param in query, include only GITHUB_RUN_ID in payload
jsnajdr e5c331b
Change from=gh-action to from=github
jsnajdr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Calculate ICFY stats | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
name: Build ICFY stats | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '>=12.15.0' | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Fetch git history | ||
run: git fetch --prune --unshallow | ||
- name: Install dependencies | ||
env: | ||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true | ||
run: npm ci | ||
- name: Build ICFY stats | ||
env: | ||
NODE_ENV: production | ||
BROWSERSLIST_ENV: defaults | ||
WORKERS: 2 | ||
run: npm run analyze-icfy | ||
- run: mkdir icfy-stats && mv client/{chart,stats}.json icfy-stats | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: icfy | ||
path: icfy-stats | ||
- name: Upload build artifact | ||
env: | ||
ICFY_SECRET: ${{ secrets.ICFY_SECRET }} | ||
run: | | ||
ANCESTOR_SHA1=$(git merge-base HEAD origin/master) | ||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
curl -X POST --globoff \ | ||
"http://api.iscalypsofastyet.com:5000/submit-stats?from=github&secret=$ICFY_SECRET" \ | ||
-H 'Cache-Control: no-cache' \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"payload": { | ||
"branch": "'"$CURRENT_BRANCH"'", | ||
"build_num": '"$GITHUB_RUN_ID"', | ||
"sha": "'"$GITHUB_SHA"'", | ||
"ancestor": "'"$ANCESTOR_SHA1"'" | ||
} | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we publish the artifacts as two plain files,
stats.json
andchart.json
? That would be much more convenient for the ICFY client. It now downloads the files directly into memory. Now, it would need to unpack the ZIP to some tmp directory, read the JSON files from there, cleanup at the end...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.
This uses https://github.com/actions/upload-artifact. Docs make it sound like it will always be a zip:
https://help.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts
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.
Doesn't seem like it. https://github.com/actions/upload-artifact
It wants a path to a directory and a name
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.
not sure it helps, but zips can be used as streams with https://www.npmjs.com/package/node-stream-zip
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.
node-stream-zip
can only read from files 🙁 I need something that can read from a generic stream. Will continue looking for another package.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.
Found https://www.npmjs.com/package/unzipper which works great so far 👍