From 9f64ad7a829deab99a6612f36d93f04b450d5273 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Mon, 24 Jan 2022 14:38:38 -0800 Subject: [PATCH 1/3] Replace Travis CI with GitHub Actions --- .github/workflows/test.yml | 32 ++++++++++++++++++++++++++++++++ .travis.yml | 14 -------------- composer.json | 4 ++++ 3 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..bec58d4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Tests and linting + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run linting + run: composer run-script lint + + - name: Run tests + run: composer run-script test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9d069d9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -dist: bionic - -language: php - -php: - - '7.4' - - '8.0snapshot' - -before_script: - - composer update --no-interaction --no-progress - -script: - - php vendor/bin/phpspec run -f pretty - - php vendor/bin/phpcs --standard=PSR12 src/ diff --git a/composer.json b/composer.json index 7411d74..7c9f44c 100644 --- a/composer.json +++ b/composer.json @@ -35,5 +35,9 @@ "branch-alias": { "dev-master": "2.x-dev" } + }, + "scripts": { + "lint": "vendor/bin/phpcs --standard=PSR12 src/", + "test": "vendor/bin/phpspec run -f pretty" } } From 00cec8e012ed2c6f1c123bd963ad4c3e8d91b7af Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Mon, 24 Jan 2022 14:45:32 -0800 Subject: [PATCH 2/3] Use PHP 8.0 in CI --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bec58d4..8bc8633 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,11 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set PHP version + uses: shivammathur/setup-php@v2 + with: + php-version: 8.0 + - name: Validate composer.json and composer.lock run: composer validate --strict From 6e09b6fd9b8810d1ea757df97e78d6213ae26d2a Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Mon, 24 Jan 2022 14:47:51 -0800 Subject: [PATCH 3/3] Update badge in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1421f70..75592fb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Packagist API -[![Build Status](https://travis-ci.org/KnpLabs/packagist-api.svg)](https://travis-ci.org/KnpLabs/packagist-api) [![Latest Stable Version](https://poser.pugx.org/KnpLabs/packagist-api/v/stable.png)](https://packagist.org/packages/KnpLabs/packagist-api) [![Total Downloads](https://poser.pugx.org/KnpLabs/packagist-api/downloads.png)](https://packagist.org/packages/KnpLabs/packagist-api) +![Build status](https://github.com/KnpLabs/packagist-api/actions/workflows/test.yml/badge.svg) [![Latest Stable Version](https://poser.pugx.org/KnpLabs/packagist-api/v/stable.png)](https://packagist.org/packages/KnpLabs/packagist-api) [![Total Downloads](https://poser.pugx.org/KnpLabs/packagist-api/downloads.png)](https://packagist.org/packages/KnpLabs/packagist-api) Simple object oriented wrapper for Packagist API.