Skip to content

Commit

Permalink
Merge pull request #229 from lemberg/feature/228-php-8
Browse files Browse the repository at this point in the history
Add PHP 8 support
  • Loading branch information
T2L committed Jan 28, 2021
2 parents 456293b + ab3c4fd commit 550765a
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 29 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/Integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ on:

jobs:
php:
name: Composer ${{ matrix.composer-version }} / PHP ${{ matrix.php-version }}
name: PHP ${{ matrix.php-version }} / Composer ${{ matrix.composer-version }}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version:
- '7.3'
- '7.4'
- '8.0'
composer-version:
- 1
- 2
Expand Down Expand Up @@ -53,9 +55,7 @@ jobs:
restore-keys: php-${{ matrix.php-version }}-${{ matrix.composer-version }}-

- name: Install Composer dependencies
env:
PREFER_LOWEST: ${{ matrix.prefer-lowest }}
run: composer update --no-progress --prefer-dist --optimize-autoloader $PREFER_LOWEST
run: composer update --no-progress --prefer-dist --optimize-autoloader ${{ matrix.prefer-lowest }}

- name: Coding standards
run: vendor/bin/phpcs
Expand All @@ -67,7 +67,7 @@ jobs:
run: vendor/bin/phpunit

molecule:
name: Molecule ubuntu/${{ matrix.molecule-platform }}
name: Molecule / ubuntu/${{ matrix.molecule-platform }}

needs: php

Expand Down Expand Up @@ -132,16 +132,20 @@ jobs:
MOLECULE_PLATFORM: ${{ matrix.molecule-platform }}

vagrant:
name: Vagrant up
name: Vagrant / ubuntu/${{ matrix.vagrant-box }}

needs: php
needs: molecule

runs-on: macos-latest

strategy:
matrix:
php-version:
- '7.4'
vagrant-box:
- xenial64
- bionic64
- focal64

# Workaround 'XXX may have been in progress in another thread when fork()
# was called.'
Expand Down Expand Up @@ -170,6 +174,9 @@ jobs:
- name: Install Composer dependencies
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist --optimize-autoloader --no-dev

- name: Set Vagrant box to use
run: sed -i '' 's/xenial64/${{ matrix.vagrant-box }}/g' default.vm-settings.yml

- name: Provision the machine
run: vagrant up

Expand All @@ -188,6 +195,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 50

# Some tests run Composer via command line. It's not possible to require
# a package in the detached state. Checkout to a branch to workaround
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Updates:
- [GH-184](https://github.com/lemberg/draft-environment/issues/184) - Drop support of PHP7.2 and bump minimum phpunit/phpunit version to ^9.3
- [GH-219](https://github.com/lemberg/draft-environment/issues/219) - Add support for Composer 2
- [GH-226](https://github.com/lemberg/draft-environment/issues/226) - Migrate from Travis to Github Actions
- [GH-228](https://github.com/lemberg/draft-environment/issues/228) - Add PHP 8 support

Fixes:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This is Vagrant-based development environment for Drupal projects. This project

## Prerequisites

- PHP (^7.3) and Composer
- PHP (7.3+ or 8.0) and Composer 1/2
- Vagrant (2.2.6+)
- VirtualBox (5.2+)
- [mkcert](https://mkcert.dev) (optional)
Expand Down
20 changes: 10 additions & 10 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
#
# See https://docs.vagrantup.com/v2/provisioning/index.html

# Ensure Python 3.x is set as a default.
config.vm.provision "shell",
keep_color: true,
inline: <<-SHELL
add-apt-repository ppa:deadsnakes/ppa -y
apt-get update -q
apt-get install python3.7 -y
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 10
SHELL

# Copy generated SSL certificate and private key to the VM.
unless configuration.get("mkcert").nil?
config.vm.provision "file", source: configuration.get("mkcert.directory") + "/.", destination: "/tmp/mkcert"
Expand All @@ -239,6 +229,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

# Run Ansible provisioner from within the virtual machine using Ansible Local
# provisioner.

# Use PiP version < 21 for Ubuntu 16.04.
get_pip_url = configuration.get("vagrant.box") === "ubuntu/xenial64" ? "https://bootstrap.pypa.io/3.5/get-pip.py" : "https://bootstrap.pypa.io/get-pip.py"

config.vm.provision "ansible_local" do |ansible|
ansible.become = true
ansible.playbook = "playbook.yml"
Expand All @@ -249,6 +243,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
ansible.galaxy_command = "sudo ansible-galaxy install --role-file=%{role_file} --roles-path=%{roles_path} --force"
ansible.compatibility_mode = "2.0"
ansible.install_mode = "pip"
ansible.pip_install_cmd = <<-SHELL
# Ensure that required Python packsges are present.
sudo apt install python3-apt python3-distutils -y
# Install PiP.
curl #{get_pip_url} | sudo python3
SHELL
ansible.version = configuration.get("ansible.version")
end

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Development environment for Draft Drupal.",
"license": "GPL-2.0-or-later",
"require": {
"php": "^7.3",
"php": ">=7.3",
"composer-plugin-api": "^1.1 || ^2.0",
"nette/robot-loader": "^3.2",
"symfony/filesystem": "^3.4 || ^4.4 || ^5",
Expand All @@ -17,11 +17,11 @@
"dg/bypass-finals": "^1.2.2",
"drupal/coder": "^8.3.8",
"ergebnis/composer-normalize": "^2.3",
"ergebnis/phpstan-rules": "^0.14",
"ergebnis/phpstan-rules": "^0.15",
"mikey179/vfsstream": "^1.6",
"php-mock/php-mock-phpunit": "^2.5",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpro/grumphp": "^0.18.0",
"phpro/grumphp": "^1.2",
"phpstan/extension-installer": "^1.0.4",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-deprecation-rules": "^0.12",
Expand Down
4 changes: 1 addition & 3 deletions grumphp.yml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
parameters:
grumphp:
ascii: ~
git_dir: .
bin_dir: vendor/bin
tasks:
composer: ~
composer_normalize: ~
Expand Down
2 changes: 1 addition & 1 deletion src/Config/Manager/AbstractConfigManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ final protected function setPackageExtra(array $extra): void {
/**
* Manually autoload dependencies from Nette framework.
*/
final private function autoloadDependencies(): void {
private function autoloadDependencies(): void {
$loader = new ClassLoader();

$vendorDir = $this->composer->getConfig()->get('vendor-dir');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
"lemberg/draft-environment": "3.x.x-dev"
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"config": {
"platform": {
"php": "7.3.0"
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"lemberg/draft-environment": "3.0.0-beta4"
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"config": {
"platform": {
"php": "7.3.0"
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

0 comments on commit 550765a

Please sign in to comment.