Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): Update CI configs #46

Merged
merged 4 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Exclude unused files
# see: https://redd.it/2jzp6k
.editorconfig export-ignore
.env.example export-ignore
.gitattributes export-ignore
.github export-ignore
.gitignore export-ignore
Expand Down
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.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Desktop.ini
.env.*
.env
.php-version
.tool-versions
/*.session.sql
coveralls-upload.json
dist
node_modules
Expand Down
14 changes: 11 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@
"email": "[email protected]"
}
],
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/creasico"
}
],
"support": {
"source": "https://github.com/creasico/laravel-dusk-browserstack"
"source": "https://github.com/creasico/laravel-dusk-browserstack",
"forum": "https://github.com/orgs/creasico/discussions",
"issues": "https://github.com/creasico/laravel-dusk-browserstack/issues"
},
"scripts": {
"fix": [
Expand All @@ -36,12 +44,12 @@
},
"require": {
"php": "^8.1",
"laravel/dusk": "^7.0",
"orchestra/testbench": "^8.5"
"laravel/dusk": "^7.0"
},
"require-dev": {
"inertiajs/inertia-laravel": "^0.6.9",
"laravel/pint": "^1.1",
"orchestra/testbench": "^8.5",
"nunomaduro/collision": "^7.4"
},
"config": {
Expand Down
Loading
Loading