2020-11-24 19:12:41 +01:00
|
|
|
name: "rate limit"
|
|
|
|
|
|
|
|
# any branch is useful for testing before a PR is submitted
|
2024-03-23 22:10:21 +01:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths-ignore:
|
|
|
|
- "doc/**"
|
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- "doc/**"
|
2020-11-24 19:12:41 +01:00
|
|
|
|
2022-04-26 03:08:54 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-11-24 19:12:41 +01:00
|
|
|
jobs:
|
|
|
|
ratelimit:
|
|
|
|
# run on pushes to any branch
|
|
|
|
# run on PRs from external forks
|
|
|
|
if: |
|
2022-01-28 07:33:52 +01:00
|
|
|
(github.event_name != 'pull_request')
|
|
|
|
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
2020-11-24 19:12:41 +01:00
|
|
|
name: test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-01-28 07:33:52 +01:00
|
|
|
-
|
|
|
|
name: Checkout repository
|
2023-09-04 18:51:22 +02:00
|
|
|
uses: actions/checkout@v4
|
2022-01-28 07:33:52 +01:00
|
|
|
-
|
2023-10-25 19:08:24 +02:00
|
|
|
uses: actions/setup-node@v4
|
2022-01-28 07:33:52 +01:00
|
|
|
with:
|
2023-06-26 19:11:32 +02:00
|
|
|
node-version: 20
|
2024-02-11 09:51:42 +01:00
|
|
|
- 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
|
2024-02-11 11:19:34 +01:00
|
|
|
- uses: actions/cache@v4
|
2024-02-11 09:51:42 +01:00
|
|
|
name: Setup pnpm cache
|
|
|
|
with:
|
|
|
|
path: ${{ env.STORE_PATH }}
|
|
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
|
2022-01-28 07:33:52 +01:00
|
|
|
-
|
|
|
|
name: docker network
|
|
|
|
run: docker network create --subnet=172.23.42.0/16 ep_net
|
|
|
|
-
|
|
|
|
name: build docker image
|
|
|
|
run: |
|
2024-02-05 21:13:02 +01:00
|
|
|
docker build -f Dockerfile -t epl-debian-slim --build-arg NODE_ENV=develop .
|
2022-01-28 07:33:52 +01:00
|
|
|
docker build -f src/tests/ratelimit/Dockerfile.nginx -t nginx-latest .
|
|
|
|
docker build -f src/tests/ratelimit/Dockerfile.anotherip -t anotherip .
|
|
|
|
-
|
|
|
|
name: run docker images
|
|
|
|
run: |
|
|
|
|
docker run --name etherpad-docker -p 9000:9001 --rm --network ep_net --ip 172.23.42.2 -e 'TRUST_PROXY=true' epl-debian-slim &
|
|
|
|
docker run -p 8081:80 --rm --network ep_net --ip 172.23.42.1 -d nginx-latest
|
|
|
|
docker run --rm --network ep_net --ip 172.23.42.3 --name anotherip -dt anotherip
|
|
|
|
-
|
|
|
|
name: install dependencies and create symlink for ep_etherpad-lite
|
2024-02-21 21:50:11 +01:00
|
|
|
run: bin/installDeps.sh
|
2022-01-28 07:33:52 +01:00
|
|
|
-
|
|
|
|
name: run rate limit test
|
|
|
|
run: |
|
|
|
|
cd src/tests/ratelimit
|
|
|
|
./testlimits.sh
|