From a9250a950e7199c5747b7bdc4943c21b26d4bcaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20H=C3=B6gberg?= Date: Wed, 22 Oct 2025 20:16:39 +0200 Subject: [PATCH 1/3] Add GitHib actions workflow for PHPUnit --- .github/workflows/tests.yml | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..4d3d9af --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,40 @@ +name: tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + phpunit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + tools: composer:v2 + coverage: none + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer test From 93b18f0c4a69aa9b7269b9a217709a8a41f47051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20H=C3=B6gberg?= Date: Wed, 22 Oct 2025 20:20:52 +0200 Subject: [PATCH 2/3] matrix with php version 8.3 and 8.4 --- .github/workflows/tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4d3d9af..8aef169 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,13 +12,16 @@ permissions: jobs: phpunit: runs-on: ubuntu-latest + strategy: + matrix: + php: [ '8.3', '8.4' ] steps: - uses: actions/checkout@v5 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.4' + php-version: ${{ matrix.php }} tools: composer:v2 coverage: none From df9355a1d9c569bd917ef66b72730e1d48cf2667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20H=C3=B6gberg?= Date: Wed, 22 Oct 2025 20:29:53 +0200 Subject: [PATCH 3/3] matrix to test composer dependencies --- .github/workflows/tests.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8aef169..10533c4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,6 +15,7 @@ jobs: strategy: matrix: php: [ '8.3', '8.4' ] + dependency-version: ['prefer-lowest', 'prefer-stable'] steps: - uses: actions/checkout@v5 @@ -33,11 +34,11 @@ jobs: uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- + key: ${{ runner.os }}-composer-${{ matrix.dependency-version }}-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer-${{ matrix.dependency-version }}- - name: Install dependencies - run: composer install --prefer-dist --no-progress + run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction - name: Run test suite run: composer test