Tightening up cross site scripting #3236
Workflow file for this run
This file contains 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: PHP Unit Tests | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
branches: | |
- '*.dev' | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- 'release/[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
cancel-running-tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
steps: | |
- name: Cancel running tests | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
cancel_others: true | |
build-for-testing: | |
needs: cancel-running-tests | |
name: Build EE for testing | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Cache repository info | |
uses: actions/cache@v4 | |
with: | |
path: .git | |
key: cache-ee-git-${{ github.sha }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: dom, curl, sqlite, libxml, mbstring, zip, pcntl, pdo, mysql, bcmath, soap, intl, gd, exif, iconv, imagick | |
coverage: none | |
ini-values: error_log=/home/runner/php_errors.log, memory_limit=128M | |
- name: Checkout RedactorX | |
uses: actions/checkout@v4 | |
with: | |
repository: ExpressionEngine/RedactorX | |
token: ${{ secrets.ORG_ACCESS_TOKEN }} | |
path: __redactorx | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '10' | |
- name: Install build tool dependencies | |
working-directory: build-tools | |
run: npm install | |
- name: Get version | |
id: build_json | |
working-directory: build-tools | |
run: | | |
content=`node -pe 'JSON.parse(process.argv[1]).tag' "$(cat build.json)"` | |
echo "BUILD_VERSION=$content" >> $GITHUB_OUTPUT | |
- name: Run build process | |
working-directory: build-tools | |
env: | |
RELEASE_PRIVATE_KEY: ${{ secrets.RELEASE_PRIVATE_KEY }} | |
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }} | |
APP_REPO_PATH: ${{ github.workspace }} | |
REDACTORX_REPO_PATH: ${{ github.workspace }}/__redactorx | |
run: gulp build-app --local --nogit --head --skip-lint --skip-pro --version=${{ steps.build_json.outputs.BUILD_VERSION }} | |
- name: Rename build directory | |
working-directory: build-tools/builds | |
run: | | |
mv ExpressionEngine${{ steps.build_json.outputs.BUILD_VERSION }} ExpressionEngine | |
- name: Cache built EE version | |
uses: actions/cache@v4 | |
with: | |
path: build-tools/builds/ExpressionEngine | |
key: cache-ee-build-${{ github.sha }} | |
enableCrossOsArchive: true | |
- name: Directory Listing on Failure | |
if: failure() | |
run: | | |
ls -latr build-tools/builds | |
ls -latr build-tools/builds/ExpressionEngine | |
php-tests: | |
if: github.event.pull_request.draft == false | |
needs: [cancel-running-tests, build-for-testing] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [7.3, 7.4, 8.0, 8.1, 8.2, 8.3] | |
os: [ubuntu-latest] | |
include: | |
- php: 8.2 | |
os: windows-latest | |
name: PHPUnit, php${{ matrix.php }} - ${{ matrix.os }} | |
steps: | |
- name: Install locales | |
if: runner.os != 'Windows' | |
run: | | |
sudo locale-gen en | |
sudo locale-gen de | |
sudo locale-gen de_DE | |
sudo locale-gen uk | |
sudo locale-gen ru | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use cached EE build | |
uses: actions/cache@v4 | |
with: | |
path: build-tools/builds/ExpressionEngine | |
key: cache-ee-build-${{ github.sha }} | |
fail-on-cache-miss: true | |
enableCrossOsArchive: true | |
- name: Move vendor files (Linux) | |
if: runner.os != 'Windows' | |
run: | | |
cp -R build-tools/builds/ExpressionEngine/system/ee/vendor-build ./system/ee/ | |
- name: Move vendor files (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
xcopy build-tools\builds\ExpressionEngine\system\ee\vendor-build\ system\ee\vendor-build\ /s /e /f | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, sqlite, libxml, mbstring, zip, pcntl, pdo, mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | |
coverage: none | |
- name: Copy config.php | |
run: php -r "file_exists('system/user/config/config.php') || copy('tests/cypress/support/config/config.php', 'system/user/config/config.php');" | |
- name: Install PHP Unit Test dependencies | |
working-directory: system/ee/ExpressionEngine/Tests/ | |
run: | | |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader --no-interaction | |
composer require overtrue/phplint --dev --no-progress --no-suggest --prefer-dist | |
- name: Run PHPLint | |
run: ./system/ee/ExpressionEngine/Tests/vendor/bin/phplint --no-configuration ./ --exclude=system/ee/ExpressionEngine/Tests/vendor --exclude=system/ee/installer/config/config_tmpl.php --exclude=system/ee/ExpressionEngine/Service/Generator/stubs | |
- name: Configure matchers | |
uses: mheap/phpunit-matcher-action@v1 | |
- name: Run PHPUnit Tests | |
working-directory: system/ee/ExpressionEngine/Tests/ | |
run: vendor/bin/phpunit --testdox --configuration=phpunit.xml |