-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from yacchin1205/feature/initial-pads
Support for importing the archives specified during initialization
- Loading branch information
Showing
13 changed files
with
3,515 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
name: "Backend tests" | ||
name: Backend Tests | ||
|
||
# any branch is useful for testing before a PR is submitted | ||
on: [push, pull_request] | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
withplugins: | ||
|
@@ -12,64 +13,128 @@ jobs: | |
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id) | ||
name: with Plugins | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Install libreoffice | ||
run: | | ||
sudo add-apt-repository -y ppa:libreoffice/ppa | ||
sudo apt update | ||
sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport | ||
uses: awalsh128/[email protected] | ||
with: | ||
packages: libreoffice libreoffice-pdfimport | ||
version: 1.0 | ||
- | ||
name: Install etherpad core | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ether/etherpad-lite | ||
path: etherpad-lite | ||
- uses: pnpm/action-setup@v3 | ||
name: Install pnpm | ||
with: | ||
version: 8 | ||
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: Checkout plugin repository | ||
uses: actions/checkout@v3 | ||
with: | ||
path: ./node_modules/__tmp | ||
path: plugin | ||
- | ||
name: Determine plugin name | ||
id: plugin_name | ||
working-directory: ./plugin | ||
run: | | ||
cd ./node_modules/__tmp | ||
npx -c 'printf %s\\n "::set-output name=plugin_name::${npm_package_name}"' | ||
- | ||
name: Rename plugin directory | ||
name: Link plugin directory | ||
working-directory: ./plugin | ||
run: | | ||
mv ./node_modules/__tmp ./node_modules/"${PLUGIN_NAME}" | ||
env: | ||
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }} | ||
pnpm link --global | ||
- name: Remove tests | ||
working-directory: ./etherpad-lite | ||
run: rm -rf ./src/tests/backend/specs | ||
- | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 12 | ||
cache: 'npm' | ||
cache-dependency-path: | | ||
src/package-lock.json | ||
src/bin/doc/package-lock.json | ||
node_modules/${{ steps.plugin_name.outputs.plugin_name }}/package-lock.json | ||
- | ||
name: Install plugin dependencies | ||
name: Install Etherpad core dependencies | ||
working-directory: ./etherpad-lite | ||
run: bin/installDeps.sh | ||
- name: Build plugin | ||
working-directory: ./plugin | ||
run: | | ||
cd ./node_modules/"${PLUGIN_NAME}" | ||
npm ci | ||
npm i --include dev | ||
npm run build | ||
ls -la . | ||
- name: Build Solr | ||
working-directory: ./plugin | ||
run: | | ||
docker buildx build -o type=docker -t ep_weave/solr -f ./solr/Dockerfile . | ||
- name: Link plugin to etherpad-lite | ||
working-directory: ./etherpad-lite | ||
run: | | ||
pnpm link --global $PLUGIN_NAME | ||
pnpm run plugins i --path ../../plugin | ||
env: | ||
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }} | ||
# Etherpad core dependencies must be installed after installing the | ||
# plugin's dependencies, otherwise npm will try to hoist common | ||
# dependencies by removing them from src/node_modules and installing them | ||
# in the top-level node_modules. As of v6.14.10, npm's hoist logic appears | ||
# to be buggy, because it sometimes removes dependencies from | ||
# src/node_modules but fails to add them to the top-level node_modules. | ||
# Even if npm correctly hoists the dependencies, the hoisting seems to | ||
# confuse tools such as `npm outdated`, `npm update`, and some ESLint | ||
# rules. | ||
- | ||
name: Install Etherpad core dependencies | ||
run: src/bin/installDeps.sh | ||
- name: Prepare ep_search | ||
working-directory: ./etherpad-lite | ||
run: | | ||
git clone -b feature/search-engine https://github.com/NII-cloud-operation/ep_search.git /tmp/ep_search | ||
cd /tmp/ep_search | ||
ls -la /tmp/ep_search | ||
npm pack | ||
- name: Install ep_search | ||
working-directory: ./etherpad-lite | ||
run: | | ||
pnpm run plugins i --path /tmp/ep_search | ||
- name: Link ep_etherpad-lite | ||
working-directory: ./etherpad-lite/src | ||
run: | | ||
pnpm link --global | ||
- name: Link etherpad to plugin | ||
working-directory: ./plugin | ||
run: | | ||
pnpm link --global ep_etherpad-lite | ||
- | ||
name: Run the backend tests | ||
run: cd src && npm test | ||
working-directory: ./etherpad-lite | ||
run: | | ||
docker run -d --name etherpad-solr -p 8983:8983 ep_weave/solr | ||
MAX_ATTEMPTS=60 | ||
counter=0 | ||
while ! nc -z localhost 8983; do | ||
echo "Waiting for Solr to start ${counter}/${MAX_ATTEMPTS}" | ||
counter=$((counter+1)) | ||
if [ "$counter" -ge "$MAX_ATTEMPTS" ]; then | ||
echo "Solr did not start" | ||
exit 1 | ||
fi | ||
sleep 0.5 | ||
done | ||
counter=0 | ||
while ! curl http://localhost:8983/solr/pad/admin/ping | grep '"status":"OK"'; do | ||
echo "Waiting for Solr to respond ${counter}/${MAX_ATTEMPTS}" | ||
counter=$((counter+1)) | ||
if [ "$counter" -ge "$MAX_ATTEMPTS" ]; then | ||
echo "Solr did not respond" | ||
exit 1 | ||
fi | ||
sleep 0.5 | ||
done | ||
pnpm run test --settings ../plugin/tests/settings.json | ||
env: | ||
LOGLEVEL: DEBUG | ||
- name: Stop Solr | ||
if: always() | ||
run: | | ||
docker logs etherpad-solr | ||
docker stop etherpad-solr | ||
docker rm etherpad-solr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,36 @@ | ||
# Publicly credit Sauce Labs because they generously support open source | ||
# projects. | ||
name: "frontend tests powered by Sauce Labs" | ||
name: Frontend Tests | ||
|
||
on: [push] | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
test-frontend: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- | ||
name: Fail if Dependabot | ||
if: github.actor == 'dependabot[bot]' | ||
run: | | ||
cat <<EOF >&2 | ||
Frontend tests skipped because Dependabot can't access secrets. | ||
Manually re-run the jobs to run the frontend tests. | ||
For more information, see: | ||
https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/ | ||
EOF | ||
exit 1 | ||
- | ||
name: Generate Sauce Labs strings | ||
id: sauce_strings | ||
run: | | ||
printf %s\\n '::set-output name=name::${{github.event.repository.name}} ${{ github.workflow }} - ${{ github.job }}' | ||
printf %s\\n '::set-output name=tunnel_id::${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}' | ||
- | ||
name: Check out Etherpad core | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ether/etherpad-lite | ||
- | ||
uses: actions/setup-node@v3 | ||
- uses: pnpm/action-setup@v3 | ||
name: Install pnpm | ||
with: | ||
version: 8 | ||
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' | ||
cache-dependency-path: | | ||
src/package-lock.json | ||
src/bin/doc/package-lock.json | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- | ||
name: Check out the plugin | ||
uses: actions/checkout@v3 | ||
|
@@ -68,7 +60,7 @@ jobs: | |
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }} | ||
run: | | ||
cd ./node_modules/"${PLUGIN_NAME}" | ||
npm ci | ||
pnpm i | ||
# Etherpad core dependencies must be installed after installing the | ||
# plugin's dependencies, otherwise npm will try to hoist common | ||
# dependencies by removing them from src/node_modules and installing them | ||
|
@@ -80,31 +72,23 @@ jobs: | |
# rules. | ||
- | ||
name: Install Etherpad core dependencies | ||
run: src/bin/installDeps.sh | ||
- | ||
name: Create settings.json | ||
run: cp settings.json.template settings.json | ||
- | ||
name: Disable import/export rate limiting | ||
run: | | ||
sed -e '/^ *"importExportRateLimiting":/,/^ *\}/ s/"max":.*/"max": 0/' -i settings.json | ||
- | ||
name: Remove standard frontend test files | ||
run: rm -rf src/tests/frontend/specs | ||
- | ||
uses: saucelabs/[email protected] | ||
with: | ||
username: ${{ secrets.SAUCE_USERNAME }} | ||
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} | ||
tunnelIdentifier: ${{ steps.sauce_strings.outputs.tunnel_id }} | ||
- | ||
name: Run the frontend tests | ||
run: bin/installDeps.sh | ||
- name: Create settings.json | ||
run: cp ./src/tests/settings.json settings.json | ||
- name: Run the frontend tests | ||
shell: bash | ||
env: | ||
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | ||
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} | ||
SAUCE_NAME: ${{ steps.sauce_strings.outputs.name }} | ||
TRAVIS_JOB_NUMBER: ${{ steps.sauce_strings.outputs.tunnel_id }} | ||
GIT_HASH: ${{ steps.environment.outputs.sha_short }} | ||
run: | | ||
src/tests/frontend/travis/runner.sh | ||
pnpm run prod & | ||
connected=false | ||
can_connect() { | ||
curl -sSfo /dev/null http://localhost:9001/ || return 1 | ||
connected=true | ||
} | ||
now() { date +%s; } | ||
start=$(now) | ||
while [ $(($(now) - $start)) -le 15 ] && ! can_connect; do | ||
sleep 1 | ||
done | ||
cd src | ||
pnpm exec playwright install chromium --with-deps | ||
pnpm run test-ui --project=chromium |
Oops, something went wrong.