diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..445ceb6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: 'Setup PHP' + uses: shivammathur/setup-php@v2 + with: + php-version: '7.3' + + - name: 'Get composer cache directory' + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: 'Cache dependencies' + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer update --prefer-dist + + - name: Code Sniffer + run: vendor/bin/phpcs --standard=psr2 src/ + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: 'Setup PHP' + uses: shivammathur/setup-php@v2 + with: + php-version: '7.3' + + - name: 'Get composer cache directory' + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: 'Cache dependencies' + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer update --prefer-dist + + - name: Run tests + run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover