From ce243259342033bff8a2cc5718d7d6c4928554dd Mon Sep 17 00:00:00 2001 From: NanoSector Date: Mon, 28 Dec 2020 18:12:30 +0100 Subject: [PATCH 1/3] Add GitHub Actions workflow --- .github/workflows/ci.yml | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..11a9049d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: PHP Composer + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + # Based on https://github.com/nanasess/setup-php + tests: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: [ ubuntu-latest, windows-latest ] + php: [ '7.3', '7.4', '8.0' ] + name: PHP ${{ matrix.php }} tests + steps: + - uses: actions/checkout@v2 + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Validate composer.json and composer.lock + run: composer validate + + - 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 + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Run tests + run: composer run-script tests From d6d86449b2e4c8cb9f5279c4776b760fc412e12a Mon Sep 17 00:00:00 2001 From: NanoSector Date: Mon, 28 Dec 2020 18:17:51 +0100 Subject: [PATCH 2/3] Specify operating system in action --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11a9049d..aa3302dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: matrix: operating-system: [ ubuntu-latest, windows-latest ] php: [ '7.3', '7.4', '8.0' ] - name: PHP ${{ matrix.php }} tests + name: PHP ${{ matrix.php }} tests (${{ matrix.operating-system }}) steps: - uses: actions/checkout@v2 - name: Setup PHP From 888350c3410618c801de91198860eac02619c411 Mon Sep 17 00:00:00 2001 From: NanoSector Date: Mon, 28 Dec 2020 18:17:59 +0100 Subject: [PATCH 3/3] Add tests script --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 98d9c878..662b254a 100644 --- a/composer.json +++ b/composer.json @@ -37,5 +37,8 @@ "platform": { "php": "7.3.0" } + }, + "scripts": { + "tests": "php vendor/bin/phpunit" } }