Skip to content

1.0.0-rc.5

1.0.0-rc.5 #115

Workflow file for this run

name: CI
on:
push:
branches: [main]
paths:
- 'src/**'
- '**.php'
- '*.json'
- 'composer.lock'
- 'phpunit.xml'
- '*.js'
- 'tests/e2e/**'
- 'playwright.config.ts'
pull_request:
branches: [main]
paths:
- 'src/**'
- '**.php'
- '*.json'
- 'composer.lock'
- 'phpunit.xml'
- '*.js'
- 'tests/e2e/**'
- 'playwright.config.ts'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-js:
name: JS Tests & Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run JS tests
run: npm run test:js -- --coverage
- name: Upload JS coverage to Codecov
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
flags: js
- name: Build
run: npm run build
- name: Upload build artifact
uses: actions/upload-artifact@v6
with:
name: js-build
path: |
build/
public/
retention-days: 1
test-php:
name: PHP Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install JS dependencies
run: npm ci
- name: Install PHP dependencies
run: composer install --optimize-autoloader --ignore-platform-req=ext-redis --ignore-platform-req=php
- name: Start wp-env
run: npm run wp-env -- start --xdebug
- name: Create test database
run: npm run wp-env -- run cli bash -- -c "mysql -h mysql -u root -ppassword -e 'CREATE DATABASE IF NOT EXISTS wordpress_test'"
- name: Run PHP tests
run: npm run wp-env -- run tests-cli --env-cwd=wp-content/plugins/Spotmap sh -c "XDEBUG_MODE=coverage composer run test:coverage"
- name: Upload PHP coverage to Codecov
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/clover.xml
flags: php
test-e2e:
name: E2E Tests
runs-on: ubuntu-latest
needs: test-js
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Download build artifact
uses: actions/download-artifact@v6
with:
name: js-build
- name: Install PHP dependencies
run: composer install --optimize-autoloader --ignore-platform-req=ext-redis --ignore-platform-req=php
- name: Start wp-env
run: npm run wp-env start
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run E2E tests
run: npm run test:e2e
env:
SPOTMAP_TOKEN_MAPBOX: ${{ secrets.SPOTMAP_TOKEN_MAPBOX }}
SPOTMAP_TOKEN_THUNDERFOREST: ${{ secrets.SPOTMAP_TOKEN_THUNDERFOREST }}
SPOTMAP_TOKEN_TIMEZONEDB: ${{ secrets.SPOTMAP_TOKEN_TIMEZONEDB }}
SPOTMAP_TOKEN_LINZ: ${{ secrets.SPOTMAP_TOKEN_LINZ }}
SPOTMAP_TOKEN_GEOPORTAIL: ${{ secrets.SPOTMAP_TOKEN_GEOPORTAIL }}
SPOTMAP_TOKEN_OSDATAHUB: ${{ secrets.SPOTMAP_TOKEN_OSDATAHUB }}