From 20d257dd5b839966520f256d42f3328e79fe1243 Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Thu, 5 Oct 2023 20:17:24 -0300 Subject: [PATCH] ci: add caching to workflows --- .github/workflows/integration.yml | 11 ++--------- .github/workflows/lint-analyze.yml | 3 +++ .github/workflows/pint.yml | 10 ++++++---- .github/workflows/run-tests.yml | 6 ++++++ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 9f7dc7d5..92a125b3 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -17,43 +17,37 @@ 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 @@ -61,7 +55,6 @@ jobs: 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 diff --git a/.github/workflows/lint-analyze.yml b/.github/workflows/lint-analyze.yml index f3de394d..e51338b3 100644 --- a/.github/workflows/lint-analyze.yml +++ b/.github/workflows/lint-analyze.yml @@ -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 diff --git a/.github/workflows/pint.yml b/.github/workflows/pint.yml index 2404273b..38e9c50c 100644 --- a/.github/workflows/pint.yml +++ b/.github/workflows/pint.yml @@ -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: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index bf51e530..799be198 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -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: