Skip to content

[PHP] Only use Guzzle to send requests #6239

[PHP] Only use Guzzle to send requests

[PHP] Only use Guzzle to send requests #6239

Workflow file for this run

name: "🎳 End2end"
on:
pull_request:
types: [ labeled, opened, synchronize, reopened ]
branches:
- master
- release_3_*
workflow_dispatch:
repository_dispatch:
types: [ run-e2e-branches ]
jobs:
end2end:
# The first condition is triggered when we set the new label
# The second one when we update the PR with new commits without changing labels
# The third one when external workflow
# The fourth one is for the manual button
if: |
github.event.label.name == 'run end2end' ||
contains(github.event.pull_request.labels.*.name, 'run end2end') ||
github.event_name == 'repository_dispatch' ||
github.event_name == 'workflow_dispatch'
name: "End-to-end"
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests
env:
CYPRESS_CI: TRUE
# For testing only
# PHP_VERSION: 8.3
# LZMPOSTGISVERSION: 16-3
# LZMQGSRVVERSION: 3.34
steps:
# - name: Debug
# working-directory: .
# run: |
# echo ${{ github.event.pull_request.head.sha }}
# echo ${{ github.head_ref }}
# echo ${{ github.ref_name }}
- name: Define branch name from env for the checkout
working-directory: .
run: |
if ${{ github.event_name == 'repository_dispatch' }}
then
# repository_dispatch is from an external workflow, for instance a cron workflow
echo "Set branch from manual input: ${{ github.event.client_payload.branch }}"
BRANCH="${{ github.event.client_payload.branch }}"
elif ${{ github.event_name == 'workflow_dispatch' }}
then
# workflow_dispatch is the the button in UI
echo "Set branch from default value: ${{ github.ref }}"
BRANCH="${{ github.ref }}"
else
# From a PR
echo "Event type ${{ github.event_name }}"
echo "Set branch from default value : ${{ github.event.pull_request.head.sha }} "
BRANCH="${{ github.event.pull_request.head.sha }}"
fi
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH }}
token: ${{ secrets.BOT_HUB_TOKEN || github.token }} # Important to launch CI on a commit from a bot
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/} with CYPRESS = ${CYPRESS_CI}
- name: Make environment and show Lizmap versions
run: |
make env
cat .env
# For testing only
# - name: Update projects
# run: |
# make upgrade-projects
# git status
- name: Install QGIS server plugins
run: make build-plugins
- name: Show QGIS server environment
run: |
make show-qgis-server-versions
- name: Pull docker images
run: ./run-docker pull
- name: Build and start docker images
run: ./run-docker up --build -d
- name: Wait docker images ready and install Lizmap
run: |
sleep 30
./lizmap-ctl install
- name: Load SQL data
run: |
cd qgis-projects/tests
./load_sql.sh
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 othersite.local" | sudo tee -a /etc/hosts
# Playwright
- uses: actions/setup-node@v4
with:
node-version: 21
- name: Install dependencies
run: |
cd end2end
npm ci
- name: Install Playwright
run: |
cd end2end
npx playwright install --with-deps chromium
- name: Run Playwright tests
id: test-playwright
run: |
cd end2end
npx playwright test --project=end2end
# - name: Generate PG dump from Playwright
# if: failure()
# run: |
# ./lizmap-ctl dump-pgsql
#
# - name: Check the database diff from Playwright
# if: failure()
# run: |
# git diff qgis-projects/tests/tests_dataset.sql
# git restore qgis-projects/tests/tests_dataset.sql
- name: Notify in case of playwright failure, from mainstream branches only
uses: peter-evans/commit-comment@v3
if: github.repository == '3liz/lizmap-web-client' && failure() && steps.test-playwright.outcome != 'success' && github.event_name == 'repository_dispatch'
with:
token: ${{ secrets.BOT_HUB_TOKEN }}
body: |
The latest **weekly** run of end2end "playwright" tests failed with this latest commit on the branch **${{ env.BRANCH }}** 😣
CC @nboisteault and @Gustry, please have a look to the logs. Maybe it's a false positive ?
Visit ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4.4.3
with:
name: playwright-report
path: tests/end2end/playwright-report
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
id: test-cypress
# Always run, even if playwright has failed
if: always()
uses: cypress-io/github-action@v6.7.6
with:
browser: chrome
headed: true
working-directory: tests/end2end
spec: cypress/integration/*-ghaction.js
wait-on: http://localhost:8130
- name: Notify in case of cypress failure, from mainstream branches only
uses: peter-evans/commit-comment@v3
if: github.repository == '3liz/lizmap-web-client' && failure() && steps.test-cypress.outcome != 'success' && github.event_name == 'repository_dispatch'
with:
token: ${{ secrets.BOT_HUB_TOKEN }}
body: |
The latest **weekly** run of end2end "cypress" tests failed with this latest commit on the branch **${{ env.BRANCH }}** 😣
CC @nboisteault and @Gustry, please have a look to the logs. Maybe it's a false positive ?
Visit ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Save screenshots as artifacts if a test fails to ease debug
uses: actions/upload-artifact@v4.4.3
if: failure()
with:
name: cypress-screenshots
path: |
tests/end2end/cypress/screenshots
tests/end2end/cypress/downloads
# - name: Generate PG dump from Cypress
# if: failure()
# run: |
# ./lizmap-ctl dump-pgsql
#
# - name: Check the database diff from Cypress
# if: failure()
# run: |
# git diff qgis-projects/tests/tests_dataset.sql
# git restore qgis-projects/tests/tests_dataset.sql
# [[ -z $(git status --porcelain -uno) ]]
# exit $?
# debug:
# name: "Debug"
# runs-on: ubuntu-latest
# steps:
# - name: Dump GitHub context
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: |
# echo "$GITHUB_CONTEXT"