From ed31fe5171dc724a30d2aefb20f661c264b0094a Mon Sep 17 00:00:00 2001 From: Konrad Michalik Date: Mon, 13 Oct 2025 11:42:29 +0200 Subject: [PATCH] build: refactor workflows to use reusable GitHub actions for release and tests --- .github/workflows/release.yml | 24 +-------- .github/workflows/tests.yml | 99 +---------------------------------- 2 files changed, 2 insertions(+), 121 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e260808..6da4cd0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,27 +6,5 @@ on: - '*' jobs: - # Job: Create release release: - if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - outputs: - release-notes-url: ${{ steps.create-release.outputs.url }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # Check if tag is valid - - name: Check tag - run: | - if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then - exit 1 - fi - - # Create release - - name: Create release - id: create-release - uses: softprops/action-gh-release@v2 - with: - generate_release_notes: true + uses: jackd248/reusable-github-actions/.github/workflows/release.yml@main diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 54f9f86..1a1a8c2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,101 +6,4 @@ on: jobs: tests: - name: Tests (PHP ${{ matrix.php-version }} & ${{ matrix.dependencies }} dependencies) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - php-version: ["8.1", "8.2", "8.3", "8.4"] - dependencies: ["highest", "lowest"] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # Prepare environment - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - tools: composer:v2 - coverage: none - - # Install dependencies - - name: Install Composer dependencies - uses: ramsey/composer-install@v3 - with: - dependency-versions: ${{ matrix.dependencies }} - - # Run tests - - name: Run tests - run: composer test - - coverage: - name: Test coverage - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # Prepare environment - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.4 - tools: composer:v2 - coverage: pcov - - # Install dependencies - - name: Install Composer dependencies - uses: ramsey/composer-install@v3 - - # Run tests - - name: Build coverage directory - run: mkdir -p .build/coverage - - name: Run tests with coverage - run: composer test:coverage - - # Upload artifact - - name: Fix coverage path - working-directory: .build/coverage - run: sed -i 's#/home/runner/work/php-cs-fixer-config/php-cs-fixer-config#${{ github.workspace }}#g' clover.xml - - name: Upload coverage artifact - uses: actions/upload-artifact@v4 - with: - name: coverage - path: .build/coverage/clover.xml - retention-days: 7 - - coverage-report: - name: Report test coverage - runs-on: ubuntu-latest - needs: coverage - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # Download artifact - - name: Download coverage artifact - id: download - uses: actions/download-artifact@v5 - with: - name: coverage - - # CodeClimate - - name: CodeClimate report - uses: paambaati/codeclimate-action@v9.0.0 - if: env.CC_TEST_REPORTER_ID - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - with: - coverageLocations: | - ${{ steps.download.outputs.download-path }}/clover.xml:clover - - # Coveralls - - name: Coveralls report - uses: coverallsapp/github-action@v2 - with: - file: ${{ steps.download.outputs.download-path }}/clover.xml + uses: jackd248/reusable-github-actions/.github/workflows/tests-php.yml@main