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

Improved action workflow #1241

Merged
merged 3 commits into from
Nov 24, 2024
Merged
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
42 changes: 9 additions & 33 deletions .github/workflows/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,22 @@ jobs:
id: npm-cache-dir-path
run: echo "dir=$(npm get cache)" >> $GITHUB_OUTPUT

- name: Calculate package-lock.json hash
id: npm-lock-hash
run: |
echo "hash=$(md5sum package-lock.json)" >> $GITHUB_OUTPUT

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

- name: Calculate composer.lock hash
id: composer-lock-hash
run: |
echo "hash=$(md5sum composer.lock)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ steps.npm-lock-hash.outputs.hash }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-

- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-no-dev-${{ steps.composer-lock-hash.outputs.hash }}
key: ${{ runner.os }}-composer-no-dev-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-no-dev-

- run: cp .env.example .env
Expand All @@ -75,15 +65,10 @@ jobs:
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Calculate composer.lock hash
id: composer-lock-hash
run: |
echo "hash=$(md5sum composer.lock)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.composer-lock-hash.outputs.hash }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- run: cp .env.example .env
Expand All @@ -104,20 +89,16 @@ jobs:
steps:
- uses: actions/checkout@v4

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

- name: Calculate composer.lock hash
id: composer-lock-hash
run: |
echo "hash=$(md5sum composer.lock)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
- name: Cache vendor directory
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.composer-lock-hash.outputs.hash }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- run: cp .env.example .env
Expand All @@ -144,15 +125,10 @@ jobs:
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Calculate tools/composer.lock hash
id: composer-lock-hash
run: |
echo "hash=$(md5sum tools/composer.lock)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-tools-${{ steps.composer-lock-hash.outputs.hash }}
key: ${{ runner.os }}-composer-tools-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-tools-

- name: Composer tools install
Expand Down
Loading