feat: Cache docker images #1172
Workflow file for this run
This file contains hidden or 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
| name: "E2E tests" | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| schedule: | |
| - cron: '0 12 * * *' | |
| jobs: | |
| DynamicVersionMatrix: | |
| name: Dynamic version matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: '[ | |
| { tag: "develop", expected: "${{ steps.etherpad-version-cleaned.outputs.version }}" }, | |
| { tag: "${{ steps.etherpad-version-cleaned.outputs.version }}", expected: "${{ steps.etherpad-version-cleaned.outputs.version }}" }, | |
| { tag: "2.2.7", expected: "2.2.7" }, | |
| { tag: "2.1.0", expected: "2.1.0" }, | |
| { tag: "2.0.2", expected: "2.0.2" }, | |
| { tag: "2.0.0", expected: "2.0.0" }, | |
| { tag: "1.9.7", expected: "1.9.7" }, | |
| { tag: "1.8.18", expected: "1.8.18" }, | |
| { tag: "1.8.0", expected: "1.8.0" }, | |
| { tag: "1.7.5", expected: "1.7.5" } | |
| ]' | |
| version: ${{ steps.etherpad-version-cleaned.outputs.version }} | |
| steps: | |
| - id: etherpad-version-cleaned | |
| run: | | |
| set -euo pipefail | |
| LATEST_TAG="$(curl -fsSL \ | |
| -H 'Accept: application/vnd.github+json' \ | |
| -H 'Authorization: Bearer ${{ github.token }}' \ | |
| https://api.github.com/repos/ether/etherpad/releases/latest \ | |
| | python3 -c "import json,sys; print(json.load(sys.stdin)['tag_name'])")" | |
| CLEANED_VERSION="${LATEST_TAG#v}" | |
| echo "version=$CLEANED_VERSION" >> "$GITHUB_OUTPUT" | |
| EtherpadWithNginxReverseProxy: | |
| name: Docker [1.8.17] + Nginx (no websocket) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Prepare environment | |
| uses: ./.github/actions/prepare-environment | |
| with: | |
| image: etherpad/etherpad:1.8.17 | |
| - name: Start docker containers | |
| run: | | |
| EP_VERSION=1.8.17 docker compose -f ./tests/e2e/docker/docker-compose.no_websocket.yml up -d --wait | |
| - name: Scan etherpad instance | |
| run: | | |
| set -euo pipefail | |
| bin/console.php ether:scan -vvv http://localhost:8080 \ | |
| | grep -E "Package version|HTTP/1.1 400|Websocket" \ | |
| | sed 's/ *$//' > /tmp/actual.txt | |
| diff -u tests/e2e/fixture/reverse_proxy_no_websocket.txt /tmp/actual.txt | |
| Etherpad2WithNginxReverseProxy: | |
| name: Docker [${{ matrix.versions.tag }}] + Nginx (no websocket) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| versions: [ | |
| { tag: "2.6.1", expected: "2.6.1" }, | |
| { tag: "2.2.2", expected: "2.2.2" }, | |
| { tag: "2.0.2", expected: "2.0.2" }, | |
| { tag: "2.0.0", expected: "2.0.0" }, | |
| ] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Prepare environment | |
| uses: ./.github/actions/prepare-environment | |
| with: | |
| image: etherpad/etherpad:${{ matrix.versions.tag }} | |
| - name: Start docker containers | |
| run: | | |
| EP_VERSION=${{ matrix.versions.tag }} docker compose -f ./tests/e2e/docker/docker-compose.no_websocket.yml up -d --wait | |
| - name: Scan etherpad instance | |
| run: | | |
| set -euo pipefail | |
| output="$(bin/console.php ether:scan http://localhost:8080)" | |
| echo "$output" | |
| expected="Package version: ${{ matrix.versions.expected }}" | |
| if ! grep -Fq "$expected" <<< "$output"; then | |
| echo "Assertion failed: expected output to contain: $expected" | |
| exit 1 | |
| fi | |
| - name: Dump docker logs on failure | |
| if: failure() | |
| uses: jwalton/gh-docker-logs@v2 | |
| EtherpadWithNginxReverseProxyInSubPath: | |
| name: Docker [${{ matrix.versions.tag }}] + Nginx (with subpath) | |
| runs-on: ubuntu-latest | |
| needs: DynamicVersionMatrix | |
| strategy: | |
| matrix: | |
| versions: ${{ fromJSON(needs.DynamicVersionMatrix.outputs.matrix) }} | |
| fail-fast: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Prepare environment | |
| uses: ./.github/actions/prepare-environment | |
| with: | |
| image: etherpad/etherpad:${{ matrix.versions.tag }} | |
| - name: Start docker containers | |
| run: | | |
| EP_VERSION=${{ matrix.versions.tag }} docker compose -f ./tests/e2e/docker/docker-compose.subpath.yml up -d --wait | |
| - name: Wait until etherpad is healthy | |
| run: | | |
| until curl -s -f -o /dev/null "http://localhost:8080/etherpad" | |
| do | |
| sleep 2 | |
| done | |
| - name: Scan etherpad instance | |
| run: | | |
| set -euo pipefail | |
| output="$(bin/console.php ether:scan http://localhost:8080/etherpad)" | |
| echo "$output" | |
| expected="Package version: ${{ matrix.versions.expected }}" | |
| if ! grep -Fq "$expected" <<< "$output"; then | |
| echo "Assertion failed: expected output to contain: $expected" | |
| exit 1 | |
| fi | |
| EtherpadWithNginxReverseProxyWithoutSubPath: | |
| name: Docker [1.9.7] + Nginx (without subpath) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Prepare environment | |
| uses: ./.github/actions/prepare-environment | |
| with: | |
| image: etherpad/etherpad:1.9.7 | |
| - name: Start docker containers | |
| run: | | |
| EP_VERSION=1.9.7 docker compose -f ./tests/e2e/docker/docker-compose.reverse_proxy.yml up -d --wait | |
| - name: Scan etherpad instance | |
| run: | | |
| set -euo pipefail | |
| output="$(bin/console.php ether:scan http://localhost:8080/test)" | |
| echo "$output" | |
| expected="Package version: 1.9.7" | |
| if ! grep -Fq "$expected" <<< "$output"; then | |
| echo "Assertion failed: expected output to contain: $expected" | |
| exit 1 | |
| fi | |
| Etherpad17: | |
| name: Source [1.7.0] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone etherpad repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: ether/etherpad | |
| path: etherpad | |
| ref: 1.7.0 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "8.9" | |
| - uses: JarvusInnovations/background-action@v1 | |
| name: Start etherpad service | |
| with: | |
| run: bin/run.sh & | |
| wait-on: | | |
| http://localhost:9001 | |
| log-output-if: failure | |
| wait-for: 5m | |
| working-directory: etherpad | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| path: app | |
| - name: Cache Composer packages | |
| id: composer-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| working-directory: ./app | |
| - name: Scan etherpad instance | |
| run: | | |
| set -euo pipefail | |
| output="$(app/bin/console.php ether:scan http://localhost:9001)" | |
| echo "$output" | |
| expected="Package version: 1.7.0" | |
| if ! grep -Fq "$expected" <<< "$output"; then | |
| echo "Assertion failed: expected output to contain: $expected" | |
| exit 1 | |
| fi | |
| EtherpadWithPlugins: | |
| name: Source [develop] with plugins | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone etherpad repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: ether/etherpad | |
| path: etherpad | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - uses: JarvusInnovations/background-action@v1 | |
| name: Start etherpad service | |
| with: | |
| run: | | |
| npm install pnpm -g | |
| bin/installDeps.sh | |
| pnpm run plugins i ep_align ep_headings2 ep_table_of_contents ep_font_size ep_spellcheck ep_markdown | |
| bin/run.sh & | |
| wait-on: | | |
| http://localhost:9001 | |
| log-output-if: failure | |
| wait-for: 5m | |
| working-directory: etherpad | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| path: app | |
| - name: Cache Composer packages | |
| id: composer-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| working-directory: ./app | |
| - name: Scan etherpad instance | |
| run: | | |
| set -euo pipefail | |
| app/bin/console.php ether:scan http://localhost:9001 \ | |
| | sed 's/ *$//' \ | |
| | grep -vE "(Version is|Package version)" \ | |
| | grep -v "Server running since" \ | |
| | cut -d'@' -f1 > /tmp/actual.txt | |
| diff -u app/tests/e2e/fixture/master_with_plugins.txt /tmp/actual.txt | |
| LatestEtherpad: | |
| name: Docker [latest] | |
| runs-on: ubuntu-latest | |
| needs: DynamicVersionMatrix | |
| services: | |
| etherpad: | |
| image: etherpad/etherpad:latest | |
| ports: | |
| - 9001:9001 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Prepare environment | |
| uses: ./.github/actions/prepare-environment | |
| with: | |
| image: etherpad/etherpad:latest | |
| - name: Create expected output file | |
| run: | | |
| cat tests/e2e/fixture/latest.txt | sed 's/$EP_VERSION/${{ needs.DynamicVersionMatrix.outputs.version }}/' > /tmp/latest.txt | |
| - name: Scan etherpad instance | |
| run: | | |
| set -euo pipefail | |
| bin/console.php ether:scan http://localhost:9001 \ | |
| | sed 's/ *$//' \ | |
| | grep -v "Server running since" > /tmp/actual.txt | |
| diff -u /tmp/latest.txt /tmp/actual.txt | |
| EtherpadDockerWithPlugins: | |
| name: "Docker [${{ matrix.versions.tag }}] with plugins, editOnly: ${{ matrix.editOnly }}" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| versions: [ | |
| { tag: "2.7.2" }, | |
| { tag: "2.6.1" }, | |
| { tag: "2.5.0" }, | |
| ] | |
| editOnly: ["true", "false"] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Prepare environment | |
| uses: ./.github/actions/prepare-environment | |
| with: | |
| image: etherpad/etherpad:${{ matrix.versions.tag }} | |
| - name: Start docker containers | |
| run: | | |
| export ORIGINAL_CMD=$(docker inspect --format='{{join .Config.Cmd " "}}' etherpad/etherpad:${{ matrix.versions.tag }}) | |
| echo "Original CMD: $ORIGINAL_CMD" | |
| export EDIT_ONLY=${{ matrix.editOnly }} | |
| EP_VERSION=${{ matrix.versions.tag }} docker compose -f ./tests/e2e/docker/docker-compose.plugins.yml up -d --wait | |
| - name: Dump docker compose logs on failure | |
| if: failure() | |
| run: | | |
| docker compose -f ./tests/e2e/docker/docker-compose.plugins.yml logs --no-color --timestamps | |
| - name: Scan etherpad instance | |
| run: | | |
| set -euo pipefail | |
| output="$(bin/console.php ether:scan http://localhost:9001)" | |
| echo "$output" | |
| if [[ "${{ matrix.editOnly }}" == "false" ]]; then | |
| expected="Package version: ${{ matrix.versions.tag }}" | |
| if ! grep -Fq "$expected" <<< "$output"; then | |
| echo "Assertion failed: expected output to contain: $expected" | |
| exit 1 | |
| fi | |
| fi | |
| expectedPackages=( | |
| "ep_align" | |
| "ep_headings2" | |
| "ep_font_color" | |
| "ep_comments_page" | |
| "ep_font_size" | |
| "ep_markdown" | |
| ) | |
| for pkg in "${expectedPackages[@]}"; do | |
| if ! grep -Fq "* $pkg" <<< "$output"; then | |
| echo "Assertion failed: expected output to contain: * $pkg" | |
| exit 1 | |
| fi | |
| done | |
| EtherpadDifferentVersion: | |
| name: Docker [${{ matrix.versions.tag }}] | |
| runs-on: ubuntu-latest | |
| needs: DynamicVersionMatrix | |
| services: | |
| etherpad: | |
| image: etherpad/etherpad:${{ matrix.versions.tag }} | |
| ports: | |
| - 9001:9001 | |
| strategy: | |
| matrix: | |
| versions: ${{ fromJSON(needs.DynamicVersionMatrix.outputs.matrix) }} | |
| fail-fast: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Prepare environment | |
| uses: ./.github/actions/prepare-environment | |
| with: | |
| image: etherpad/etherpad:${{ matrix.versions.tag }} | |
| - name: Wait until etherpad is healthy | |
| run: | | |
| until curl -s -f -o /dev/null "http://localhost:9001" | |
| do | |
| sleep 2 | |
| done | |
| - name: Scan etherpad instance | |
| run: | | |
| set -euo pipefail | |
| output="$(bin/console.php ether:scan http://localhost:9001)" | |
| echo "$output" | |
| expected="Package version: ${{ matrix.versions.expected }}" | |
| if ! grep -Fq "$expected" <<< "$output"; then | |
| echo "Assertion failed: expected output to contain: $expected" | |
| exit 1 | |
| fi | |
| EtherpadAdminLogin: | |
| name: Docker admin login [${{ matrix.versions.tag }}] | |
| runs-on: ubuntu-latest | |
| services: | |
| etherpad: | |
| image: etherpad/etherpad:${{ matrix.versions.tag }} | |
| env: | |
| ADMIN_PASSWORD: admin | |
| ports: | |
| - 9001:9001 | |
| strategy: | |
| matrix: | |
| versions: [ | |
| { tag: "2.7.2" }, | |
| { tag: "2.6.1" }, | |
| { tag: "2.3.2" }, | |
| { tag: "2.2.2" }, | |
| { tag: "1.9.7" }, | |
| { tag: "1.8.0" }, | |
| ] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Prepare environment | |
| uses: ./.github/actions/prepare-environment | |
| with: | |
| image: etherpad/etherpad:${{ matrix.versions.tag }} | |
| - name: Scan etherpad instance | |
| run: | | |
| set -euo pipefail | |
| output="$(bin/console.php ether:scan http://localhost:9001)" | |
| echo "$output" | |
| expected="Admin area is accessible with admin / admin" | |
| if ! grep -Fq "$expected" <<< "$output"; then | |
| echo "Assertion failed: expected output to contain: $expected" | |
| exit 1 | |
| fi |