Skip to content

Commit

Permalink
removed Travis CI config + added Github Actions + dependabot config
Browse files Browse the repository at this point in the history
fixed installer tests (changed composer.json branch name from dev-master to dev-main)
updated Devcontainer and Dockerfile
  • Loading branch information
jakoch committed Jun 25, 2024
1 parent 4ba2bc9 commit a525bf7
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 135 deletions.
67 changes: 21 additions & 46 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
47 changes: 21 additions & 26 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
36 changes: 24 additions & 12 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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'
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 9 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

7 changes: 7 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/example-extra-version/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"jakoch/phantomjs-installer": "dev-master"
"jakoch/phantomjs-installer": "dev-main"
},
"config": {
"bin-dir": "bin"
Expand Down
2 changes: 1 addition & 1 deletion tests/example-latest-version/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"jakoch/phantomjs-installer": "dev-master"
"jakoch/phantomjs-installer": "dev-main"
},
"config": {
"bin-dir": "bin"
Expand Down

0 comments on commit a525bf7

Please sign in to comment.