diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8bc8633 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Tests and linting + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + 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 + + - 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/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. 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" } }