From ebdea79420971f6f63f3a1f7e0439b416fab15ee Mon Sep 17 00:00:00 2001 From: Flavio Heleno Date: Fri, 29 Oct 2021 16:30:10 -0300 Subject: [PATCH] Replace TravisCI with GitHub Actions --- .github/workflows/phpunit.yml | 70 +++++++++++++++++++++++++++++++++++ .travis.yml | 45 ---------------------- 2 files changed, 70 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/phpunit.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 0000000..75b576a --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,70 @@ +name: PHPUnit + +on: + push: + branches-ignore: + - 'analysis-**' + +jobs: + phpunit: + name: PHP ${{ matrix.php }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: + - '7.2' + - '7.3' + - '7.4' + - '8.0' + - '8.1' + cmd: ['composer test'] + coverage: [false] + include: + - php: '7.2' + flags: '--prefer-stable --prefer-lowest' + coverage: true + cmd: 'composer test-ci' + - php: '7.2' + flags: '--prefer-stable --prefer-lowest' + + steps: + - name: Clone repository + uses: actions/checkout@v2.3.5 + + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@2.15.0 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + coverage: pcov + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer packages + uses: actions/cache@v2.1.6 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-php-${{ matrix.php }}- + + - name: Install dependencies + run: composer update ${{ matrix.flags }} --prefer-source --no-interaction --ignore-platform-reqs + + - name: Run test suite + run: | + vendor/bin/http_test_server > /dev/null 2>&1 & + cd ./tests/server/ssl && ./generate.sh && pwd && ls -la && cd ../../../ + ${{ matrix.cmd }} + + - name: Upload coverage data + if: matrix.coverage == true + run: | + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index deadd3c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: php - -sudo: required - -cache: - directories: - - $HOME/.composer/cache - -php: - - 7.2 - - 7.3 - - 7.4 - -env: - global: - - TEST_COMMAND="composer test" - -branches: - except: - - /^analysis-.*$/ - -matrix: - fast_finish: true - include: - - php: 7.2 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" - - php: 7.2 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" - -before_install: - - travis_retry composer self-update - -install: - - travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction --ignore-platform-reqs - -before_script: - - vendor/bin/http_test_server > /dev/null 2>&1 & - -script: - - cd ./tests/server/ssl && ./generate.sh && pwd && ls -la && cd ../../../ - - $TEST_COMMAND - -after_success: - - if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi - - if [[ "$COVERAGE" = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi