-
Notifications
You must be signed in to change notification settings - Fork 2
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
Basic integration tests #11
Merged
Merged
Changes from 175 commits
Commits
Show all changes
176 commits
Select commit
Hold shift + click to select a range
83e9ef6
WIP: started putting together verdaccio proxy config + CI logic
dherman e30f290
bump versions before building
dherman c1d1779
verbose logs?
dherman 36df2ff
--verbose not -vv
dherman 6cb7a70
diagnostics
dherman 1448f58
diagnostixxxxxxx
dherman a0cc0ce
moar diags
dherman 888b985
diagnosticismness
dherman 1a41db9
update lockfile
dherman f830a35
ok that's working, clean up some cruft and print out the dist/ directory
dherman 34dbd06
start the proxy, determine the tarball to publish
dherman 9e671ad
ok now we can start publishing packages to the proxy
dherman 8b33f30
show the verdaccio log
dherman e32ee29
directly run verdaccio for any additional output it might produce
dherman 8b31b70
try npm config set always-auth true
dherman 195d6eb
set always-auth through the env
dherman 0eb6db7
0.0.0.0?
dherman 65459fb
dont use npx
dherman fdf0c30
127.0.0.1?
dherman c4300b5
sleep for a few seconds in case this is a race
dherman 610ad8a
diagnosticification
dherman afc1320
more diagnostics
dherman 5b262e8
more sleeps
dherman 7410b72
more diagnostics
dherman 3ca6437
guard with a test for existence
dherman 90b5c90
explicitly listen on 127.0.0.1:4873
dherman 7a0748a
now that that's working, comment out the waits and see if it's still …
dherman 6e6d007
ok let's try sleep 10
dherman 723c3dd
diagnostics
dherman b7c8c3a
diag
dherman 6a84c65
more diags
dherman 4ec935f
diagnostics
dherman b9f36b5
diagnostics
dherman 228f9fd
more diagnostics
dherman e737020
path off-by-one
dherman 29e2145
does.. the order of the npm publish arguments matter?
dherman dd498b0
is it sensitive to cwd???!?
dherman c2d0b34
relative path bug
dherman f3560a0
missing '/'
dherman cdb68d6
cleanup now that it's working
dherman ec637fc
let's try to be more precise about waiting for the verdaccio server t…
dherman 9871719
use `tail -F` to wait for the file to exist
dherman 9936597
add a timeout of 3m to the proxy server step
dherman 19e6b22
can we avoid multiple adduser commands?
dherman 61deae5
golf things down a bit
dherman 5ae1914
try using npx again
dherman c857ffa
move proxy script into proxy.sh
dherman 36b7c2f
move check-bundles lint into file
dherman 0ade96b
pass ${{ env.PROXY }} correctly into proxy.sh as a command-line arg
dherman 8fb5a82
add sniff-bytes integration test
dherman 2ed0326
build sniff-bytes integration test
dherman 8dd8d94
I guess cargo requires a patch number?
dherman b56b743
make it a workspace so it's excluded from the rest of the repo
dherman ddc8aea
exclude from the root to keep the integration test clean
dherman bd47ff2
publish the integration test to the proxy
dherman 5f74424
again, 1.0.0 not 1.0
dherman 0c02eee
diagnostics
dherman 63cb9e9
authorize integration test packages in proxy
dherman afd0d65
add test-sniff-bytes integration test package
dherman 134d406
add darwin-arm64 target so I can test locally
dherman f8cd0f4
add dependency on sniff-bytes to test-sniff-bytes
dherman a8fc5cf
load fixtures
dherman 34304dd
print sniffBytes output
dherman 1182e1e
debugging
dherman 24505c0
print shasum
dherman 02d6590
get the integrity checksum from the proxy
dherman e3ffc5d
integrity
dherman ecdab4d
integrrrrrity
dherman cb9bf94
diagnostics
dherman e1e8f99
use npm view
dherman 2be8967
remove the lockfile -- let's see what `npm ci` does, otherwise we can…
dherman c9abaff
`npm i` instead of `npm ci`
dherman a44dac4
npm i needs to use the proxy registry
dherman 8f35027
diagnostification
dherman 4dffd12
path
dherman 8497f78
see if explicitly adding the @babel/plugin-syntax-typescript devDepen…
dherman cdd36df
oops, that was in the wrong package.json
dherman a9cc5eb
add @babel/plugin-syntax-jsx now. heaven knows why this workaround is…
dherman e88f9f2
now @jest/source-map
dherman 8c6aee6
and now "@types/stack-utils"
dherman 969dbd5
next: @types/graceful-fs
dherman 80caba9
@babel/plugin-syntax-top-level-await
dherman 4d1830c
@babel/plugin-syntax-optional-chaining
dherman 9c11699
@babel/plugin-syntax-optional-catch-binding
dherman 43d1483
@babel/plugin-syntax-object-rest-spread
dherman b208f0d
@babel/plugin-syntax-numeric-separator
dherman 2db7bfa
@babel/plugin-syntax-nullish-coalescing-operator
dherman 4ee35c4
@babel/plugin-syntax-logical-assignment-operators
dherman 22b0e4c
@babel/plugin-syntax-json-strings
dherman 2425635
@babel/plugin-syntax-import-meta
dherman 6880160
@babel/plugin-syntax-class-properties
dherman c2beff7
@babel/plugin-syntax-bigint
dherman 106c11c
@babel/plugin-syntax-async-generators
dherman 9187a05
@types/babel__traverse
dherman fc37d63
@types/babel__template
dherman 046ef9f
@types/babel__generator
dherman c1470ea
@types/babel__core
dherman 8e6aa65
@jest/test-sequencer
dherman 6bab484
@istanbuljs/schema
dherman 38a800c
@istanbuljs/load-nyc-config
dherman ae64358
@bcoe/v8-coverage
dherman 70712fa
@jest/transform
dherman 437d60c
@jest/reporters
dherman 207c896
@jest/core
dherman 47ffbf5
@jest/expect-utils
dherman e8a03ad
@types/yargs-parser
dherman 2d5151b
@types/istanbul-lib-report
dherman e4dacfa
@sinonjs/commons
dherman 0e48c55
@jridgewell/resolve-uri
dherman 2fa56b2
@jridgewell/sourcemap-codec
dherman 57ce8b5
@jridgewell/set-array
dherman 3c37291
@sinclair/typebox
dherman d47e2d8
@types/yargs
dherman 18fe3e7
@types/istanbul-reports
dherman 8653bb6
@jest/schemas
dherman 23e2e76
@types/istanbul-lib-coverage
dherman 600a1e5
@sinonjs/fake-timers
dherman 5092da6
@jest/fake-timers
dherman 09ed408
@jest/expect
dherman f1f9083
@jest/environment
dherman 68ab8b0
@types/node
dherman 0e44ba4
@jest/types
dherman 6419a05
@jest/test-result
dherman 0ad63cc
@jest/console
dherman f9afb6f
@babel/helper-string-parser
dherman 2a940af
@babel/helper-hoist-variables
dherman 1f0814b
@babel/helper-function-name
dherman e67b337
does it help to put these in the config.yml??
dherman 7118484
@babel/helper-plugin-utils
dherman bc27a38
@babel/helper-validator-identifier
dherman fa8e29f
@babel/helper-split-export-declaration
dherman aa5d9af
@babel/helper-simple-access
dherman cd6c50a
@babel/helper-module-imports
dherman 465872f
@babel/helper-environment-visitor
dherman fdae525
@babel/helper-validator-option
dherman 3c8794c
@babel/compat-data
dherman 5f6dd8f
@babel/highlight
dherman 5b8a7cf
@jridgewell/trace-mapping
dherman 5aa925f
@jridgewell/gen-mapping
dherman 10f8df5
@babel/types
dherman 73611bf
@babel/traverse
dherman 153e809
@babel/template
dherman e11b979
delete the extraneous configs
dherman 81f8947
@babel/parser
dherman e5b387d
@babel/helpers
dherman ce8d021
@babel/helper-module-transforms
dherman 7e54cd9
@babel/helper-compilation-targets
dherman 501582f
@babel/generator
dherman 1b96faa
@babel/code-frame
dherman 56e81db
@ampproject/remapping
dherman 4455404
would `publish: $authenticated` for the npm uplink help?
dherman 039f84a
try extending the timeout
dherman 8493565
try npm i twice in a row??
dherman ce2da4c
try eagerly installing @types/yargs-parser
dherman 599d1be
just stabbing around randomly here
dherman f4fcf51
try forcing pre-fetching with `npm cache add`
dherman d8d0dbe
gitignore lockfile in sniff-bytes
cf7dbc8
`npm i` instead of `npm ci` for sniff-bytes now that there's no lockfile
90d485d
let's try disabling the cache, and see if it's bug https://github.com…
51e7ed5
try verdaccio 6 pre-release to see if the bug is fixed
0d5c28d
Stop using uplinks and don't worry about testing cargo-messages in th…
7af387b
now that sniff-bytes is scoped, explicitly tell `neon dist` the unsco…
9fd4ba9
remove debugging line that's irrelevant now
d71626b
@sniff-bytes/* and @neon-rs/* should load from verdaccio as well
b7c2d08
workflow cleanup
4a6ef3a
two integration tests
621f0ec
test fix: was accessing the wrong property name
3efe67b
try moving most of the proxy setup into a script that also works for …
da5614f
add back authentication temporarily
f192aa0
CIPROXY not PROXY
01a1fd3
fix authentication in the script
78d43c2
get rid of all the duplicated configuration values in the CI workflow…
bd1ba98
remove diagnostics
1581c1a
remove more diagnostics
62122e6
remove spurious comment
9419c14
Comment the scripts to describe their purpose.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
name: CI | ||
|
||
env: | ||
NODE_VERSION: 18.x | ||
|
||
on: | ||
push: | ||
# Prevent duplicate runs of this workflow on our own internal PRs. | ||
|
@@ -23,23 +26,47 @@ jobs: | |
fetch-depth: 0 | ||
- name: Check Bundles | ||
shell: bash | ||
run: | | ||
echo "Checking that all bundled tools are up to date..." | ||
dirty_workspaces=() | ||
for input_workspace in `find src -type d -mindepth 1 -maxdepth 1 -not -name node_modules` ; do | ||
output_workspace=$(echo $input_workspace | sed -e 's/^src/pkgs/') | ||
input_mtime=$(git log -1 --format=%ct $input_workspace) | ||
output_mtime=$(git log -1 --format=%ct $output_workspace) | ||
if [[ $input_mtime -gt $output_mtime ]] ; then | ||
echo "❌ $input_workspace has changed since $output_workspace was last generated" | ||
dirty_workspaces+=($input_workspace) | ||
fi | ||
done | ||
if [[ ${#dirty_workspaces[@]} -gt 0 ]] ; then | ||
echo | ||
echo '💡 Re-run `npm run bundle` on the following workspaces before committing:' | ||
for workspace in ${dirty_workspaces[*]} ; do | ||
echo " • $workspace" | ||
done | ||
exit 1 | ||
fi | ||
run: ./test/lint/check-bundles.sh | ||
|
||
integration: | ||
name: Integration Tests | ||
needs: [bundles] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install Dependencies | ||
shell: bash | ||
run: npm ci --verbose | ||
- name: Build | ||
uses: neon-actions/[email protected] | ||
with: | ||
working-directory: ./pkgs/cargo-messages | ||
target: linux-x64-gnu | ||
node-version: ${{ env.NODE_VERSION }} | ||
use-cross: false | ||
npm-publish: false | ||
github-release: false | ||
- name: Start npm Proxy | ||
shell: bash | ||
working-directory: ./test/integration/proxy | ||
timeout-minutes: 3 | ||
run: ./ci-proxy.sh | ||
- name: Publish to npm Proxy | ||
shell: bash | ||
working-directory: ./test/integration/proxy | ||
timeout-minutes: 3 | ||
run: ./publish.sh | ||
# Since package integrity checksums may vary depending on what versions | ||
# are available in the proxy registry, we don't put the lockfile for this | ||
# test in source control. This means we have to use `npm i`, not `npm ci`. | ||
- name: Setup test-sniff-bytes Integration Test | ||
shell: bash | ||
working-directory: test/integration/test-sniff-bytes | ||
run: npm i || (cat ../proxy/proxy.log && exit 1) | ||
- name: Run test-sniff-bytes Integration Test | ||
shell: bash | ||
working-directory: test/integration/test-sniff-bytes | ||
run: npm test |
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 |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
members = [ | ||
"pkgs/cargo-messages" | ||
] | ||
exclude = [ | ||
"test/integration/sniff-bytes" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed so the root cargo workspace doesn't get confused by the Rust code inside the integration tests. |
||
] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,4 @@ | ||
htpasswd | ||
storage | ||
proxy.log | ||
nohup.out |
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,11 @@ | ||
#!/bin/bash | ||
|
||
CIPROXY=http://127.0.0.1:4873 | ||
|
||
# Boot the server in a background process. | ||
nohup npx verdaccio --config ./config.yml --listen $CIPROXY & | ||
|
||
# Wait for the server to begin listening for connections | ||
( tail -F -n10 proxy.log & ) | fgrep -q $CIPROXY | ||
|
||
cat proxy.log |
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,15 @@ | ||
storage: ./storage | ||
auth: | ||
htpasswd: | ||
file: ./htpasswd | ||
packages: | ||
'@neon-rs/*': | ||
access: $all | ||
publish: $all | ||
'@sniff-bytes/*': | ||
access: $all | ||
publish: $all | ||
'@neon-integration-tests/*': | ||
access: $all | ||
publish: $all | ||
log: { type: file, path: proxy.log, level: info } |
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,49 @@ | ||
#!/bin/bash | ||
|
||
cd $(dirname $0)/../../.. | ||
ROOT_DIR=$(pwd) | ||
PROXY_DIR=${ROOT_DIR}/test/integration/proxy | ||
LOCAL_PROXY=http://127.0.0.1:4873 | ||
|
||
cd ${PROXY_DIR} | ||
|
||
if ! which pm2 >/dev/null ; then | ||
echo -e 'usage: local-proxy.sh' | ||
echo -e | ||
echo -e 'error: The required tool `pm2` was not found. Please install it first by running:' | ||
echo -e | ||
echo -e ' $ npm i -g pm2' | ||
echo -e | ||
exit 1 | ||
fi | ||
|
||
if pm2 describe neon-test-proxy >/dev/null 2>&1 ; then | ||
echo -e 'usage: local-proxy.sh' | ||
echo -e | ||
echo -e 'error: There is already a pm2 app named `neon-test-proxy`. Please remove it first by running:' | ||
echo -e | ||
echo -e ' $ pm2 stop neon-test-proxy' | ||
echo -e ' $ pm2 delete neon-test-proxy' | ||
echo -e | ||
exit 1 | ||
fi | ||
|
||
rm -rf ./storage ./proxy.log | ||
|
||
# Boot the server in a background process. | ||
pm2 start verdaccio --name neon-test-proxy --no-autorestart -- --config ./config.yml --listen ${LOCAL_PROXY} | ||
|
||
# Wait for the server to begin listening for connections | ||
( tail -F -n10 ./proxy.log & ) | fgrep -q "${LOCAL_PROXY}" | ||
|
||
cat ./proxy.log | ||
|
||
echo | ||
echo 'Proxy `neon-test-proxy` started. You can now control it using pm2:' | ||
echo | ||
echo ' # Stop the proxy server:' | ||
echo ' $ pm2 stop neon-test-proxy' | ||
echo | ||
echo ' # Restart the proxy server:' | ||
echo ' $ pm2 restart neon-test-proxy' | ||
echo |
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.
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.
Moved the listing logic into a separate shell script file.