Skip to content

Commit

Permalink
chore(ci): update ci config to follow latest changes in `creasico/lar…
Browse files Browse the repository at this point in the history
…avel-package`

Signed-off-by: Fery Wardiyanto <[email protected]>
  • Loading branch information
feryardiant committed Feb 6, 2024
1 parent 5eb20ca commit 2dc2c6d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 71 deletions.
12 changes: 8 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
timezone: "Asia/Jakarta"

- package-ecosystem: composer
directory: "/"
schedule:
interval: monthly
timezone: "Asia/Jakarta"
open-pull-requests-limit: 5
versioning-strategy: increase-if-necessary
versioning-strategy: lockfile-only
groups:
dependencies:
dependency-type: "production"
Expand All @@ -21,8 +26,7 @@ updates:
schedule:
interval: monthly
timezone: "Asia/Jakarta"
open-pull-requests-limit: 5
versioning-strategy: increase-if-necessary
versioning-strategy: lockfile-only
groups:
dependencies:
patterns: ['*']
36 changes: 12 additions & 24 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
integration:
- '.github/workflows/*.yml'
- 'tests/Browser/**.php'

docs:
- '.env.example'
- '**.md'
- changed-files:
- any-glob-to-any-file: ['.env.example', '.env.*.example', '**.md']

deployment:
- '.github/workflows/deploy.yml'
- 'scripts/deploy.php'
- 'scripts/deploy/**'
enhancement:
- changed-files:
- any-glob-to-any-file: '**'

api:
- 'src/**.php'
- 'routes/*.php'
integration:
- changed-files:
- any-glob-to-any-file:
- '.github/workflows/*.yml'
- 'tests/**.php'

localization:
- 'resources/lang/**'

'ui/ux':
- 'resources/views/**'

'db: schema':
- 'src/Models/**.php'
- 'database/migrations/**.php'

enhancement:
- '**'
- changed-files:
- any-glob-to-any-file: 'resources/lang/**'
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Read Changelog file
run: npx @feryardiant/read-changelog > PUBLISH.md
Expand Down
51 changes: 30 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,21 @@ env:
CC_TEST_REPORTER_URL: ${{ vars.CC_TEST_REPORTER_URL }}

jobs:
configs:
name: Configure
uses: creasico/laravel-package/.github/workflows/configure.yml@main
secrets: inherit

permissions:
contents: read
pull-requests: write

tests:
name: Test on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
needs: configs
outputs:
has-reports: ${{ steps.reports.outputs.has-reports }}

strategy:
fail-fast: false
Expand All @@ -26,7 +38,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
Expand All @@ -38,54 +50,51 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ needs.configs.outputs.composer-cache }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-

- name: Install dependencies
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
command: composer update --prefer-dist --no-interaction --no-progress
run: composer update --prefer-dist --no-interaction --no-progress

- name: Run tests
run: composer test -- --coverage

- name: Generate reports for CodeClimate
if: github.actor != 'dependabot[bot]'
if: ${{ github.actor != 'dependabot[bot]' || needs.configs.outputs.should-reports == '1' }}
id: reports
env:
COVERAGE_FILE: tests/reports/clover.xml
CODECLIMATE_REPORT: ${{ github.workspace }}/tests/reports/codeclimate.${{ matrix.php }}.json
run: |
curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
./cc-test-reporter format-coverage -t clover -o $CODECLIMATE_REPORT $COVERAGE_FILE
if [[ -n \"$CC_TEST_REPORTER_URL\" ]]; then
curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
./cc-test-reporter format-coverage -t clover -o $CODECLIMATE_REPORT $COVERAGE_FILE
echo "has-reports=1" >> $GITHUB_OUTPUT
fi
- name: Upload tests reports
uses: actions/upload-artifact@v3
if: github.actor != 'dependabot[bot]'
uses: actions/upload-artifact@v4
if: ${{ github.actor != 'dependabot[bot]' || needs.configs.outputs.should-reports == '1' }}
with:
name: test-reports
name: test-reports-${{ matrix.php }}
path: tests/reports

reports:
name: Report Test Coverages
if: github.actor != 'dependabot[bot]'
if: ${{ github.actor != 'dependabot[bot]' || needs.tests.outputs.has-reports == '1' }}
runs-on: ubuntu-latest
needs: tests

steps:
- name: Download test reports
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: test-reports
pattern: test-reports-*
merge-multiple: true

- name: Report to CodeClimate
run: |
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/triage.yml

This file was deleted.

0 comments on commit 2dc2c6d

Please sign in to comment.