Skip to content

Commit 4522418

Browse files
committed
autofixes from Etherpad checkPlugin.js
1 parent 549a130 commit 4522418

File tree

8 files changed

+2080
-2362
lines changed

8 files changed

+2080
-2362
lines changed
Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
name: "Backend tests"
1+
name: Backend Tests
22

33
# any branch is useful for testing before a PR is submitted
4-
on: [push, pull_request]
4+
on:
5+
workflow_call:
56

67
jobs:
78
withplugins:
@@ -12,66 +13,80 @@ jobs:
1213
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
1314
name: with Plugins
1415
runs-on: ubuntu-latest
15-
1616
steps:
1717
-
1818
name: Install libreoffice
19-
run: |
20-
sudo add-apt-repository -y ppa:libreoffice/ppa
21-
sudo apt update
22-
sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport
19+
uses: awalsh128/[email protected]
20+
with:
21+
packages: libreoffice libreoffice-pdfimport
22+
version: 1.0
2323
-
2424
name: Install etherpad core
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v3
2626
with:
2727
repository: ether/etherpad-lite
28+
path: etherpad-lite
29+
- uses: pnpm/action-setup@v3
30+
name: Install pnpm
31+
with:
32+
version: 8
33+
run_install: false
34+
- name: Get pnpm store directory
35+
shell: bash
36+
run: |
37+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
38+
- uses: actions/cache@v4
39+
name: Setup pnpm cache
40+
with:
41+
path: ${{ env.STORE_PATH }}
42+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
43+
restore-keys: |
44+
${{ runner.os }}-pnpm-store-
2845
-
2946
name: Checkout plugin repository
30-
uses: actions/checkout@v4
47+
uses: actions/checkout@v3
3148
with:
32-
path: ./node_modules/__tmp
49+
path: plugin
3350
-
3451
name: Determine plugin name
3552
id: plugin_name
53+
working-directory: ./plugin
3654
run: |
37-
cd ./node_modules/__tmp
3855
npx -c 'printf %s\\n "::set-output name=plugin_name::${npm_package_name}"'
3956
-
40-
name: Rename plugin directory
57+
name: Link plugin directory
58+
working-directory: ./plugin
4159
run: |
42-
mv ./node_modules/__tmp ./node_modules/"${PLUGIN_NAME}"
43-
env:
44-
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
60+
pnpm link --global
61+
- name: Remove tests
62+
working-directory: ./etherpad-lite
63+
run: rm -rf ./src/tests/backend/specs
4564
-
46-
uses: actions/setup-node@v3
47-
with:
48-
node-version: 20
49-
cache: 'npm'
50-
cache-dependency-path: |
51-
src/package-lock.json
52-
src/bin/doc/package-lock.json
53-
node_modules/${{ steps.plugin_name.outputs.plugin_name }}/package-lock.json
54-
- run: npm install [email protected] -g
55-
name: Install legacy npm for correct dependency resolution
56-
-
57-
name: Install plugin dependencies
65+
name: Install Etherpad core dependencies
66+
working-directory: ./etherpad-lite
67+
run: bin/installDeps.sh
68+
- name: Link plugin to etherpad-lite
69+
working-directory: ./etherpad-lite
5870
run: |
59-
cd ./node_modules/"${PLUGIN_NAME}"
60-
npm ci
71+
pnpm link --global $PLUGIN_NAME
72+
pnpm run install-plugins --path ../../plugin
6173
env:
6274
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
63-
# Etherpad core dependencies must be installed after installing the
64-
# plugin's dependencies, otherwise npm will try to hoist common
65-
# dependencies by removing them from src/node_modules and installing them
66-
# in the top-level node_modules. As of v6.14.10, npm's hoist logic appears
67-
# to be buggy, because it sometimes removes dependencies from
68-
# src/node_modules but fails to add them to the top-level node_modules.
69-
# Even if npm correctly hoists the dependencies, the hoisting seems to
70-
# confuse tools such as `npm outdated`, `npm update`, and some ESLint
71-
# rules.
72-
-
73-
name: Install Etherpad core dependencies
74-
run: src/bin/installDeps.sh
75+
- name: Link ep_etherpad-lite
76+
working-directory: ./etherpad-lite/src
77+
run: |
78+
pnpm link --global
79+
- name: Link etherpad to plugin
80+
working-directory: ./plugin
81+
run: |
82+
pnpm link --global ep_etherpad-lite
7583
-
7684
name: Run the backend tests
77-
run: cd src && npm test
85+
working-directory: ./etherpad-lite
86+
run: |
87+
res=$(find .. -path "./node_modules/ep_*/static/tests/backend/specs/**" | wc -l)
88+
if [ $res -eq 0 ]; then
89+
echo "No backend tests found"
90+
else
91+
pnpm run test
92+
fi
Lines changed: 40 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
# Publicly credit Sauce Labs because they generously support open source
22
# projects.
3-
name: "frontend tests powered by Sauce Labs"
3+
name: Frontend Tests
44

