Skip to content

Commit ce59237

Browse files
committed
Moved tests to pnpm
1 parent 1ecf063 commit ce59237

8 files changed

+404
-40
lines changed

.github/workflows/1maxPadPerInstance.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,24 @@ jobs:
1818
uses: actions/checkout@v3
1919

2020
- uses: actions/setup-node@v3
21+
- uses: pnpm/action-setup@v4
22+
name: Install pnpm
2123
with:
22-
node-version: 15
23-
24+
version: 9.0.4
25+
run_install: false
26+
- name: Get pnpm store directory
27+
shell: bash
28+
run: |
29+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
30+
- uses: actions/cache@v4
31+
name: Setup pnpm cache
32+
with:
33+
path: ${{ env.STORE_PATH }}
34+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
35+
restore-keys: |
36+
${{ runner.os }}-pnpm-store-
2437
- name: install dependencies
25-
run: npm i
38+
run: pnpm i
2639

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

3447
- name: prep etherpad >> test1
35-
run: cd test1/src && npm i --no-optional
48+
run: cd test1/src && pnpm i
3649

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

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

5063
- name: prep etherpad >> test2
51-
run: cd test2/src && npm i --no-optional
64+
run: cd test2/src && pnpm i
5265

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

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

6679
- name: prep etherpad >> test3
67-
run: cd test3/src && npm i --no-optional
80+
run: cd test3/src && pnpm i
6881

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

7285
- name: support 1 pad per instances
7386
run: sed 's/5/1/g' settings.json.template > settings.json

.github/workflows/3maxPadPerInstance.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,22 @@ jobs:
1818
uses: actions/checkout@v3
1919

2020
- uses: actions/setup-node@v3
21+
- uses: pnpm/action-setup@v4
22+
name: Install pnpm
2123
with:
22-
node-version: 15
24+
version: 9.0.4
25+
run_install: false
26+
- name: Get pnpm store directory
27+
shell: bash
28+
run: |
29+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
30+
- uses: actions/cache@v4
31+
name: Setup pnpm cache
32+
with:
33+
path: ${{ env.STORE_PATH }}
34+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
35+
restore-keys: |
36+
${{ runner.os }}-pnpm-store-
2337
2438
- name: install dependencies
2539
run: npm i

.github/workflows/npmpublish.yml

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,29 @@ jobs:
1616
steps:
1717
-
1818
uses: actions/checkout@v3
19-
-
20-
uses: actions/setup-node@v3
19+
- uses: actions/setup-node@v3
20+
- uses: pnpm/action-setup@v4
21+
name: Install pnpm
22+
with:
23+
version: 9.0.4
24+
run_install: false
25+
- name: Get pnpm store directory
26+
shell: bash
27+
run: |
28+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
29+
- uses: actions/cache@v4
30+
name: Setup pnpm cache
2131
with:
22-
node-version: 12
23-
cache: 'npm'
32+
path: ${{ env.STORE_PATH }}
33+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pnpm-store-
2436
-
25-
run: npm ci
37+
run: pnpm ci
2638
-
27-
run: npm test
39+
run: pnpm test
2840
-
29-
run: npm run --if-present lint
41+
run: pnpm run --if-present lint
3042

3143
publish-npm:
3244
if: github.event_name == 'push'
@@ -37,12 +49,23 @@ jobs:
3749
uses: actions/checkout@v3
3850
with:
3951
fetch-depth: 0
40-
-
41-
uses: actions/setup-node@v3
52+
- uses: actions/setup-node@v3
53+
- uses: pnpm/action-setup@v4
54+
name: Install pnpm
55+
with:
56+
version: 9.0.4
57+
run_install: false
58+
- name: Get pnpm store directory
59+
shell: bash
60+
run: |
61+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
62+
- uses: actions/cache@v4
63+
name: Setup pnpm cache
4264
with:
43-
node-version: 12
44-
registry-url: https://registry.npmjs.org/
45-
cache: 'npm'
65+
path: ${{ env.STORE_PATH }}
66+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
67+
restore-keys: |
68+
${{ runner.os }}-pnpm-store-
4669
-
4770
name: Bump version (patch)
4871
run: |
@@ -51,13 +74,13 @@ jobs:
5174
[ "${NEW_COMMITS}" -gt 0 ] || exit 0
5275
git config user.name 'github-actions[bot]'
5376
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
54-
npm ci
55-
npm version patch
77+
pnpm ci
78+
pnpm version patch
5679
git push --follow-tags
5780
# This is required if the package has a prepare script that uses something
5881
# in dependencies or devDependencies.
5982
-
60-
run: npm ci
83+
run: pnpm ci
6184
# `npm publish` must come after `git push` otherwise there is a race
6285
# condition: If two PRs are merged back-to-back then master/main will be
6386
# updated with the commits from the second PR before the first PR's
@@ -69,11 +92,11 @@ jobs:
6992
# back-to-back merges will cause the first merge's workflow to fail but
7093
# the second's will succeed.
7194
-
72-
run: npm publish
95+
run: pnpm publish
7396
env:
7497
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
7598
-
7699
name: Add package to etherpad organization
77-
run: npm access grant read-write etherpad:developers
100+
run: pnpm access grant read-write etherpad:developers
78101
env:
79102
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/rapidUniqueness.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,25 @@ jobs:
1818
uses: actions/checkout@v3
1919

