Skip to content

test(e2e): Set up fake registry for E2E tests #5806

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 28 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d3f1674
test(e2e): Set up test registry for E2E tests
lforst Sep 22, 2022
f9a0577
Use local npmrc to publish to test registry
lforst Sep 22, 2022
4e1d6d1
Convert to TS script
lforst Sep 23, 2022
4bb7418
Yarn install in workflow
lforst Sep 23, 2022
d206f82
Remove cwd to fix CI?
lforst Sep 23, 2022
4996956
Remove node env to fix CI?
lforst Sep 23, 2022
923be27
Pass current env to fix CI?
lforst Sep 23, 2022
a904675
Add registry flag to fix CI???
lforst Sep 23, 2022
c1537e1
Omg just work
lforst Sep 23, 2022
55e6561
Omg just work
lforst Sep 23, 2022
7c43399
Finally
lforst Sep 23, 2022
7cdc527
Add individual packages to verdaccio config
lforst Sep 26, 2022
fc14bbb
Clean up dependencies?
lforst Sep 26, 2022
5c9e8ed
Move e2e tests into workspace
lforst Sep 26, 2022
ea0155f
Rename verdaccio config folder
lforst Sep 26, 2022
c16a103
Extract verdaccio version into const
lforst Sep 26, 2022
519f598
Rename ci step
lforst Sep 26, 2022
0709dd6
Add license
lforst Sep 26, 2022
8eb8cc7
Remove node types
lforst Sep 26, 2022
ea33b5f
Turn off npm audit in verdaccio config
lforst Sep 26, 2022
25335fb
Add lint command
lforst Sep 26, 2022
432c850
Add yaml package and pin deps
lforst Sep 26, 2022
1904a06
Add quick validation script
lforst Sep 26, 2022
a7c5664
Containerize the process of publishing packages to fake registry
lforst Sep 26, 2022
8c3e5e6
Update eslintrc
lforst Sep 26, 2022
d648a03
Improve log message in validation script
lforst Sep 26, 2022
c5e4c20
Remove -it flag from docker run
lforst Sep 26, 2022
dfe6809
Remove --sig-proxy flag
lforst Sep 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -613,3 +613,32 @@ jobs:
run: |
cd packages/remix
yarn test:integration:ci

job_e2e_tests:
name: E2E Tests
needs: [job_get_metadata, job_build]
runs-on: ubuntu-latest
timeout-minutes: 10
continue-on-error: true
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v2
with:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Check dependency cache
uses: actions/cache@v2
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v2
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Run integration tests
run: |
sh e2e-tests/run.sh
27 changes: 27 additions & 0 deletions e2e-tests/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
set -e
Copy link
Member

@AbhiPrasad AbhiPrasad Sep 22, 2022

Choose a reason for hiding this comment

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

let's make this a node script so we stay windows friendly before we dive deeper into bash land


SCRIPT=$(readlink -f "$0") # Absolute path to this script
SCRIPT_DIR=$(dirname "$SCRIPT") # Absolute path of directory containing this script

cd $SCRIPT_DIR/.. # Navigate to root of repository to build all the packages
yarn build:npm # create tarballs

# Stop Verdaccio Test Registry container if it was already running - don't throw if container wasn't running
docker stop verdaccio-e2e-test-registry || true

# Start Verdaccio Test Registry
docker run --detach --rm \
--name verdaccio-e2e-test-registry \
-p 4873:4873 \
-v $SCRIPT_DIR/verdaccio/conf:/verdaccio/conf \
verdaccio/verdaccio:5.15.3

# Publish built packages to Verdaccio Test Registry
for package in "$SCRIPT_DIR"/../packages/*/sentry-*.tgz; do
npm publish $package --registry http://localhost:4873
done

# TODO: Run e2e tests here

docker stop verdaccio-e2e-test-registry
66 changes: 66 additions & 0 deletions e2e-tests/verdaccio/conf/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Taken from https://github.com/babel/babel/blob/624c78d99e8f42b2543b8943ab1b62bd71cf12d8/scripts/integration-tests/verdaccio-config.yml

#
# This is the default config file. It allows all users to do anything,
# so don't use it on production systems.
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf
#

# path to a directory with all packages
storage: /verdaccio/storage/data

# https://verdaccio.org/docs/configuration#authentication
auth:
htpasswd:
file: /verdaccio/storage/htpasswd

# https://verdaccio.org/docs/configuration#uplinks
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/

# Learn how to protect your packages
# https://verdaccio.org/docs/protect-your-dependencies/
# https://verdaccio.org/docs/configuration#packages
packages:
'@*/*':
# scoped packages
access: $all
publish: $all
unpublish: $all
# proxy: npmjs # Don't proxy for E2E tests!

'**':
# allow all users (including non-authenticated users) to read and
# publish all packages
#
# you can specify usernames/groupnames (depending on your auth plugin)
# and three keywords: "$all", "$anonymous", "$authenticated"
access: $all

# allow all known users to publish/publish packages
# (anyone can register by default, remember?)
publish: $all
unpublish: $all
# proxy: npmjs # Don't proxy for E2E tests!

# https://verdaccio.org/docs/configuration#server
# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections.
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough.
server:
keepAliveTimeout: 60

middlewares:
audit:
enabled: true

# https://verdaccio.org/docs/logger
# log settings
logs: { type: stdout, format: pretty, level: http }
#experiments:
# # support for npm token command
# token: false