From 3651837c5ce9f611674cc5695fe908b676fd6edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alda=20Vigd=C3=ADs=20Skarph=C3=A9=C3=B0insd=C3=B3ttir?= Date: Wed, 14 Feb 2024 03:43:22 +0100 Subject: [PATCH] Adding GH Actions CI --- .github/workflows/ci.yml | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 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 0000000..9a25319 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: CI +on: [push] +jobs: + build-test: + runs-on: ubuntu-latest + services: + mariadb: + image: mariadb:latest + ports: ["3306:3306"] + env: + MARIADB_USER: test + MARIADB_PASSWORD: password + MARIADB_ROOT_PASSWORD: password + options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=10 + strategy: + matrix: + php-versions: ['8.2', '8.3', '8.4'] + env: + XDEBUG_MODE: coverage + extensions: bcmath + key: cache-v1 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup cache environment + id: extcache + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php-versions }} + extensions: ${{ env.extensions }} + key: ${{ env.key }} + - name: Cache extensions + uses: actions/cache@v4 + with: + path: ${{ steps.extcache.outputs.dir }} + key: ${{ steps.extcache.outputs.key }} + restore-keys: ${{ steps.extcache.outputs.key }} + - name: "Set up PHP ${{ matrix.php-versions }}" + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: bcmath + coverage: xdebug + tools: phpcs, phpunit + - name: Install dependencies + run: composer install + - name: Figure out the PSR-4 autoload situation + run: composer dump-autoload -o --strict-psr + - name: PHPCS + run: ./vendor/bin/phpcs ./src/ + - name: PHPUnit + run: bin/install-wp-tests.sh test root password 127.0.0.1 6.4 && ./vendor/bin/phpunit --testdox --coverage-text --coverage-filter=src