Skip to content

Merge branch 'master' into badlogin #1

Merge branch 'master' into badlogin

Merge branch 'master' into badlogin #1

Workflow file for this run

name: CI
on:
workflow_dispatch: ~
pull_request: ~
push: ~
jobs:
dependency-validation:
name: Dependency validation
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
env:
PHP_VERSION: 8.3
PHP_EXTENSIONS: none, ctype, curl, dom, fileinfo, intl, json, libxml, mbstring, mysqli, openssl, pgsql, simplexml, tokenizer, xml, xmlwriter, zip
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.PHP_EXTENSIONS }}
coverage: none
tools: composer
- name: Ensure that composer.json is valid
run: composer validate --no-ansi --strict composer.json
- name: Get Composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ env.PHP_VERSION }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
php-${{ env.PHP_VERSION }}-composer-
- name: Ensure that dependencies can be installed
run: composer install --no-ansi
code-style-checker:
name: Code-style checker
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
needs:
- dependency-validation
env:
PHP_VERSION: 8.3
PHP_EXTENSIONS: none, ctype, curl, dom, fileinfo, intl, json, libxml, mbstring, mysqli, openssl, pgsql, simplexml, tokenizer, xml, xmlwriter, zip
runs-on: ubuntu-latest
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.PHP_EXTENSIONS }}
coverage: none
tools: composer
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ env.PHP_VERSION }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
php-${{ env.PHP_VERSION }}-composer-
- name: Install dependencies with Composer
run: composer install --no-interaction --no-ansi --no-progress
- name: Cache ECS results
uses: actions/cache@v4
with:
path: "var/cache/tools/ecs"
key: "ecs-${{ github.run_id }}"
restore-keys: |
ecs-
- name: Run ECS
run: lib/vendor/bin/ecs --no-progress-bar --no-ansi --no-interaction
type-checker:
name: Type checker
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
needs:
- dependency-validation
env:
PHP_VERSION: 8.3
PHP_EXTENSIONS: none, ctype, curl, dom, fileinfo, intl, json, libxml, mbstring, mysqli, openssl, pgsql, simplexml, tokenizer, xml, xmlwriter, zip
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.PHP_EXTENSIONS }}
coverage: none
tools: composer
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ env.PHP_VERSION }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
php-${{ env.PHP_VERSION }}-composer-
- name: Install dependencies with Composer
run: composer install --no-interaction --no-ansi --no-progress
- name: Cache PHPStan results
uses: actions/cache@v4
with:
path: "var/cache/tools/phpstan"
key: "phpstan-${{ github.run_id }}"
restore-keys: |
phpstan-
- name: Run PHPStan
run: lib/vendor/bin/phpstan --no-progress -n
compatibility-checker:
name: Compatibility checker
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
needs:
- dependency-validation
env:
PHP_VERSION: 8.3
PHP_EXTENSIONS: none, ctype, curl, dom, fileinfo, intl, json, libxml, mbstring, mysqli, openssl, pgsql, simplexml, tokenizer, xml, xmlwriter, zip
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.PHP_EXTENSIONS }}
coverage: none
tools: composer
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ env.PHP_VERSION }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
php-${{ env.PHP_VERSION }}-composer-
- name: Install dependencies with Composer
run: composer install --no-interaction --no-ansi --no-progress
- name: Run phpcs
run: lib/vendor/bin/phpcs -qs
refactoring-checker:
name: Refactoring checker
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
needs:
- dependency-validation
env:
PHP_VERSION: 8.3
PHP_EXTENSIONS: none, ctype, curl, dom, fileinfo, intl, json, libxml, mbstring, mysqli, openssl, pgsql, simplexml, tokenizer, xml, xmlwriter, zip
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.PHP_EXTENSIONS }}
coverage: none
tools: composer
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ env.PHP_VERSION }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
php-${{ env.PHP_VERSION }}-composer-
- name: Install dependencies with Composer
run: composer install --no-interaction --no-ansi --no-progress
- name: Cache Rector results
uses: actions/cache@v4
with:
path: "var/cache/tools/rector"
key: "rector-${{ github.run_id }}"
restore-keys: |
rector-
- name: Init Rector cache
run: mkdir -p var/cache/tools/rector
- name: Run Rector
run: lib/vendor/bin/rector -n
post-commit:
name: Post commit hooks
if: github.event_name != 'pull_request'
needs:
- type-checker
- code-style-checker
- compatibility-checker
- refactoring-checker
env:
PHP_VERSION: 8.3
PHP_EXTENSIONS: none, ctype, curl, dom, fileinfo, intl, json, libxml, mbstring, mysqli, openssl, pgsql, simplexml, tokenizer, xml, xmlwriter, zip
PHP_INI_VALUES: memory_limit=-1, assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
runs-on: ubuntu-latest
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
outputs:
next: ${{ steps.push.outputs.next }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.MATTEO_PAT }}
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: composer
- name: Install Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
- name: Install ant 1.7
run: |
curl -s -O http://archive.debian.org/debian-archive/debian/pool/main/a/ant1.7/ant1.7_1.7.1-7_all.deb
curl -s -O http://archive.debian.org/debian-archive/debian/pool/main/a/ant1.7/ant1.7-optional_1.7.1-7_all.deb
sudo apt-get -y -qq remove ant
sudo apt-get -y -qq install libxerces2-java
sudo dpkg -i ant1.7_1.7.1-7_all.deb
sudo dpkg -i ant1.7-optional_1.7.1-7_all.deb
rm *.deb
- name: Gather commit messages
id: gather
env:
JSON: ${{ toJson(github.event.commits) }}
run: |
{
echo 'MSG<<EOF'
echo
echo
echo "${JSON}" | jq -r '.[].message' | sed s'/^/ * /g'
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ env.PHP_VERSION }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
php-${{ env.PHP_VERSION }}-composer-
- name: Install dependencies with Composer
run: composer install --no-interaction --no-ansi --no-progress
- name: Regenerate XML Cache
run: ant generate-xml-cache
- name: Add & Commit
id: add-xml
uses: EndBug/add-and-commit@v9
with:
add: etc/xmlcache
message: 'Regenerated XML cache ${{ steps.gather.outputs.MSG }}'
push: false
- name: Update plugin translations
run: php scripts/translations/update-plugins.php
- name: Add & Commit
id: add-trans
uses: EndBug/add-and-commit@v9
with:
add: plugins_repo
message: 'Updated plugin translations ${{ steps.gather.outputs.MSG }}'
push: false
- name: Update plugin packages
run: php scripts/upgrade/rebuildBundledPlugins.php
- name: Add & Commit
id: add-plugins
uses: EndBug/add-and-commit@v9
with:
add: etc/plugins plugins_repo
message: 'Regenerated plugins ${{ steps.gather.outputs.MSG }}'
push: false
- name: Regenerate delivery
run: |
ant generate-delivery
ant minify-delivery
- name: Add & Commit
id: add-delivery
uses: EndBug/add-and-commit@v9
with:
add: www/delivery
message: 'Regenerated delivery scripts ${{ steps.gather.outputs.MSG }}'
push: false
- name: Push
if: steps.add-delivery.outputs.committed == 'true' || steps.add-plugins.outputs.committed == 'true' || steps.add-trans.outputs.committed == 'true' || steps.add-xml.outputs.committed == 'true'
id: push
run: |
git push origin
echo "next=skip" >> $GITHUB_OUTPUT
trigger-tests:
name: Trigger tests
needs:
- type-checker
- code-style-checker
- compatibility-checker
- refactoring-checker
- post-commit
if: ${{ always() && needs.type-checker.result == 'success' && needs.code-style-checker.result == 'success' && needs.compatibility-checker.result == 'success' && needs.refactoring-checker.result == 'success' && needs.post-commit.result != 'failure' && needs.post-commit.result != 'cancelled' && needs.post-commit.outputs.next != 'skip' }}
uses: ./.github/workflows/test.yml
upload-to-crowdin:
name: Upload translation sources
if: github.repository == 'revive-adserver/revive-adserver' && github.ref_name == 'master' && needs.post-commit.outputs.next != 'skip'
needs:
- type-checker
- code-style-checker
- compatibility-checker
- refactoring-checker
- post-commit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Upload translation sources to Crowdin
if: env.CROWDIN_PROJECT_ID && env.CROWDIN_PERSONAL_TOKEN
uses: revive-adserver/crowdin-github-action@revive
with:
config: crowdin.yml.dist
upload_sources: true
upload_translations: false
download_translations: false
create_pull_request: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}