diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 46eaef6..0c28d8b 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -30,8 +30,21 @@ jobs: with: php-version: '8.2' + - name: Get composer cache directory + id: composer-cache + shell: bash + run: | + echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" + + - name: Cache composer cache directory + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: "Validate composer.json and composer.lock" - run: "composer validate --strict" + run: composer validate --strict - name: Install dependencies with composer run: composer install --prefer-dist @@ -53,6 +66,19 @@ jobs: php-version: '8.2' tools: cs2pr + - name: Get composer cache directory + id: composer-cache + shell: bash + run: | + echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" + + - name: Cache composer cache directory + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install dependencies with composer run: composer install --prefer-dist diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 31b99a4..33683e4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,43 +28,56 @@ jobs: HTTPBIN_URI: "http://127.0.0.1:8081" steps: - - name: Checkout code - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: Setup PHP - uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4 - with: - php-version: '8.2' - extensions: mbstring + - name: Checkout code + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Setup PHP + uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4 + with: + php-version: '8.2' + extensions: mbstring - - name: Setup problem matchers for PHP - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Get composer cache directory + id: composer-cache + shell: bash + run: | + echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Cache composer cache directory + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- - - name: "Validate composer.json and composer.lock" - run: "composer validate --strict" + - name: "Validate composer.json and composer.lock" + run: composer validate --strict - - name: Install dependencies with composer - run: composer install --prefer-dist + - name: Install dependencies with composer + run: composer install --prefer-dist - - name: Fetch & setup gotify plugin - run: bash .ci/scripts/setup-plugin.sh + - name: Fetch & setup gotify plugin + run: bash .ci/scripts/setup-plugin.sh - - name: Start gotify & httpbin docker containers - run: docker compose up -d + - name: Start gotify & httpbin docker containers + run: docker compose up -d - - name: Test connections to docker containers - run: bash .ci/scripts/connections.sh + - name: Test connections to docker containers + run: bash .ci/scripts/connections.sh - - name: Run phpunit - run: ./vendor/bin/phpunit --coverage-clover=coverage.xml --testsuite=default,plugin-endpoint + - name: Run phpunit + run: ./vendor/bin/phpunit --coverage-clover=coverage.xml --testsuite=default,plugin-endpoint - - name: Stop gotify & httpbin docker docker containers - run: docker compose down + - name: Stop gotify & httpbin docker docker containers + run: docker compose down - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0 - with: - token: ${{ secrets.CODECOV_TOKEN }} + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0 + with: + token: ${{ secrets.CODECOV_TOKEN }}