5-
on: [push]
5+
on:
6+
workflow_call:
67

78
jobs:
8-
test:
9+
test-frontend:
910
runs-on: ubuntu-latest
10-
if: ${{ github.actor != 'dependabot[bot]' }}
1111

1212
steps:
13-
-
14-
name: Generate Sauce Labs strings
15-
id: sauce_strings
16-
run: |
17-
printf %s\\n '::set-output name=name::${{github.event.repository.name}} ${{ github.workflow }} - ${{ github.job }}'
18-
printf %s\\n '::set-output name=tunnel_id::${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}'
1913
-
2014
name: Check out Etherpad core
21-
uses: actions/checkout@v4
15+
uses: actions/checkout@v3
2216
with:
2317
repository: ether/etherpad-lite
24-
-
25-
uses: actions/setup-node@v3
18+
- uses: pnpm/action-setup@v3
19+
name: Install pnpm
2620
with:
27-
node-version: 20
28-
cache: 'npm'
29-
cache-dependency-path: |
30-
src/package-lock.json
31-
src/bin/doc/package-lock.json
32-
- run: npm install [email protected] -g
33-
name: Install legacy npm for correct dependency resolution
21+
version: 8
22+
run_install: false
23+
- name: Get pnpm store directory
24+
shell: bash
25+
run: |
26+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
27+
- uses: actions/cache@v4
28+
name: Setup pnpm cache
29+
with:
30+
path: ${{ env.STORE_PATH }}
31+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
32+
restore-keys: |
33+
${{ runner.os }}-pnpm-store-
3434
-
3535
name: Check out the plugin
36-
uses: actions/checkout@v4
36+
uses: actions/checkout@v3
3737
with:
3838
path: ./node_modules/__tmp
3939
-
@@ -60,7 +60,7 @@ jobs:
6060
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
6161
run: |
6262
cd ./node_modules/"${PLUGIN_NAME}"
63-
npm ci
63+
pnpm i
6464
# Etherpad core dependencies must be installed after installing the
6565
# plugin's dependencies, otherwise npm will try to hoist common
6666
# dependencies by removing them from src/node_modules and installing them
@@ -72,31 +72,23 @@ jobs:
7272
# rules.
7373
-
7474
name: Install Etherpad core dependencies
75-
run: src/bin/installDeps.sh
76-
-
77-
name: Create settings.json
78-
run: cp settings.json.template settings.json
79-
-
80-
name: Disable import/export rate limiting
81-
run: |
82-
sed -e '/^ *"importExportRateLimiting":/,/^ *\}/ s/"max":.*/"max": 0/' -i settings.json
83-
-
84-
name: Remove standard frontend test files
85-
run: rm -rf src/tests/frontend/specs
86-
-
87-
uses: saucelabs/[email protected]
88-
with:
89-
username: ${{ secrets.SAUCE_USERNAME }}
90-
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
91-
tunnelIdentifier: ${{ steps.sauce_strings.outputs.tunnel_id }}
92-
-
93-
name: Run the frontend tests
75+
run: bin/installDeps.sh
76+
- name: Create settings.json
77+
run: cp ./src/tests/settings.json settings.json
78+
- name: Run the frontend tests
9479
shell: bash
95-
env:
96-
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
97-
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
98-
SAUCE_NAME: ${{ steps.sauce_strings.outputs.name }}
99-
TRAVIS_JOB_NUMBER: ${{ steps.sauce_strings.outputs.tunnel_id }}
100-
GIT_HASH: ${{ steps.environment.outputs.sha_short }}
10180
run: |
102-
src/tests/frontend/travis/runner.sh
81+
pnpm run dev &
82+
connected=false
83+
can_connect() {
84+
curl -sSfo /dev/null http://localhost:9001/ || return 1
85+
connected=true
86+
}
87+
now() { date +%s; }
88+
start=$(now)
89+
while [ $(($(now) - $start)) -le 15 ] && ! can_connect; do
90+
sleep 1
91+
done
92+
cd src
93+
pnpm exec playwright install chromium --with-deps
94+
pnpm run test-ui --project=chromium

0 commit comments

Comments
 (0)