diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5c1d4a7..75a94b5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,49 +1,24 @@ -FROM php:7.4-cli +FROM mcr.microsoft.com/devcontainers/php:8 -ENV DEBIAN_FRONTEND=noninteractive +# Setup system dependecies +RUN apt-get update && apt-get install -y \ + # for PhantomJS + fontconfig \ + # for PHP extension: bzip + bzip2 libbz2-dev \ + # for PHP extension: intl + libicu-dev \ + # for PHP extension: gettext + gettext -ARG USERNAME=vscode -ARG USER_UID=1000 -ARG USER_GID=$USER_UID +# Setup PHP dependencies +RUN docker-php-ext-install \ + bz2 \ + gettext \ + intl \ + pdo \ + pdo_mysql -# Configure apt and install packages -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ - && apt-get -y install git openssh-client less iproute2 procps lsb-release unzip \ - && apt-get -y install libfontconfig1 libbz2-dev libzip-dev \ - # - # Xdebug - && yes | pecl install xdebug \ - && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \ - && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \ - && echo "xdebug.remote_autostart=on" >> /usr/local/etc/php/conf.d/xdebug.ini \ - # - # Create a non-root user to use if preferred - && groupadd --gid $USER_GID $USERNAME \ - && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ - # [Optional] Add sudo support for the non-root user - && apt-get install -y sudo \ - && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ - && chmod 0440 /etc/sudoers.d/$USERNAME \ - # - # Clean up - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* \ - # - # Install Composer v1, then self-update to snapshot of v2 - && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ - && composer self-update --snapshot \ - && composer --version - -# For PhantomJS -ENV OPENSSL_CONF=/etc/ssl/ - -# Install bz2, requires libbz2-dev -RUN docker-php-ext-install bz2 - -# Install zip, requires libzip-dev zlib1g-dev -RUN docker-php-ext-configure zip -RUN docker-php-ext-install zip - -ENV DEBIAN_FRONTEND=dialog +# Update Composer +ENV COMPOSER_ALLOW_SUPERUSER=1 +RUN composer self-update \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 08f3ec3..b43d76d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,29 +1,24 @@ { - "name": "PHP 7 + Composer + phantomjs-installer", + "name": "PHP", "dockerFile": "Dockerfile", - - // Use 'settings' to set *default* container specific settings.json values on container create. - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" + // config settings you would have in ".vscode/settings.json" + "customizations": { + "vscode": { + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + // VS Code specific + "EditorConfig.EditorConfig", + // Asciidoc specific + "asciidoctor.asciidoctor-vscode", + // Markdown specific + "yzhang.markdown-all-in-one", + // PHP specific + "xdebug.php-pack" + ], + "settings": { + "terminal.integrated.defaultProfile.linux": "zsh", + } + } }, - - // Add the IDs of extensions you want installed when the container is created in the array below. - "extensions": [ - "felixfbecker.php-debug", - "felixfbecker.php-intellisense", - //"shd101wyy.markdown-preview-enhanced", - //"auchenberg.vscode-browser-preview", - //"whatwedo.twig", - //"mtxr.sqltools" - ], - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "php -v", - - // Comment out if you want to use root - "remoteUser": "vscode" - -} + "remoteUser": "root" + } diff --git a/.gitattributes b/.gitattributes index dbadfc7..a646639 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,20 +2,32 @@ # .gitattributes # -# Auto-detect text files, ensure they use LF. -* text=auto eol=lf +# Auto detect text files and perform LF normalization +* text=auto -# These files are always considered text and should use LF. -# See core.whitespace @ http://git-scm.com/docs/git-config for whitespace flags. -*.php text eol=lf whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 diff=php +# PHP files +*.php text eol=lf diff=php +*.phpt text eol=lf diff=php +*.phtml text eol=lf diff=html +*.twig text eol=lf +*.phar binary + +# Configuration +phpcs.xml text eol=lf +phpunit.xml text eol=lf +phpstan.neon text eol=lf +psalm.xml text eol=lf + +# Fix syntax highlighting on GitHub to allow comments +.devcontainer.json linguist-language=JSON-with-Comments +.vscode/*.json linguist-language=JSON-with-Comments # do not git export the following directories -build-tools/ export-ignore -tests/ export-ignore +.vscode/ export-ignore +build/ export-ignore +tests/ export-ignore # do not git export the following files -.editorconfig export-ignore -.php_cs export-ignore -.scrutinizer.yml export-ignore -.travis.yml export-ignore -phpunit.xml.dist export-ignore \ No newline at end of file +.editorconfig export-ignore +.gitattributes export-ignore +.gitignore export-ignore \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..9691e1d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + # Enable version updates for github-actions + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + # Check for updates to GitHub Actions once a month + interval: 'monthly' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7c9cfc3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: CI + +on: [workflow_dispatch, push, pull_request] + +permissions: + contents: read + +jobs: + + test: + + strategy: + fail-fast: false + matrix: + # https://www.php.net/supported-versions.php + version: ['8.1', '8.2', '8.3', '8.4'] + + # ubuntu-latest = ubuntu-22.04 (06-2024) + # /~https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md + runs-on: ubuntu-24.04 + + steps: + + - name: 🤘 Checkout + uses: actions/checkout@v4 # /~https://github.com/actions/checkout + with: + fetch-depth: 5 + + # install location of tools is /usr/local/bin/phpunit + - name: 🔽 Setup PHP + uses: shivammathur/setup-php@v2 # /~https://github.com/shivammathur/setup-php + with: + php-version: ${{matrix.version}} + extensions: dom, mbstring, tidy + ini-values: memory_limit=-1, error_reporting=-1, display_errors=On + tools: composer, phpunit + + - name: 🔽 Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: ✅ PHP lint + run: find . -path ./vendor -prune -o -type f -name '*.php' ! -name "test_with_parse_error.php" -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" ) + + - name: 🔴🟢🟢🟢 Test + run: /usr/local/bin/phpunit --configuration ./tests/phpunit.xml.dist + + - name: Update Composer + run: | + composer self-update + composer diagnose + + # This tests the installation of the installer using require "dev-main", + # along with the installation of the latest version of PhantomJS. + - name: Installer "dev-main" installs latest PhantomJS version + run: | + cd tests/example-latest-version + composer install -vvv --profile + ls -ashF bin + bin/phantomjs -v + + # This tests the installation of the installer using require "dev-main", + # along with the installation of a manually specified PhantomJS version "v2.1.1", + # as defined in the extra section of composer.json. + # + # Reminder: + # If you define version "2.0.0" in composer.json's extra section, + # it should fetch v1.9.8 via retry/auto-lowering, because 2.0.0 doesnt exist. + # + - name: Installer "dev-main" installs a manually specific PhantomJS version + run: | + cd tests/example-extra-version + composer install -vvv --profile + ls -ashF bin + bin/phantomjs -v diff --git a/.gitignore b/.gitignore index 51197ff..e31686a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,14 +7,16 @@ /.project # Composer -/composer.phar -/composer.lock +composer.phar +composer.lock /vendor -# Vagrant -.vagrant -Vagrantfile +src/PhantomInstaller/PhantomBinary.php -.idea +/tests/example-extra-version/bin +/tests/example-extra-version/vendor +/tests/example-extra-version/composer.lock -/src/PhantomInstaller/PhantomBinary.php +/tests/example-latest-version/bin +/tests/example-latest-version/vendor +/tests/example-latest-version/composer.lock diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c8d3866..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -# -# .travis.yml - configuration file for the travis continuous integration service -# -# see https://docs.travis-ci.com/user/languages/php/ for more hints -# -language: php - -# use container based infrastructure (no sudo possible) -sudo: false - -cache: - directory: - - $HOME/.composer/cache/files - -php: [7.2, 7.4] - -before_install: - - composer self-update - - composer install --no-interaction --prefer-source - -script: - - vendor/bin/phpunit --configuration ./tests/phpunit.xml.dist - # tests - # Using Composer v1 - # require "dev-master" -> v2.1.1 (hardcoded fallback) - - cd "$TRAVIS_BUILD_DIR/tests/example-latest-version" && composer install -vvv --profile - - ls -ashF bin - - bin/phantomjs -v - # Using Composer 2.0-dev snapshot - - composer self-update --snapshot - - composer --version - # require "dev-master" -> v2.1.1 (composer.json's extra section) - - cd "$TRAVIS_BUILD_DIR/tests/example-extra-version" && composer install -vvv --profile - - ls -ashF bin - - bin/phantomjs -v - # Reminder: - # if you define version "2.0.0" in composer.json's extra section, - # it should fetch v1.9.8 via retry/auto-lowering. - -# reduce commit history of git checkout -git: - depth: 5 diff --git a/Changelog.md b/Changelog.md index 0e28f47..bf43378 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,13 @@ - "It was a bright day in April, and the clocks were striking thirteen." - 1984 +## [3.0.2] - 2024-06-26 + +- fixed installer tests after branch rename dev-master -> dev-main +- removed Travis CI config +- added Github Actions + dependabot config +- updated Devcontainer and Dockerfile + ## [3.0.1] - 2021-09-03 - [Issue #51](/~https://github.com/jakoch/phantomjs-installer/issues/51): Fix TypeError thrown during install diff --git a/tests/example-extra-version/composer.json b/tests/example-extra-version/composer.json index 248fe28..02d755c 100644 --- a/tests/example-extra-version/composer.json +++ b/tests/example-extra-version/composer.json @@ -1,6 +1,6 @@ { "require": { - "jakoch/phantomjs-installer": "dev-master" + "jakoch/phantomjs-installer": "dev-main" }, "config": { "bin-dir": "bin" diff --git a/tests/example-latest-version/composer.json b/tests/example-latest-version/composer.json index c10ee64..84b2870 100644 --- a/tests/example-latest-version/composer.json +++ b/tests/example-latest-version/composer.json @@ -1,6 +1,6 @@ { "require": { - "jakoch/phantomjs-installer": "dev-master" + "jakoch/phantomjs-installer": "dev-main" }, "config": { "bin-dir": "bin"