Skip to content

Commit ff63e98

Browse files
authored
feat(ci): update ci config to use workflow from feryardiant/actions (#108)
2 parents e03b2af + 96be3e8 commit ff63e98

File tree

3 files changed

+21
-107
lines changed

3 files changed

+21
-107
lines changed

.github/workflows/configure.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,4 @@ on:
88
jobs:
99
publish:
1010
name: Publish Release
11-
runs-on: ubuntu-latest
12-
13-
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v4
16-
17-
- name: Read Changelog file
18-
run: npx @feryardiant/read-changelog > PUBLISH.md
19-
20-
- name: Publish
21-
uses: softprops/action-gh-release@v2
22-
env:
23-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24-
with:
25-
body_path: PUBLISH.md
26-
generate_release_notes: true
11+
uses: feryardiant/actions/.github/workflows/release.yml@main

.github/workflows/test.yml

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,17 @@ on:
88
push:
99
branches: [main]
1010

11-
env:
12-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
13-
CC_TEST_REPORTER_URL: ${{ vars.CC_TEST_REPORTER_URL }}
14-
1511
jobs:
16-
configs:
12+
prepare:
1713
name: Prepare
18-
uses: ./.github/workflows/configure.yml
19-
secrets: inherit
20-
21-
permissions:
22-
contents: read
23-
pull-requests: write
14+
uses: feryardiant/actions/.github/workflows/configure.yml@main
15+
secrets:
16+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
2417

2518
tests:
2619
name: Test on PHP ${{ matrix.php }} with DB ${{ matrix.db }}
2720
runs-on: ubuntu-latest
28-
needs: configs
21+
needs: prepare
2922
outputs:
3023
has-reports: ${{ steps.reports.outputs.has-reports }}
3124

@@ -67,7 +60,7 @@ jobs:
6760
strategy:
6861
fail-fast: false
6962
matrix:
70-
php: [8.1, 8.2]
63+
php: [8.1, 8.2, 8.3]
7164
db: ['mysql', 'pgsql']
7265

7366
steps:
@@ -87,7 +80,7 @@ jobs:
8780
- name: Cache Composer dependencies
8881
uses: actions/cache@v4
8982
with:
90-
path: ${{ needs.configs.outputs.composer-cache }}
83+
path: ${{ needs.prepare.outputs.composer-cache }}
9184
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
9285
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
9386

@@ -98,39 +91,29 @@ jobs:
9891
run: composer test -- --coverage
9992

10093
- name: Generate reports for CodeClimate
94+
if: needs.prepare.outputs.has-codeclimate == 'true'
10195
id: reports
102-
if: ${{ github.actor != 'dependabot[bot]' || needs.configs.outputs.should-reports == '1' }}
10396
env:
10497
COVERAGE_FILE: tests/reports/clover.xml
10598
CODECLIMATE_REPORT: tests/reports/codeclimate.${{ matrix.php }}.json
99+
CC_TEST_REPORTER_URL: ${{ vars.CC_TEST_REPORTER_URL }}
106100
run: |
107-
if [[ -n \"$CC_TEST_REPORTER_URL\" ]]; then
108-
curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
109-
./cc-test-reporter format-coverage -t clover -o $CODECLIMATE_REPORT $COVERAGE_FILE
110-
echo "has-reports=1" >> $GITHUB_OUTPUT
111-
fi
101+
curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
102+
./cc-test-reporter format-coverage -t clover -o $CODECLIMATE_REPORT $COVERAGE_FILE
112103
113104
- name: Upload tests reports
114105
uses: actions/upload-artifact@v4
115-
if: ${{ github.actor != 'dependabot[bot]' || needs.configs.outputs.should-reports == '1' }}
106+
if: needs.prepare.outputs.has-codeclimate == 'true'
116107
with:
117-
name: test-reports-${{ matrix.php }}-${{ matrix.db }}
108+
name: test-reports-php${{ matrix.php }}-${{ matrix.db }}
118109
path: tests/reports
119110

120111
reports:
121112
name: Report Test Coverages
122-
if: ${{ github.actor != 'dependabot[bot]' && needs.tests.outputs.has-reports == '1' }}
123-
runs-on: ubuntu-latest
124-
needs: tests
125-
126-
steps:
127-
- name: Download test reports
128-
uses: actions/download-artifact@v4
129-
with:
130-
pattern: test-reports-*
131-
merge-multiple: true
132-
133-
- name: Report to CodeClimate
134-
run: |
135-
curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
136-
./cc-test-reporter sum-coverage -o - codeclimate.*.json | ./cc-test-reporter upload-coverage --input -
113+
needs: [prepare, tests]
114+
if: needs.prepare.outputs.should-reports == '1'
115+
uses: feryardiant/actions/.github/workflows/report.yml@main
116+
secrets:
117+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
118+
with:
119+
has-codeclimate: ${{ needs.prepare.outputs.has-codeclimate == 'true' }}

0 commit comments

Comments
 (0)