1
0
mirror of https://github.com/danog/file.git synced 2024-11-30 04:19:39 +01:00

Migrate to GitHub actions

This commit is contained in:
Niklas Keller 2021-06-21 21:08:24 +02:00
parent f406950680
commit bcc397e482
9 changed files with 103 additions and 119 deletions

88
.github/workflows/ci.yml vendored Normal file
View File

@ -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

View File

@ -2,11 +2,10 @@
$config = new Amp\CodeStyle\Config(); $config = new Amp\CodeStyle\Config();
$config->getFinder() $config->getFinder()
->in(__DIR__ . '/examples')
->in(__DIR__ . '/src') ->in(__DIR__ . '/src')
->in(__DIR__ . '/test'); ->in(__DIR__ . '/test');
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__; $config->setCacheFile(__DIR__ . '/.php_cs.cache');
$config->setCacheFile($cacheDir . '/.php_cs.cache');
return $config; return $config;

View File

@ -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

View File

@ -1,6 +1,6 @@
The MIT License (MIT) 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,8 +1,4 @@
# file # file ![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)
[![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)
`amphp/file` allows non-blocking access to the filesystem for [Amp](https://github.com/amphp/amp). `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 ## 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) - [`ext-eio`](https://pecl.php.net/package/eio)
- [php-uv](https://github.com/bwoebi/php-uv) - [`ext-uv`](https://github.com/amphp/ext-uv)
- [parallel](https://github.com/krakjoe/parallel) - [`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. `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 ## 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 ## Security

View File

@ -33,16 +33,16 @@
], ],
"require": { "require": {
"php": ">=7.1", "php": ">=7.1",
"amphp/amp": "^2.2", "amphp/amp": "^2.5.2",
"amphp/byte-stream": "^1.6.1", "amphp/byte-stream": "^1.8.1",
"amphp/parallel": "^1.2", "amphp/parallel": "^1.4",
"amphp/sync": "^1.3" "amphp/sync": "^1.4"
}, },
"require-dev": { "require-dev": {
"ext-eio": "^2", "ext-eio": "^2",
"ext-uv": "^0.3 || ^0.2", "ext-uv": "^0.3 || ^0.2",
"amphp/phpunit-util": "^1.1", "amphp/phpunit-util": "^1.1",
"phpunit/phpunit": "^8 || ^7", "phpunit/phpunit": "^9 || ^8 || ^7",
"amphp/php-cs-fixer-config": "dev-master" "amphp/php-cs-fixer-config": "dev-master"
}, },
"autoload": { "autoload": {
@ -64,7 +64,7 @@
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.x-dev" "dev-master": "2.x-dev"
} }
}, },
"scripts": { "scripts": {

View File

@ -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();')";

View File

@ -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();')"

View File

@ -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();')"