Skip to content

Commit

Permalink
Moved tests to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTV12345 committed Nov 28, 2024
1 parent 1ecf063 commit ce59237
Show file tree
Hide file tree
Showing 8 changed files with 404 additions and 40 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/1maxPadPerInstance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@ jobs:
uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
node-version: 15

version: 9.0.4
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: install dependencies
run: npm i
run: pnpm i

# install and run etherpad on ports 9001, 9002 and 9003
- name: Git clone etherpad to test1
Expand All @@ -32,10 +45,10 @@ jobs:
path: test1

- name: prep etherpad >> test1
run: cd test1/src && npm i --no-optional
run: cd test1/src && pnpm i

- name: start etherpad >> test1
run: cd test1 && node src/node/server.js > test1log.txt &
run: cd test1 && pnpm run prod > test1log.txt &

- name: Git clone etherpad to test2
uses: actions/checkout@v3
Expand All @@ -48,10 +61,10 @@ jobs:
run: sed 's/9001/9002/g' test2/settings.json.template > test2/settings.json

- name: prep etherpad >> test2
run: cd test2/src && npm i --no-optional
run: cd test2/src && pnpm i

- name: start etherpad >> test2
run: cd test2 && node src/node/server.js > test2log.txt &
run: cd test2 && pnpm run prod > test2log.txt &

- name: Git clone etherpad to test3
uses: actions/checkout@v3
Expand All @@ -64,10 +77,10 @@ jobs:
run: sed 's/9001/9003/g' test2/settings.json.template > test3/settings.json

- name: prep etherpad >> test3
run: cd test3/src && npm i --no-optional
run: cd test3/src && pnpm i

- name: start etherpad >> test3
run: cd test3 && node src/node/server.js > test3log.txt &
run: cd test3 && pnpm run prod > test3log.txt &

- name: support 1 pad per instances
run: sed 's/5/1/g' settings.json.template > settings.json
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/3maxPadPerInstance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,22 @@ jobs:
uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
node-version: 15
version: 9.0.4
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: install dependencies
run: npm i
Expand Down
57 changes: 40 additions & 17 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,29 @@ jobs:
steps:
-
uses: actions/checkout@v3
-
uses: actions/setup-node@v3
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9.0.4
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
node-version: 12
cache: 'npm'
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
-
run: npm ci
run: pnpm ci
-
run: npm test
run: pnpm test
-
run: npm run --if-present lint
run: pnpm run --if-present lint

publish-npm:
if: github.event_name == 'push'
Expand All @@ -37,12 +49,23 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
-
uses: actions/setup-node@v3
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9.0.4
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
node-version: 12
registry-url: https://registry.npmjs.org/
cache: 'npm'
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
-
name: Bump version (patch)
run: |
Expand All @@ -51,13 +74,13 @@ jobs:
[ "${NEW_COMMITS}" -gt 0 ] || exit 0
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
npm ci
npm version patch
pnpm ci
pnpm version patch
git push --follow-tags
# This is required if the package has a prepare script that uses something
# in dependencies or devDependencies.
-
run: npm ci
run: pnpm ci
# `npm publish` must come after `git push` otherwise there is a race
# condition: If two PRs are merged back-to-back then master/main will be
# updated with the commits from the second PR before the first PR's
Expand All @@ -69,11 +92,11 @@ jobs:
# back-to-back merges will cause the first merge's workflow to fail but
# the second's will succeed.
-
run: npm publish
run: pnpm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
-
name: Add package to etherpad organization
run: npm access grant read-write etherpad:developers
run: pnpm access grant read-write etherpad:developers
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
26 changes: 20 additions & 6 deletions .github/workflows/rapidUniqueness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,25 @@ jobs:
uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
node-version: 15
version: 9.0.4
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: install dependencies
run: npm i
run: pnpm i

# install and run etherpad on ports 9001, 9002 and 9003
- name: Git clone etherpad to test1
Expand All @@ -32,7 +46,7 @@ jobs:
path: test1

- name: prep etherpad >> test1
run: cd test1/src && npm i --no-optional
run: cd test1/src && pnpm i --no-optional

- name: start etherpad >> test1
run: cd test1 && node src/node/server.js &
Expand All @@ -48,7 +62,7 @@ jobs:
run: sed 's/9001/9002/g' test2/settings.json.template > test2/settings.json

- name: prep etherpad >> test2
run: cd test2/src && npm i --no-optional
run: cd test2/src && pnpm i --no-optional

- name: start etherpad >> test2
run: cd test2 && node src/node/server.js &
Expand All @@ -64,7 +78,7 @@ jobs:
run: sed 's/9001/9003/g' test2/settings.json.template > test3/settings.json

- name: prep etherpad >> test3
run: cd test3/src && npm i --no-optional
run: cd test3/src && pnpm i --no-optional

- name: start etherpad >> test3
run: cd test3 && node src/node/server.js &
Expand All @@ -79,7 +93,7 @@ jobs:
run: node app.js > proxyLog.txt &

- name: Install etherpad-load-test
run: npm install etherpad-load-test -g
run: pnpm install etherpad-load-test -g

- name: wait for Etherpad
run: curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9003/p/test
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/remoteLoad.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,28 @@ jobs:
steps:

- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
node-version: 15
version: 9.0.4
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install etherpad-load-test
run: npm install etherpad-load-test -g
run: pnpm install etherpad-load-test -g

- name: Install Cypress
run: npm install cypress -g
run: pnpm install cypress -g

- name: Setup file system
run: mkdir cypress
Expand Down
4 changes: 2 additions & 2 deletions app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import httpProxy, {type ErrorCallback} from 'http-proxy';
import httpProxy from 'http-proxy';
import http from 'http';
import {Database} from 'ueberdb2';
import {checkAvailability} from './checkAvailability.ts'
Expand Down Expand Up @@ -70,7 +70,7 @@ const initiateRoute = (backend: string, req:http.IncomingMessage, res: http.Serv

// Create dynamically assigned routes based on padIds and ensure that a route for
// unique padIds are re-used and stuck to a backend -- padId <> backend association.
const createRoute = (padId: string | null, req, res, socket, head) => {
const createRoute = (padId: string | null, req: any, res:any, socket:any, head:any) => {
// If the route isn't for a specific padID IE it's for a static file
// we can use any of the backends but now let's use the first :)
if (!padId) {
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"http-proxy": "^1.18.1",
"superagent": "^10.1.1",
"ueberdb2": "^5.0.6",
"rusty-store-kv": "^1.3.1"
"rusty-store-kv": "^1.3.1",
"tsx": "^4.19.2"
},
"devDependencies": {
"@types/bun": "^1.1.14",
Expand All @@ -22,7 +23,9 @@
"eslint-plugin-you-dont-need-lodash-underscore": "^6.11.0",
"typescript": "^5.7.2"
},
"scripts": {},
"scripts": {
"start": "node --require tsx/cjs app.ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ether/etherpad-proxy.git"
Expand Down
Loading

0 comments on commit ce59237

Please sign in to comment.