Skip to content

Commit 9826946

Browse files
authored
feat(ci): update config to use workflow from projek-xyz (#75)
2 parents 2d12e21 + daf0fe7 commit 9826946

File tree

2 files changed

+24
-54
lines changed

2 files changed

+24
-54
lines changed

.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: projek-xyz/actions/.github/workflows/release.yml@main

.github/workflows/test.yml

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Tests
22

33
on:
4+
schedule: # scheduled to run at 23.00 on Saturday (UTC), means 6.00 on Monday (WIB)
5+
- cron: '0 23 * * 6'
46
pull_request:
57
branches: [main]
68
push:
@@ -12,24 +14,18 @@ concurrency:
1214

1315
env:
1416
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
15-
CC_TEST_REPORTER_URL: ${{ vars.CC_TEST_REPORTER_URL }}
1617

1718
jobs:
18-
configs:
19-
name: Configure
20-
uses: creasico/laravel-package/.github/workflows/configure.yml@main
21-
secrets: inherit
22-
23-
permissions:
24-
contents: read
25-
pull-requests: write
19+
prepare:
20+
name: Prepare
21+
uses: feryardiant/actions/.github/workflows/configure.yml@main
22+
secrets:
23+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
2624

2725
tests:
2826
name: Test on PHP ${{ matrix.php }}
2927
runs-on: ubuntu-latest
30-
needs: configs
31-
outputs:
32-
has-reports: ${{ steps.reports.outputs.has-reports }}
28+
needs: prepare
3329

3430
strategy:
3531
fail-fast: false
@@ -53,7 +49,7 @@ jobs:
5349
- name: Cache Composer dependencies
5450
uses: actions/cache@v4
5551
with:
56-
path: ${{ needs.configs.outputs.composer-cache }}
52+
path: ${{ needs.prepare.outputs.composer-cache }}
5753
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
5854
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
5955

@@ -70,40 +66,29 @@ jobs:
7066
composer test -- --coverage
7167
7268
- name: Generate reports for CodeClimate
73-
if: ${{ github.actor != 'dependabot[bot]' || needs.configs.outputs.should-reports == '1' }}
69+
if: needs.prepare.outputs.has-codeclimate == 'true'
7470
id: reports
7571
env:
7672
COVERAGE_FILE: tests/reports/clover.xml
77-
CODECLIMATE_REPORT: ${{ github.workspace }}/tests/reports/codeclimate.${{ matrix.php }}.json
73+
CODECLIMATE_REPORT: tests/reports/codeclimate.${{ matrix.php }}.json
74+
CC_TEST_REPORTER_URL: ${{ vars.CC_TEST_REPORTER_URL }}
7875
run: |
79-
if [[ -n \"$CC_TEST_REPORTER_URL\" ]]; then
80-
curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
81-
./cc-test-reporter format-coverage -t clover -o $CODECLIMATE_REPORT $COVERAGE_FILE
82-
echo "has-reports=1" >> $GITHUB_OUTPUT
83-
fi
76+
curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
77+
./cc-test-reporter format-coverage -t clover -o $CODECLIMATE_REPORT $COVERAGE_FILE
8478
8579
- name: Upload tests reports
8680
uses: actions/upload-artifact@v4
87-
if: ${{ github.actor != 'dependabot[bot]' || needs.configs.outputs.should-reports == '1' }}
81+
if: needs.prepare.outputs.has-codeclimate == 'true'
8882
with:
8983
name: test-reports-${{ matrix.php }}
9084
path: tests/reports
9185

9286
reports:
93-
name: Report Test Coverages
94-
if: ${{ github.actor != 'dependabot[bot]' && needs.tests.outputs.has-reports == '1' }}
95-
runs-on: ubuntu-latest
96-
needs: tests
97-
98-
steps:
99-
- name: Download test reports
100-
uses: actions/download-artifact@v4
101-
with:
102-
pattern: test-reports-*
103-
merge-multiple: true
104-
105-
- name: Report to CodeClimate
106-
run: |
107-
curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
108-
./cc-test-reporter sum-coverage -o - codeclimate.*.json | ./cc-test-reporter upload-coverage --input -
109-
87+
name: Reports
88+
needs: [prepare, tests]
89+
if: needs.prepare.outputs.should-reports == '1'
90+
uses: feryardiant/actions/.github/workflows/report.yml@main
91+
secrets:
92+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
93+
with:
94+
has-codeclimate: ${{ needs.prepare.outputs.has-codeclimate == 'true' }}

0 commit comments

Comments
 (0)