Skip to content

Commit

Permalink
Merge pull request #152 from phalcon/#151-php8.0-refactor
Browse files Browse the repository at this point in the history
#151 - Shift to PHP8.0
  • Loading branch information
Jeckerson authored Apr 15, 2024
2 parents 7dfa9d7 + 7c1b2db commit f5791f7
Show file tree
Hide file tree
Showing 54 changed files with 1,469 additions and 2,331 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/8.0/Dockerfile → .docker/8.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LABEL vendor="Phalcon" \
maintainer="Phalcon Team <team@phalcon.io>" \
description="Phalcon Migrations working environment"

ENV PHALCON_VERSION="5.0.1" \
ENV PHALCON_VERSION="5.5.0" \
PHP_VERSION="8.0"

ADD ./extra.ini /usr/local/etc/php/conf.d/
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/8.1/Dockerfile → .docker/8.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LABEL vendor="Phalcon" \
maintainer="Phalcon Team <team@phalcon.io>" \
description="Phalcon Migrations working environment"

ENV PHALCON_VERSION="5.0.1" \
ENV PHALCON_VERSION="5.5.0" \
PHP_VERSION="8.1"

ADD ./extra.ini /usr/local/etc/php/conf.d/
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions docker/7.4/Dockerfile → .docker/8.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM composer:latest as composer
FROM php:7.4-fpm
FROM php:8.2-fpm

LABEL vendor="Phalcon" \
maintainer="Phalcon Team <team@phalcon.io>" \
description="Phalcon Migrations working environment"

ENV PHALCON_VERSION="5.0.1" \
PHP_VERSION="7.4"
ENV PHALCON_VERSION="5.5.0" \
PHP_VERSION="8.2"

ADD ./extra.ini /usr/local/etc/php/conf.d/

Expand Down
File renamed without changes.
75 changes: 75 additions & 0 deletions .docker/8.3/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~" # `cd` is probably faster to type though
alias -- -="cd -"

# Shortcuts
alias g="git"
alias h="history"

# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # OS X `ls`
colorflag="-G"
fi

# List all files colorized in long format
# shellcheck disable=SC2139
alias l="ls -lF ${colorflag}"

# List all files colorized in long format, including dot files
# shellcheck disable=SC2139
alias la="ls -laF ${colorflag}"

# List only directories
# shellcheck disable=SC2139
alias lsd="ls -lF ${colorflag} | grep --color=never '^d'"

# See: https://superuser.com/a/656746/280737
alias ll='LC_ALL="C.UTF-8" ls -alF'

# Always use color output for `ls`
# shellcheck disable=SC2139
alias ls="command ls ${colorflag}"
export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'

# Always enable colored `grep` output
alias grep='grep --color=auto '

# Enable aliases to be sudo’ed
alias sudo='sudo '

# Get week number
alias week='date +%V'

# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'

# Canonical hex dump; some systems have this symlinked
command -v hd > /dev/null || alias hd="hexdump -C"

# vhosts
alias hosts='sudo nano /etc/hosts'

# copy working directory
alias cwd='pwd | tr -d "\r\n" | xclip -selection clipboard'

# copy file interactive
alias cp='cp -i'

# move file interactive
alias mv='mv -i'

# untar
alias untar='tar xvf'

# Zephir related
alias untar='tar xvf'

PATH=$PATH:./vendor/bin
60 changes: 60 additions & 0 deletions .docker/8.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM composer:latest as composer
FROM php:8.3-fpm

LABEL vendor="Phalcon" \
maintainer="Phalcon Team <team@phalcon.io>" \
description="Phalcon Migrations working environment"

ENV PHALCON_VERSION="5.5.0" \
PHP_VERSION="8.3"

ADD ./extra.ini /usr/local/etc/php/conf.d/

# Update
RUN apt update -y && \
apt install -y \
apt-utils \
gettext \
git \
libpq-dev \
libzip-dev \
nano \
sudo \
wget \
zip

# PECL Packages
RUN pecl install phalcon-${PHALCON_VERSION} \
xdebug

# Install PHP extensions
RUN docker-php-ext-install \
gettext \
pdo_mysql \
pdo_pgsql \
zip

# Install PHP extensions
RUN docker-php-ext-enable \
opcache \
phalcon \
xdebug