2020
- uses: actions/setup-node@v3
21+
- uses: pnpm/action-setup@v4
22+
name: Install pnpm
2123
with:
22-
node-version: 15
24+
version: 9.0.4
25+
run_install: false
26+
- name: Get pnpm store directory
27+
shell: bash
28+
run: |
29+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
30+
- uses: actions/cache@v4
31+
name: Setup pnpm cache
32+
with:
33+
path: ${{ env.STORE_PATH }}
34+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
35+
restore-keys: |
36+
${{ runner.os }}-pnpm-store-
2337
2438
- name: install dependencies
25-
run: npm i
39+
run: pnpm i
2640

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

3448
- name: prep etherpad >> test1
35-
run: cd test1/src && npm i --no-optional
49+
run: cd test1/src && pnpm i --no-optional
3650

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

5064
- name: prep etherpad >> test2
51-
run: cd test2/src && npm i --no-optional
65+
run: cd test2/src && pnpm i --no-optional
5266

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

6680
- name: prep etherpad >> test3
67-
run: cd test3/src && npm i --no-optional
81+
run: cd test3/src && pnpm i --no-optional
6882

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

8195
- name: Install etherpad-load-test
82-
run: npm install etherpad-load-test -g
96+
run: pnpm install etherpad-load-test -g
8397

8498
- name: wait for Etherpad
8599
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

.github/workflows/remoteLoad.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,28 @@ jobs:
1616
steps:
1717

1818
- uses: actions/setup-node@v3
19+
- uses: pnpm/action-setup@v4
20+
name: Install pnpm
1921
with:
20-
node-version: 15
22+
version: 9.0.4
23+
run_install: false
24+
- name: Get pnpm store directory
25+
shell: bash
26+
run: |
27+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
28+
- uses: actions/cache@v4
29+
name: Setup pnpm cache
30+
with:
31+
path: ${{ env.STORE_PATH }}
32+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
33+
restore-keys: |
34+
${{ runner.os }}-pnpm-store-
2135
2236
- name: Install etherpad-load-test
23-
run: npm install etherpad-load-test -g
37+
run: pnpm install etherpad-load-test -g
2438

2539
- name: Install Cypress
26-
run: npm install cypress -g
40+
run: pnpm install cypress -g
2741

2842
- name: Setup file system
2943
run: mkdir cypress

app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

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

7171
// Create dynamically assigned routes based on padIds and ensure that a route for
7272
// unique padIds are re-used and stuck to a backend -- padId <> backend association.
73-
const createRoute = (padId: string | null, req, res, socket, head) => {
73+
const createRoute = (padId: string | null, req: any, res:any, socket:any, head:any) => {
7474
// If the route isn't for a specific padID IE it's for a static file
7575
// we can use any of the backends but now let's use the first :)
7676
if (!padId) {

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"http-proxy": "^1.18.1",
99
"superagent": "^10.1.1",
1010
"ueberdb2": "^5.0.6",
11-
"rusty-store-kv": "^1.3.1"
11+
"rusty-store-kv": "^1.3.1",
12+
"tsx": "^4.19.2"
1213
},
1314
"devDependencies": {
1415
"@types/bun": "^1.1.14",
@@ -22,7 +23,9 @@
2223
"eslint-plugin-you-dont-need-lodash-underscore": "^6.11.0",
2324
"typescript": "^5.7.2"
2425
},
25-
"scripts": {},
26+
"scripts": {
27+
"start": "node --require tsx/cjs app.ts"
28+
},
2629
"repository": {
2730
"type": "git",
2831
"url": "git+https://github.com/ether/etherpad-proxy.git"

0 commit comments

Comments
 (0)