Symfony 7 compatibility #93
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: Test | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '**/README.md' | |
pull_request: | |
branches: | |
- '**' | |
paths-ignore: | |
- '**/README.md' | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
byte_level: | |
name: Byte-level | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check file permissions | |
run: | | |
test "$(find ./ -type f -not -path './.git/*' -executable)" = "./install/bin/console" | |
- name: Check for byte order mark (BOM) | |
run: | | |
! git grep --perl-regexp -I -e '^\xEF\xBB\xBF' | |
- name: Find non-printable ASCII characters | |
run: | | |
! LC_ALL=C.UTF-8 git grep --perl-regexp --line-number -e '[^ -~]' -- '*\.php' | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: ['8.2', '8.3'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
id: setup-php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip | |
tools: composer:v2 | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir="$(composer config cache-files-dir)"" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install composer dependencies | |
run: composer install | |
- name: Launch test suite | |
run: make test | |
project_installation_docker: | |
name: New project installation | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: ['8.2', '8.3'] | |
symfony: ['6.1', '6.2', '6.3', '6.4', '7.0'] | |
steps: | |
- uses: FranzDiebold/github-env-vars-action@v2 | |
- uses: actions/checkout@v4 | |
with: | |
path: temp/sword-bundle | |
- name: Create temporary branch alias for master and feature branches | |
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/pull/') | |
run: | | |
cd temp/sword-bundle | |
composer config --unset extra.branch-alias.dev-master | |
composer config extra.branch-alias.dev-$CI_REF_NAME_SLUG 1.x-dev | |
- name: Create temporary branch alias for pull requests | |
if: startsWith(github.ref, 'refs/pull/') | |
run: | | |
cd temp/sword-bundle | |
composer config --unset extra.branch-alias.dev-master | |
composer config extra.branch-alias.dev-$CI_SHA 1.x-dev | |
- name: Setup PHP | |
id: setup-php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, redis, sysvsem | |
tools: composer:v2, symfony | |
coverage: none | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create a new project | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Sword" | |
symfony new newproject --webapp --version="${{ matrix.symfony }}" | |
cd newproject | |
cp -Rp . ../ | |
cd .. | |
rm -rf newproject | |
rm -f composer.lock docker-compose* compose.yaml compose.override.yaml | |
echo "APP_NAME=sword" >> .env | |
echo "PROJECT_DIR=${PWD##*/}" >> .env | |
echo "MAILER_DSN=smtp://mailer:25" >> .env | |
composer config --no-interaction minimum-stability dev | |
composer config --no-interaction prefer-stable true | |
composer config --no-interaction repositories.wordpress '{"type": "composer", "url": "https://wpackagist.org", "only": ["wpackagist-plugin/*", "wpackagist-theme/*"]}' | |
composer config --no-interaction repositories.sword path ./temp/sword-bundle | |
composer config --no-interaction allow-plugins.composer/installers true | |
composer config --no-interaction allow-plugins.composer/package-versions-deprecated true | |
composer config --no-interaction allow-plugins.johnpbloch/wordpress-core-installer true | |
composer config --no-interaction allow-plugins.ergebnis/composer-normalize true | |
composer config --no-interaction --json extra.installer-paths.wp/content/plugins/{\$name}/ '["type:wordpress-plugin"]' | |
composer config --no-interaction --json extra.installer-paths.wp/content/themes/{\$name}/ '["type:wordpress-theme"]' | |
composer config --no-interaction extra.symfony.allow-contrib true | |
composer config --no-interaction extra.wordpress-install-dir "wp/core" | |
composer require --no-interaction phpsword/sword-bundle johnpbloch/wordpress wpackagist-plugin/akismet wpackagist-theme/twentytwentyfour | |
rm bin/console | |
cp vendor/phpsword/sword-bundle/install/docker-compose.yml docker-compose.yml | |
cp vendor/phpsword/sword-bundle/install/docker-compose.prod.yml docker-compose.prod.yml | |
cp vendor/phpsword/sword-bundle/install/bin/console bin/console | |
sed -i "s/PHP_VERSION: 8.1-dev/PHP_VERSION: ${{ matrix.php }}-dev/" docker-compose.yml | |
php_version=$(echo ${{ matrix.php }} | tr -d '.') | |
sed -i "s@/etc/php81/conf.d@/etc/php$php_version/conf.d@" docker-compose.yml | |
# Remove symlink and copy actual files so it gets copied later in the installer image | |
rm vendor/phpsword/sword-bundle | |
cd ./temp/sword-bundle | |
cp -Rp . ../../vendor/phpsword/sword-bundle | |
cd ../.. | |
- name: Build Docker installer | |
run: | | |
wget https://raw.githubusercontent.com/phpsword/installer/master/.dockerignore | |
mkdir build | |
wget -O build/Dockerfile https://raw.githubusercontent.com/phpsword/installer/master/build/Dockerfile | |
wget -O build/docker-entrypoint.sh https://raw.githubusercontent.com/phpsword/installer/master/build/docker-entrypoint.sh | |
docker build --no-cache -t projectinstaller:latest -f ./build/Dockerfile . | |
- name: Create Docker environment | |
run: | | |
docker run --rm -t -e HOST_PWD="$PWD" \ | |
-v "$PWD":/app -v /var/run/docker.sock:/var/run/docker.sock \ | |
projectinstaller testproject -v | |
sleep 20 | |
- name: Check that website is up and running | |
run: | | |
wget --no-check-certificate -O- https://testproject.localhost/ | |
url=$(curl https://testproject.localhost -k -s -L -I -o /dev/null -w '%{url_effective}') | |
echo $url | |
[ "$url" = "https://testproject.localhost/wp-admin/install.php" ] | |
- name: Check PHP version | |
run: cd testproject && docker compose exec php php -v | grep "PHP ${{ matrix.php }}" |