From 2b6d06f3ca792683dfb5151a031bec30b7d0ec0b Mon Sep 17 00:00:00 2001 From: Peter Elmered Date: Fri, 5 Jan 2024 11:29:43 +0100 Subject: [PATCH] Add dependabot config and GitHub action for running tests --- .github/dependabot.yml | 21 ++++++++++++++ .github/workflows/run-tests.yml | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..fe87b3f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" + target-branch: "main" + # Allow up to 5 open pull requests for composer dependencies + open-pull-requests-limit: 5 + commit-message: + prefix: "Composer" + include: "scope" + labels: + - "composer" + - "dependencies" + diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..456443e --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,50 @@ + +name: run-tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, windows-latest] + php: [8.2, 8.3, 8.4] + dependencies: [lowest, highest] + stability: [prefer-lowest, prefer-stable] + + name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: intl + coverage: pcov + - name: Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Install dependencies + run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction + - name: Execute tests + run: vendor/bin/phpunit --coverage-clover=coverage.xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: tests + name: codecov-umbrella + #yml: ./codecov.yml + fail_ci_if_error: true +