Skip to content

Commit

Permalink
Merge pull request #63 from WyriHaximus/update-to-php-8.2
Browse files Browse the repository at this point in the history
Update tp PHP 8.2
  • Loading branch information
WyriHaximus authored Dec 17, 2022
2 parents b538294 + 4b33a68 commit db7a5de
Show file tree
Hide file tree
Showing 6 changed files with 3,228 additions and 1,673 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
composer-install:
runs-on: ubuntu-latest
container:
image: wyrihaximusnet/php:7.4-zts-alpine3.11-dev-root
image: wyrihaximusnet/php:8.2-nts-alpine-slim-dev-root
steps:
- uses: actions/checkout@v1
- name: Cache composer packages
Expand All @@ -25,11 +25,11 @@ jobs:
strategy:
fail-fast: false
matrix:
qa: [lint, cs, stan, psalm, unit, infection, composer-require-checker, composer-unused]
qa: [cs, stan, psalm, unit, composer-require-checker, composer-unused]
needs: composer-install
runs-on: ubuntu-latest
container:
image: wyrihaximusnet/php:7.4-zts-alpine3.11-dev-root
image: wyrihaximusnet/php:8.2-nts-alpine-slim-dev-root
steps:
- uses: actions/checkout@v1
- name: Cache composer packages
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile-build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM composer:2 AS runtime
FROM wyrihaximusnet/php:8.2-nts-alpine-slim-dev-root AS dependencies

RUN mkdir /workdir
COPY next.php /workdir
Expand All @@ -8,6 +8,10 @@ COPY ./composer.json /workdir
COPY ./composer.lock /workdir
WORKDIR /workdir

RUN composer install --ansi --no-progress --no-interaction --prefer-dist --no-dev
RUN composer install --ansi --no-progress --no-interaction --prefer-dist --no-dev -o

FROM wyrihaximusnet/php:8.2-nts-alpine-slim-root AS runtime

COPY --from=dependencies /workdir/ /workdir/

ENTRYPOINT ["php", "/workdir/next.php"]
64 changes: 45 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,69 @@ SHELL=bash

.PHONY: *

DOCKER_CGROUP:=$(shell cat /proc/1/cgroup | grep docker | wc -l)
COMPOSER_CACHE_DIR=$(shell composer config --global cache-dir -q || echo ${HOME}/.composer/cache)

ifneq ("$(wildcard /.dockerenv)","")
DOCKER_RUN=
IN_DOCKER=TRUE
else ifneq ("$(DOCKER_CGROUP)","0")
IN_DOCKER=TRUE
else
IN_DOCKER=FALSe
endif

ifeq ("$(IN_DOCKER)","TRUE")
DOCKER_RUN=
else
DOCKER_RUN=docker run --rm -it \
-v `pwd`:`pwd` \
-w `pwd` \
"wyrihaximusnet/php:7.4-zts-alpine3.11-dev"
-v "`pwd`:`pwd`" \
-v "${COMPOSER_CACHE_DIR}:/home/app/.composer/cache" \
-w "`pwd`" \
"wyrihaximusnet/php:8.2-nts-alpine-slim-dev"
endif

all: lint cs-fix cs stan psalm unit infection composer-require-checker composer-unused
all: ## Runs everything ###
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "###" | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs --open-tty $(MAKE)

lint:
syntax-php: ## Lint PHP syntax
$(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor .

cs:
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(nproc)
cs-fix: ## Fix any automatically fixable code style issues
$(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(shell nproc)

cs-fix:
$(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(nproc)
cs: ## Check the code for code style issues
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(shell nproc)

stan:
stan: ## Run static analysis (PHPStan)
$(DOCKER_RUN) vendor/bin/phpstan analyse src tests --level max --ansi -c phpstan.neon

psalm:
$(DOCKER_RUN) vendor/bin/psalm --threads=$(nproc) --shepherd --stats
psalm: ## Run static analysis (Psalm)
$(DOCKER_RUN) vendor/bin/psalm --threads=$(shell nproc) --shepherd --stats

unit:
unit: ## Run tests
$(DOCKER_RUN) vendor/bin/phpunit --colors=always -c phpunit.xml.dist --coverage-text --coverage-html covHtml --coverage-clover ./build/logs/clover.xml

unit-ci: unit
if [ -f ./build/logs/clover.xml ]; then wget https://scrutinizer-ci.com/ocular.phar && sleep 3 && php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi

infection:
$(DOCKER_RUN) vendor/bin/infection --ansi --min-msi=100 --min-covered-msi=100 --threads=$(nproc)
infection: ## Run mutation testing
$(DOCKER_RUN) vendor/bin/infection --ansi --min-msi=100 --min-covered-msi=100 --threads=$(shell nproc)

composer-require-checker:
composer-require-checker: ## Ensure we require every package used in this package directly
$(DOCKER_RUN) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=composer-require-checker.json

composer-unused:
$(DOCKER_RUN) composer unused --ansi
composer-unused: ## Ensure we don't require any package we don't use in this package directly
$(DOCKER_RUN) vendor/bin/composer-unused --ansi

backward-compatibility-check: ## Check code for backwards incompatible changes
$(DOCKER_RUN) vendor/bin/roave-backward-compatibility-check || true

shell: ## Provides Shell access in the expected environment ###
$(DOCKER_RUN) ash

task-list-ci: ## CI: Generate a JSON array of jobs to run, matches the commands run when running `make (|all)` ###
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "###" | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c 'split("\n")| .[0:-1]'

help: ## Show this help ###
@printf "\033[33mUsage:\033[0m\n make [target]\n\n\033[33mTargets:\033[0m\n"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-32s\033[0m %s\n", $$1, $$2}' | tr -d '#'
28 changes: 17 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,12 @@
"description": "void",
"license": "MIT",
"require": {
"php": "^7.4",
"nikolaposa/version": "^4.0",
"wyrihaximus/constants": "^1.5"
"php": "^8.2",
"nikolaposa/version": "^4.1",
"wyrihaximus/constants": "^1.6"
},
"require-dev": {
"wyrihaximus/test-utilities": "^3.0"
},
"config": {
"platform": {
"php": "7.4.7"
},
"preferred-install": "dist",
"sort-packages": true
"wyrihaximus/test-utilities": "^5.2.1"
},
"autoload": {
"psr-4": {
Expand All @@ -27,6 +20,19 @@
"WyriHaximus\\Tests\\Github\\Actions\\NextSemVers\\": "tests/"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"infection/extension-installer": true,
"ergebnis/composer-normalize": true,
"icanhazstring/composer-unused": true
},
"platform": {
"php": "8.2.13"
},
"preferred-install": "dist",
"sort-packages": true
},
"scripts": {
"post-install-cmd": [
"composer normalize || true"
Expand Down
Loading

0 comments on commit db7a5de

Please sign in to comment.