Skip to content

Commit

Permalink
Merge branch 'master' into feat/deliveryform-override-price
Browse files Browse the repository at this point in the history
  • Loading branch information
Atala committed Feb 7, 2025
2 parents 26a78f8 + b906053 commit 3d1d9b4
Show file tree
Hide file tree
Showing 41 changed files with 512 additions and 301 deletions.
43 changes: 43 additions & 0 deletions .github/actions/run-coopcycle-web/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run CoopCycle Web

runs:
using: "composite"
steps:
- name: Create .env file
shell: bash
run: cp .env.dist .env
- name: Pull Docker images
shell: bash
run: docker compose pull --ignore-pull-failures
- name: Prepare OSRM data
shell: bash
run: |
docker compose run -T --rm osrm wget --no-check-certificate https://coopcycle-assets.sfo2.digitaloceanspaces.com/osm/paris-france.osm.pbf -O /data/data.osm.pbf
docker compose run -T --rm osrm osrm-extract -p /opt/bicycle.lua /data/data.osm.pbf
docker compose run -T --rm osrm osrm-partition /data/data.osrm
docker compose run -T --rm osrm osrm-customize /data/data.osrm
# Cypress GitHub Action uses npm ci, and it causes a "permission denied" error,
# because it tries to remove the node_modules/ folder, which is mounted with root:root
# We create the node_modules/ folder *BEFORE* starting the containers,
# so that it can be removed without problems.
- name: Create node_modules directory
shell: bash
run: mkdir node_modules
- name: Start Docker containers
shell: bash
run: docker compose up -d
- name: Wait for PHP-FPM
shell: bash
run: until docker inspect --format='{{ .State.Health.Status }}' $(docker compose ps -q php) | grep -wq healthy; do sleep 5; done
- name: Wait webpack
shell: bash
run: until [ -f "web/build/entrypoints.json" ]; do sleep 5; done
- name: Create database
shell: bash
run: docker compose exec -T php bin/console doctrine:schema:create --env=test
- name: Create typesense collections
shell: bash
run: docker compose exec -T php bin/console typesense:create --env=test
- name: Validate database schema
shell: bash
run: docker compose exec -T php bin/console doctrine:schema:validate --env=test --skip-sync
8 changes: 8 additions & 0 deletions .github/actions/show-symfony-warnings/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Show Symfony warnings

runs:
using: "composite"
steps:
- name: Show warnings for the test environment
shell: bash
run: docker compose exec -T php cat var/logs/test-$(date +'%Y-%m-%d').log | grep -v -e DEBUG -e INFO
13 changes: 13 additions & 0 deletions .github/actions/upload-symfony-logs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Upload Symfony logs

runs:
using: "composite"
steps:
- name: Copy Symfony logs
shell: bash
run: docker compose exec -T php cat var/logs/test-$(date +'%Y-%m-%d').log > symfony_logs.log
- name: Upload Symfony logs
uses: actions/upload-artifact@v4
with:
name: symfony-logs
path: symfony_logs.log
17 changes: 17 additions & 0 deletions .github/workflows/lint_js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint JS
on: push
env:
APP_ENV: test
NODE_ENV: test
jobs:
LINT_JS:
name: Lint JS
runs-on: ubuntu-latest
env:
CYPRESS_INSTALL_BINARY: '0'
steps:
- uses: actions/checkout@v2
- name: Install JS dependencies
run: npm ci
- name: Run ESLint
run: node_modules/.bin/eslint --quiet js/app/
32 changes: 32 additions & 0 deletions .github/workflows/lint_php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint PHP
on: push
env:
APP_ENV: test
NODE_ENV: test
jobs:
LINT_PHP:
name: Lint PHP
runs-on: ubuntu-latest
strategy:
matrix:
php_version:
- '8.2'
- '8.3'
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
tools: composer:v2, phpstan:1
extensions: redis
- name: Install PHP dependencies
run: |
composer install --prefer-dist --no-progress --no-scripts
- name: Run PHPStan
run: phpstan analyse
- name: Clear Symfony cache
run: bin/console cache:clear
- name: Warmup Symfony cache
run: bin/console cache:warmup
182 changes: 0 additions & 182 deletions .github/workflows/test.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/test_behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test Behat
on: push
env:
APP_ENV: test
NODE_ENV: test
jobs:
BEHAT:
name: Run Behat tests
runs-on: ubuntu-latest
env:
STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }}
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
steps:
- name: Set timezone
uses: szenius/[email protected]
with:
timezoneLinux: "Europe/Paris"
- uses: actions/checkout@v2
- name: Run CoopCycle Web
uses: ./.github/actions/run-coopcycle-web
timeout-minutes: 5
- name: Run Behat
run: docker compose exec -T php vendor/bin/behat -f progress
- name: Show Symfony warnings on failure
if: failure()
uses: ./.github/actions/show-symfony-warnings
- name: Upload Symfony logs on failure
if: failure()
uses: ./.github/actions/upload-symfony-logs
30 changes: 30 additions & 0 deletions .github/workflows/test_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test Component
on: push
env:
APP_ENV: test
NODE_ENV: test
jobs:
COMPONENT:
name: Run component tests with Cypress
runs-on: ubuntu-latest
strategy:
matrix:
country: [fr]
env:
GEOCODE_EARTH_API_KEY: ${{ secrets.GEOCODE_EARTH_API_KEY }}
COOPCYCLE_COUNTRY: ${{ matrix.country }}
COOPCYCLE_LOCALE: ${{ matrix.country }}
steps:
- uses: actions/checkout@v2
- name: Run Cypress
uses: cypress-io/github-action@v6
with:
component: true
spec: cypress/component/**/*.cy.js
- name: Upload images for failed tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
Loading

0 comments on commit 3d1d9b4

Please sign in to comment.