Skip to content

Commit

Permalink
Migrate (#44)
Browse files Browse the repository at this point in the history
BREAKING: use proxy for intercepting networks calls
  • Loading branch information
agoldis authored Jan 7, 2023
1 parent 68e4c5d commit 6b2e75c
Show file tree
Hide file tree
Showing 76 changed files with 25,906 additions and 7,424 deletions.
37 changes: 0 additions & 37 deletions .circleci/config.yml

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/e2e-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: E2E:Linux

on:
push:

jobs:
e2e:
if: "!contains(toJSON(github.event.commits.*.message), '[skip ci]')"

runs-on: ubuntu-latest
env:
npm_config_prefix: ~/.npm
DEBUG: cy2

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: package-lock.json

# remove cypress from peer dependecies
- name: Install dependencies
run: |
npm install
- name: Build
run: npm run build

- name: Setup
run: npm uninstall cypress

- name: Local - Setup
working-directory: ./e2e
run: npm install cypress --no-progress

- name: Local - Test
working-directory: ./e2e
env:
NODE_PATH: './node_modules'
run: |
node ./test-run.js
node ./test-spawn.js run
npm uninstall cypress
- name: Local - Teardown
working-directory: ./e2e
run: npm uninstall cypress

- name: Global - Setup
run: npm install --global cypress --no-progress

- name: Global - Test
working-directory: ./e2e
run: |
NODE_PATH=$(npm prefix -g)/lib/node_modules node ./test-run.js
NODE_PATH=$(npm prefix -g)/lib/node_modules node ./test-spawn.js run
- name: Global - Teardown
run: npm uninstall --global cypress

- name: Custom - Setup
env:
npm_config_prefix: ~/.npm_custom
run: |
mkdir -p ~/.npm_custom
npm install cypress --global
- name: Custom - Test
env:
npm_config_prefix: ~/.npm_custom
working-directory: ./e2e
run: |
NODE_PATH=$(npm prefix -g)/lib/node_modules CYPRESS_PACKAGE_SHELL_SCRIPT=$(npm prefix -g)/lib/node_modules/cypress/bin/cypress node ./test-spawn.js run
- name: Custom - Teardown
env:
npm_config_prefix: ~/.npm_custom
run: npm uninstall --global cypress
64 changes: 64 additions & 0 deletions .github/workflows/e2e-network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: E2E:Network

on:
push:

jobs:
e2e-network:
if: "!contains(toJSON(github.event.commits.*.message), '[skip ci]')"

runs-on: ubuntu-latest
env:
DEBUG: cy2*,cypress:server:cloud:*,cypress:network:*
# prevent cypress ts-paths interfering with local imports
TS_NODE_PROJECT: dummy.ts.json
CYPRESS_API_URL: http://localhost:1234

# Service containers to run with `container-job`
services:
# Label used to access the service container
director:
# Docker Hub image
image: agoldis/sorry-cypress-director
ports:
- 1234:1234

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'

# remove cypress from peer dependecies
- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Start Upstream Proxy
run: |
npm run build-tunnel
node ./dist/tunnel-proxy.js &
- name: Record without upstream proxy
working-directory: ./e2e
run: |
../bin/cy2 run --parallel --record --key xxx
- name: Record with upstream proxy
working-directory: ./e2e
env:
HTTP_PROXY: https://localhost:9999
run: |
../bin/cy2 run --parallel --record --key xxx
- name: Bypass upstream proxy for director
env:
HTTP_PROXY: https://localhost:9999
NO_PROXY: localhost
working-directory: ./e2e
run: |
../bin/cy2 run --parallel --record --key xxx
92 changes: 92 additions & 0 deletions .github/workflows/e2e-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: E2E:Windows
on:
push:
branches:
- main

jobs:
build:
if: "!contains(toJSON(github.event.commits.*.message), '[skip ci]')"

runs-on: windows-latest
env:
DEBUG: cy2

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '16'

- name: Get npm cache directory
id: npm-cache-dir
shell: pwsh
run: echo "dir=$(npm config get cache)" >> ${env:GITHUB_OUTPUT}

- uses: actions/cache@v3
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# remove cypress from peer dependecies
- name: Install dependencies
run: npm install
npm uninstall cypress

- name: Build
run: npm run build

- name: Setup
run: npm uninstall cypress

- name: Local - Setup
working-directory: e2e
run: npm install cypress --no-progress
- name: Local - Test
working-directory: e2e
env:
NODE_PATH: './node_modules'
run: |
node ./test-run.js run
node ./test-spawn.js run
npm uninstall cypress
- name: Local - Teardown
working-directory: e2e
run: npm uninstall cypress

- name: Global - Setup
env:
npm_config_prefix: ~/.npm with spaces
run: npm install --global cypress --no-progress
- name: Global - Test
working-directory: e2e
env:
npm_config_prefix: ~/.npm with spaces
run: |
$prefix = npm prefix -g
$env:NODE_PATH="$prefix\node_modules"; node .\test-run.js run
$env:NODE_PATH="$prefix\node_modules"; node .\test-spawn.js run
- name: Global - Teardown
env:
npm_config_prefix: ~/.npm with spaces
run: npm uninstall --global cypress

- name: Custom - Setup
env:
npm_config_prefix: ~/.npm_custom
run: npm install cypress --global
- name: Custom - Test
working-directory: e2e
env:
npm_config_prefix: ~/.npm_custom
run: |
$prefix = npm prefix -g
$env:NODE_PATH="$prefix\node_modules"; $env:CYPRESS_PACKAGE_SHELL_SCRIPT="$prefix\node_modules\cypress\bin\cypress"; node .\test-spawn.js run
- name: Custom - Teardown
env:
npm_config_prefix: ~/.npm_custom
run: npm uninstall --global cypress
34 changes: 34 additions & 0 deletions .github/workflows/release-github.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish to GitHub

on:
push:
branches:
- release/*

jobs:
release:
runs-on: ubuntu-latest

permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3

# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
# scope: '@currents-dev'
- run: npm ci
# - run: ./scripts/rewrite_package.js
- name: Release
# only release npm package and create github release
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
npm run release-ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ npm-debug.log_
yarn-debug.log*
yarn-error.log*
.vscode/settings.json
videos
screenshots

.npmrc*
# Runtime data

pids
Expand Down
14 changes: 0 additions & 14 deletions .swcrc

This file was deleted.

30 changes: 30 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach",
"port": 9223,
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/dist",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
]
}
]
}
Loading

0 comments on commit 6b2e75c

Please sign in to comment.