Open
Description
Background
Currently, our GitHub Actions workflows reinstall dependencies on every run, which increases build times and consumes unnecessary GitHub Actions minutes.
Proposed Solution
Implement dependency caching for our workflows to speed up CI/CD pipeline execution times.
Specific Recommendations
1. PHP Composer Caching
For workflows like php-unit-tests.yaml
and php-code-quality.yaml
, add Composer dependency caching:
- name: Cache Composer packages
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
2. Maven Dependency Caching
For Java components using Maven:
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
3. npm Dependency Caching
For Node.js components:
- name: Cache Node.js dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
Benefits
- Faster workflow execution (potentially 30-50% faster)
- Reduced GitHub Actions usage (saving computing resources)
- More consistent builds with deterministic dependencies