# Cleanup
RUN apt autoremove -y \
&& apt autoclean -y \
&& apt clean -y \
&& rm -rf /tmp/* /var/tmp/* \
&& find /var/cache/apt/archives /var/lib/apt/lists /var/cache \
-not -name lock \
-type f \
-delete \
&& find /var/log -type f | while read f; do echo -n '' > ${f}; done

# Composer
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
# Bash script with helper aliases
COPY ./.bashrc /root/.bashrc
COPY ./.bashrc /home/phalcon/.bashrc

CMD ["php-fpm"]
8 changes: 8 additions & 0 deletions .docker/8.3/extra.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error_reporting=E_ALL
display_errors="On"
display_startup_errors="On"
log_errors="On"
error_log=/tmp/php_errors.log
memory_limit=512M
apc.enable_cli="On"
session.save_path="/tmp"
3 changes: 1 addition & 2 deletions .github/workflows/release-phar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ jobs:
name: Compile and upload Phar
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Compile phalcon-migrations.phar
run: |
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ jobs:
runs-on: ubuntu-latest
env:
extensions: mbstring, intl, json, phalcon-${{ matrix.phalcon-versions }}, mysql, pgsql
key: cache-v2.2~17.05.2020
key: cache-v4.0~13.04.2024

services:
mysql:
image: mysql:5.7
image: mysql:8.0
env:
MYSQL_DATABASE: phalcon-migrations
MYSQL_ROOT_PASSWORD: root
Expand All @@ -21,15 +22,17 @@ jobs:
postgres:
image: postgres:10.8
ports:
- 5432/tcp
- "5432:5432"
options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 2

strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1']
phalcon-versions: ['5.0.1', '5.0.2', '5.0.3', '5.0.4', '5.0.5']
php-versions: ['8.0', '8.1', '8.2', '8.3']
phalcon-versions: ['5.5.0', '5.6.0', '5.6.1', '5.6.2']
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
Expand Down Expand Up @@ -63,8 +66,7 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --prefer-dist --no-suggest
- run: composer install --prefer-dist --no-suggest

- name: Copy .env file
run: cp tests/.env.example tests/.env
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ jobs:
name: PSR-12 Code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Validate composer.json and composer.lock
run: composer validate
- run: composer validate

- name: Get Composer Cache Directory
id: composer-cache
Expand All @@ -31,16 +30,16 @@ jobs:
name: Static Code with PHP ${{ matrix.php-versions }}
runs-on: ubuntu-latest
env:
extensions: mbstring, intl, json, phalcon-5.0.1
key: cache-v2.2~17.05.2020
extensions: mbstring, intl, json, phalcon-5.5.0
key: cache-v4.0~13.04.2024
needs: validate-code-style
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['8.0', '8.1', '8.2', '8.3']

steps:
- name: Checkout the code
uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Setup cache environment
id: cache-env
Expand Down
23 changes: 11 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "phalcon/migrations",
"description": "Run and Generate DB Migrations with Phalcon Framework",
"version": "4.0.0",
"keywords": [
"framework",
"phalcon",
Expand All @@ -26,24 +27,23 @@
"forum": "https://forum.phalcon.io"
},
"require": {
"php": ">=7.4",
"ext-phalcon": ">=5.0.1",
"phalcon/cli-options-parser": "^1.2",
"nette/php-generator": "^3.5"
"php": ">=8.0",
"ext-phalcon": ">=5.5",
"phalcon/cli-options-parser": "^2.0",
"nette/php-generator": "^4.0"
},
"require-dev": {
"ext-pdo": "*",
"phalcon/ide-stubs": "^5.0.1",
"phalcon/ide-stubs": "^5.5",
"squizlabs/php_codesniffer": "^3.5",
"fakerphp/faker": "^1.15",
"humbug/box": "^3.8",
"codeception/codeception": "^4.1",
"codeception/module-asserts": "^1.0.0",
"codeception/module-cli": "^1.0",
"codeception/module-phpbrowser": "^1.0.0",
"codeception/module-db": "^1.0",
"codeception/codeception": "^5.1",
"codeception/module-asserts": "^3.0.0",
"codeception/module-cli": "^2.0",
"codeception/module-db": "^3.0",
"vimeo/psalm": "^4.6",
"vlucas/phpdotenv": "^4.1",
"vlucas/phpdotenv": "^5.6",
"phpstan/phpstan": "^1.8"
},
"autoload": {
Expand Down Expand Up @@ -75,7 +75,6 @@
"codeception.yml",
"phpcs.xml.dist",
"phpstan.neon.dist",
"phpunit.xml.dist",
"psalm.xml.dist"
]
},
Expand Down
Loading

0 comments on commit f5791f7

Please sign in to comment.