-
Notifications
You must be signed in to change notification settings - Fork 3.6k
chore: splits out smoke-tests from publish-dryrun tests #8069
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
abfbc75
fix smokes
reggi fab233d
fix run
reggi 4ab57e5
undo package changes
reggi e35c62b
use hbs template
reggi 9d4a123
chore: run smoke tests and publish dryrun on pr
reggi ade331d
removes matrix, and publish dry-run
reggi f5d401a
fix script put back matrix for release only
reggi cbc895f
fix names
reggi 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 hidden or 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 hidden or 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 hidden or 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,82 @@ | ||
#!/usr/bin/env bash | ||
reggi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
set -eo pipefail | ||
|
||
IS_LOCAL="false" | ||
IS_CI="true" | ||
|
||
if [ -z "$CI" ]; then | ||
echo "Running locally will overwrite your globally installed npm." | ||
GITHUB_SHA=$(git rev-parse HEAD) | ||
RUNNER_TEMP=$(mktemp -d) | ||
IS_LOCAL="true" | ||
IS_CI="false" | ||
fi | ||
|
||
if [ -z "$GITHUB_SHA" ]; then | ||
echo "Error: GITHUB_SHA is required" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$RUNNER_TEMP" ]; then | ||
echo "Error: RUNNER_TEMP is required" | ||
exit 1 | ||
fi | ||
|
||
ORIGINAL_GLOBAL_NPM_VERSION=$(npm --version) | ||
if [ ${#ORIGINAL_GLOBAL_NPM_VERSION} -gt 40 ]; then | ||
echo "Error: Global npm version already contains a git SHA ${ORIGINAL_GLOBAL_NPM_VERSION}" | ||
exit 1 | ||
fi | ||
|
||
ORIGINAL_LOCAL_NPM_VERSION=$(node . --version) | ||
if [ ${#ORIGINAL_LOCAL_NPM_VERSION} -gt 40 ]; then | ||
echo "Error: Local npm version already contains a git SHA ${ORIGINAL_LOCAL_NPM_VERSION}" | ||
exit 1 | ||
fi | ||
NPM_VERSION="$ORIGINAL_LOCAL_NPM_VERSION-$GITHUB_SHA.0" | ||
|
||
# Only cleanup locally | ||
if [ "$IS_LOCAL" == "true" ]; then | ||
function cleanup { | ||
npm pkg set version=$ORIGINAL_LOCAL_NPM_VERSION | ||
node scripts/resetdeps.js | ||
if [ "$(git rev-parse HEAD)" != "$GITHUB_SHA" ]; then | ||
echo "===================================" | ||
echo "===================================" | ||
echo "HEAD is on a different commit." | ||
echo "===================================" | ||
echo "===================================" | ||
fi | ||
if [ "$(npm --version)" == "$NPM_VERSION" ]; then | ||
echo "===================================" | ||
echo "===================================" | ||
echo "Global npm version has changed to $NPM_VERSION" | ||
echo "Run the following to change it back" | ||
echo "npm install npm@$ORIGINAL_GLOBAL_NPM_VERSION -g" | ||
echo "===================================" | ||
echo "===================================" | ||
fi | ||
} | ||
trap cleanup EXIT | ||
fi | ||
|
||
# Version the local source of npm with the current git sha and | ||
# and pack and install it globally the same way we would if we | ||
# were publishing it to the registry. The only difference is in the | ||
# publish.js script which will only pack and not publish | ||
node . version $NPM_VERSION --ignore-scripts --git-tag-version="$IS_CI" | ||
node . pack . --pack-destination "$RUNNER_TEMP" | ||
NPM_TARBALL="$RUNNER_TEMP/npm-$NPM_VERSION.tgz" | ||
node . install --global $NPM_TARBALL | ||
|
||
# Only run the tests if we are sure we have the right version | ||
# otherwise the tests being run are pointless | ||
NPM_GLOBAL_VERSION="$(npm --version)" | ||
if [ "$NPM_GLOBAL_VERSION" != "$NPM_VERSION" ]; then | ||
echo "global npm is not the correct version for smoke-publish" | ||
echo "found: $NPM_GLOBAL_VERSION, expected: $NPM_VERSION" | ||
exit 1 | ||
fi | ||
|
||
node scripts/publish.js --pack-destination=$RUNNER_TEMP --smoke-publish=true |
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1,23 +1,45 @@ | ||
{{> ciReleaseYml }} | ||
{{> ciReleaseYml }} | ||
|
||
smoke-publish: | ||
# This cant be tested on Windows because our node_modules directory | ||
# checks in symlinks which are not supported there. This should be | ||
# fixed somehow, because this means some forms of local development | ||
# are likely broken on Windows as well. | ||
{{> jobMatrixYml | ||
jobName="Smoke Publish" | ||
jobCheckout=(obj ref="${{ inputs.ref }}") | ||
jobCreateCheck=(obj sha="${{ inputs.check-sha }}") | ||
windowsCI=false | ||
macCI=false | ||
}} | ||
- name: Smoke Publish | ||
run: ./scripts/smoke-publish-test.sh | ||
- name: Conclude Check | ||
uses: LouisBrunner/checks-action@v1.6.0 | ||
if: steps.create-check.outputs.check-id && always() | ||
with: | ||
token: $\{{ secrets.GITHUB_TOKEN }} | ||
conclusion: $\{{ job.status }} | ||
check_id: $\{{ steps.create-check.outputs.check-id }} | ||
smoke-tests: | ||
# This cant be tested on Windows because our node_modules directory | ||
# checks in symlinks which are not supported there. This should be | ||
# fixed somehow, because this means some forms of local development | ||
# are likely broken on Windows as well. | ||
{{> jobMatrixYml | ||
jobName="Smoke Publish" | ||
jobCheckout=(obj ref="${{ inputs.ref }}") | ||
jobCreateCheck=(obj sha="${{ inputs.check-sha }}") | ||
windowsCI=false | ||
macCI=false | ||
}} | ||
- name: Smoke Tests | ||
run: ./scripts/smoke-tests.sh | ||
- name: Conclude Check | ||
uses: LouisBrunner/checks-action@v1.6.0 | ||
if: steps.create-check.outputs.check-id && always() | ||
with: | ||
token: $\{{ secrets.GITHUB_TOKEN }} | ||
conclusion: $\{{ job.status }} | ||
check_id: $\{{ steps.create-check.outputs.check-id }} | ||
|
||
publish-dryrun: | ||
# This cant be tested on Windows because our node_modules directory | ||
# checks in symlinks which are not supported there. This should be | ||
# fixed somehow, because this means some forms of local development | ||
# are likely broken on Windows as well. | ||
{{> jobMatrixYml | ||
jobName="Smoke Publish" | ||
jobCheckout=(obj ref="${{ inputs.ref }}") | ||
jobCreateCheck=(obj sha="${{ inputs.check-sha }}") | ||
windowsCI=false | ||
macCI=false | ||
}} | ||
- name: Publish Dry-Run | ||
run: ./scripts/publish-dryrun.sh | ||
- name: Conclude Check | ||
uses: LouisBrunner/checks-action@v1.6.0 | ||
if: steps.create-check.outputs.check-id && always() | ||
with: | ||
token: $\{{ secrets.GITHUB_TOKEN }} | ||
conclusion: $\{{ job.status }} | ||
check_id: $\{{ steps.create-check.outputs.check-id }} |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.