Skip to content

Commit

Permalink
ci: add caching to workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
greatislander committed Oct 5, 2023
1 parent 914c52c commit 20d257d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,44 @@ jobs:
laravel: [9]

name: Integration tests - PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create test database
run: |
sudo systemctl start mysql.service
mysqladmin create laravel --user="root" --password="root"
- name: Create project
run: |
composer create-project --prefer-dist laravel/laravel:^${{ matrix.laravel }} tests/integration --no-interaction
- name: Determine Hearth version
run: |
echo "hearth_version=${{ github.head_ref }}" >> $GITHUB_ENV
if: github.event_name == 'pull_request'

- name: Determine Hearth version
run: |
echo "hearth_version=main" >> $GITHUB_ENV
if: github.event_name != 'pull_request'

- name: Configure Composer repository
run: |
cd tests/integration
composer config repositories.head vcs https://github.com/${{ github.event.pull_request.head.repo.full_name }}
if: github.event_name == 'pull_request'

- name: Install Hearth
run: |
cd tests/integration
composer require fluid-project/hearth:dev-${{ env.hearth_version }} --no-interaction
php artisan hearth:install --two-factor --no-interaction
echo 'MAIL_FROM_ADDRESS=from@example.com' >> .env
npm install
- name: Run tests
env:
DB_PASSWORD: root
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint-analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Cache Composer packages
uses: actions/cache@v3
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Composer packages
uses: actions/cache@v3
with:
path: vendor
key: php-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1

coverage: none
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Run Pint
run: composer format

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Composer packages
uses: actions/cache@v3
with:
path: vendor
key: php-${{ hashFiles('**/composer.lock') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down

0 comments on commit 20d257d

Please sign in to comment.