From bcc397e482de159034bfb4cb087d535ae5d5c0f2 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Mon, 21 Jun 2021 21:08:24 +0200 Subject: [PATCH] Migrate to GitHub actions --- .github/workflows/ci.yml | 88 ++++++++++++++++++++++++++++++++++++++++ .php_cs.dist | 5 +-- .travis.yml | 51 ----------------------- LICENSE | 2 +- README.md | 16 +++----- composer.json | 12 +++--- travis/install-eio.sh | 10 ----- travis/install-pcov.sh | 12 ------ travis/install-uv.sh | 26 ------------ 9 files changed, 103 insertions(+), 119 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml delete mode 100755 travis/install-eio.sh delete mode 100755 travis/install-pcov.sh delete mode 100755 travis/install-uv.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e24daad --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,88 @@ +name: Continuous Integration + +on: + - push + - pull_request + +jobs: + tests: + strategy: + matrix: + include: + - operating-system: 'ubuntu-latest' + php-version: '7.1' + + - operating-system: 'ubuntu-latest' + php-version: '7.2' + + - operating-system: 'ubuntu-latest' + php-version: '7.3' + + - operating-system: 'ubuntu-latest' + php-version: '7.4' + + - operating-system: 'ubuntu-latest' + php-version: '8.0' + composer-flags: '--ignore-platform-req=php' + + - operating-system: 'windows-latest' + php-version: '7.4' + job-description: 'on Windows' + + - operating-system: 'macos-latest' + php-version: '7.4' + job-description: 'on macOS' + + name: PHP ${{ matrix.php-version }} ${{ matrix.job-description }} + + runs-on: ${{ matrix.operating-system }} + + steps: + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: eio, uv + + - name: Get Composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-${{ matrix.composer-flags }} + restore-keys: | + composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}- + composer-${{ runner.os }}-${{ matrix.php-version }}- + composer-${{ runner.os }}- + composer- + + - name: Install dependencies + uses: nick-invision/retry@v2 + with: + timeout_minutes: 5 + max_attempts: 5 + retry_wait_seconds: 30 + command: | + composer update --optimize-autoloader --no-interaction --no-progress ${{ matrix.composer-flags }} + composer info -D + + - name: Run tests + env: + PHP_CS_FIXER_IGNORE_ENV: 1 + run: vendor/bin/phpunit ${{ matrix.phpunit-flags }} + + - name: Run style fixer + env: + PHP_CS_FIXER_IGNORE_ENV: 1 + run: vendor/bin/php-cs-fixer --diff --dry-run -v fix diff --git a/.php_cs.dist b/.php_cs.dist index cd06abc..63ed811 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -2,11 +2,10 @@ $config = new Amp\CodeStyle\Config(); $config->getFinder() + ->in(__DIR__ . '/examples') ->in(__DIR__ . '/src') ->in(__DIR__ . '/test'); -$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__; - -$config->setCacheFile($cacheDir . '/.php_cs.cache'); +$config->setCacheFile(__DIR__ . '/.php_cs.cache'); return $config; diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cee1596..0000000 --- a/.travis.yml +++ /dev/null @@ -1,51 +0,0 @@ -sudo: false - -language: php - -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4 - - nightly - -jobs: - allow_failures: - - php: nightly - fast_finish: true - include: - - php: 7.1 - - env: UV_VERSION=v0.2.2 - -env: - - AMP_DEBUG=true - -before_install: - - if [ "$TRAVIS_PHP_VERSION" != "7.1" ]; then - phpenv config-rm xdebug.ini || echo "No xdebug config."; - travis/install-pcov.sh; - fi - - travis/install-eio.sh - - travis/install-uv.sh $UV_VERSION - - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.2.0/php-coveralls.phar - -install: - - if [ "$TRAVIS_PHP_VERSION" = "nightly" ]; then - composer update -n --ignore-platform-reqs; - else - composer update -n; - fi - - composer show - -script: - - vendor/bin/phpunit --coverage-text --verbose --coverage-clover build/logs/clover.xml; - - PHP_CS_FIXER_IGNORE_ENV=1 php vendor/bin/php-cs-fixer --diff --dry-run -v fix - -after_script: - - travis_retry php php-coveralls.phar -v - -cache: - directories: - - $HOME/.composer/cache - - $HOME/.php-cs-fixer - - $HOME/.local diff --git a/LICENSE b/LICENSE index 9fb78c0..ee3de78 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015-2020 amphp +Copyright (c) 2015-2021 amphp Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index c7ad5f8..e45833f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,4 @@ -# file - -[![Build Status](https://img.shields.io/travis/amphp/file/master.svg?style=flat-square)](https://travis-ci.org/amphp/file) -[![CoverageStatus](https://img.shields.io/coveralls/amphp/file/master.svg?style=flat-square)](https://coveralls.io/github/amphp/file?branch=master) -![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square) +# file ![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square) `amphp/file` allows non-blocking access to the filesystem for [Amp](https://github.com/amphp/amp). @@ -16,17 +12,17 @@ composer require amphp/file ## Optional Extension Backends -Extensions allow to use threading in the background instead of using multiple processes. +Extensions allow using threading in the background instead of using multiple processes. - - [eio](https://pecl.php.net/package/eio) - - [php-uv](https://github.com/bwoebi/php-uv) - - [parallel](https://github.com/krakjoe/parallel) + - [`ext-eio`](https://pecl.php.net/package/eio) + - [`ext-uv`](https://github.com/amphp/ext-uv) + - [`ext-parallel`](https://github.com/krakjoe/parallel) `amphp/file` works out of the box without any PHP extensions. It uses multi-processing by default, but also comes with a blocking driver that just uses PHP's blocking functions in the current process. ## Versioning -`amphp/file` follows the [semver](http://semver.org/) semantic versioning specification like all other `amphp` packages. +`amphp/file` follows the [semver](https://semver.org/) semantic versioning specification like all other `amphp` packages. ## Security diff --git a/composer.json b/composer.json index 40eb040..1dfe97a 100644 --- a/composer.json +++ b/composer.json @@ -33,16 +33,16 @@ ], "require": { "php": ">=7.1", - "amphp/amp": "^2.2", - "amphp/byte-stream": "^1.6.1", - "amphp/parallel": "^1.2", - "amphp/sync": "^1.3" + "amphp/amp": "^2.5.2", + "amphp/byte-stream": "^1.8.1", + "amphp/parallel": "^1.4", + "amphp/sync": "^1.4" }, "require-dev": { "ext-eio": "^2", "ext-uv": "^0.3 || ^0.2", "amphp/phpunit-util": "^1.1", - "phpunit/phpunit": "^8 || ^7", + "phpunit/phpunit": "^9 || ^8 || ^7", "amphp/php-cs-fixer-config": "dev-master" }, "autoload": { @@ -64,7 +64,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "2.x-dev" } }, "scripts": { diff --git a/travis/install-eio.sh b/travis/install-eio.sh deleted file mode 100755 index b9cca77..0000000 --- a/travis/install-eio.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -git clone https://github.com/rosmanov/pecl-eio -pushd pecl-eio; -phpize; -./configure; -make; -make install; -popd; -echo "extension=eio.so" >> "$(php -r 'echo php_ini_loaded_file();')"; diff --git a/travis/install-pcov.sh b/travis/install-pcov.sh deleted file mode 100755 index 791c167..0000000 --- a/travis/install-pcov.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -e - -curl -LS https://pecl.php.net/get/pcov | tar -xz -pushd pcov-* -phpize -./configure --enable-pcov -make -make install -popd -echo "extension=pcov.so" >> "$(php -r 'echo php_ini_loaded_file();')" diff --git a/travis/install-uv.sh b/travis/install-uv.sh deleted file mode 100755 index bf13b86..0000000 --- a/travis/install-uv.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -set -e - -wget https://github.com/libuv/libuv/archive/v1.24.1.tar.gz -O /tmp/libuv.tar.gz -q & -wget https://github.com/bwoebi/php-uv/archive/${1:-master}.tar.gz -O /tmp/php-uv.tar.gz -q & -wait - -mkdir libuv && tar -xf /tmp/libuv.tar.gz -C libuv --strip-components=1 -mkdir php-uv && tar -xf /tmp/php-uv.tar.gz -C php-uv --strip-components=1 - -pushd libuv; -./autogen.sh -./configure --prefix=$(dirname `pwd`)/libuv-install -make -j4 -make install -popd - -pushd php-uv -phpize -./configure --with-uv=$(dirname `pwd`)/libuv-install -make -j4 -make install -popd - -echo "extension=uv.so" >> "$(php -r 'echo php_ini_loaded_file();')"