Skip to content

Commit

Permalink
* fix not saving action/cache after failed jobs @ actions/{be,fe}/a…
Browse files Browse the repository at this point in the history
…ction.yml

@ .github
  • Loading branch information
n0099 committed Feb 12, 2024
1 parent 33424ba commit 568be54
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
12 changes: 10 additions & 2 deletions .github/actions/be/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,27 @@ runs:
ini-values: opcache.enable_cli=1
env: # https://github.com/shivammathur/setup-php/blob/6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d/README.md#force-update-setup
update: 'true'
# https://github.com/shivammathur/setup-php/blob/6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d/README.md#cache-composer-dependencies
# https://github.com/shivammathur/setup-php/blob/6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d/README.md#problem-matchers
- run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
working-directory: be
shell: bash
# https://github.com/shivammathur/setup-php/blob/6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d/README.md#cache-composer-dependencies
# https://github.com/actions/cache/blob/a2ed59d39b352305bdd2f628719a53b2cc4f9613/examples.md#php---composer
- id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
working-directory: be
shell: bash
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('be/composer.lock') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- run: composer install --prefer-dist
working-directory: be
shell: bash
# https://github.com/actions/runner/issues/1478
# https://github.com/actions/setup-node/issues/410#issuecomment-1939482965
- uses: actions/cache/save@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
19 changes: 16 additions & 3 deletions .github/actions/c#/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,25 @@ runs:
- uses: actions/setup-dotnet@v4
with: # https://github.com/actions/setup-dotnet/tree/v4
dotnet-version: 7
cache: true
# https://github.com/actions/setup-node/issues/624#issuecomment-1328681525
cache-dependency-path: ${{ github.workspace }}/c#/*/packages.lock.json
# cache: true
# # https://github.com/actions/setup-node/issues/624#issuecomment-1328681525
# cache-dependency-path: ${{ github.workspace }}/c#/*/packages.lock.json
# in favor of https://github.com/actions/cache/blob/a2ed59d39b352305bdd2f628719a53b2cc4f9613/examples.md#c---nuget
# to allow saving cache even jobs failed
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
- run: dotnet new globaljson --sdk-version 7.0.405
working-directory: c#
shell: bash
- run: dotnet restore
working-directory: c#
shell: bash
# https://github.com/actions/runner/issues/1478
# https://github.com/actions/setup-node/issues/410#issuecomment-1939482965
- uses: actions/cache/save@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
26 changes: 21 additions & 5 deletions .github/actions/fe/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,26 @@ runs:
- uses: actions/setup-node@v4
with: # https://github.com/actions/setup-node/tree/v4
node-version: lts/*
cache: yarn
# https://github.com/actions/setup-node/issues/624#issuecomment-1328681525
cache-dependency-path: ${{ github.workspace }}/fe/yarn.lock
- name: install
run: yarn install --immutable
# cache: yarn
# # https://github.com/actions/setup-node/issues/624#issuecomment-1328681525
# cache-dependency-path: ${{ github.workspace }}/fe/yarn.lock
# in favor of https://github.com/actions/cache/blob/a2ed59d39b352305bdd2f628719a53b2cc4f9613/examples.md#node---yarn-2
# to allow saving cache even jobs failed
- id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
working-directory: fe
shell: bash
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- run: yarn install --immutable
working-directory: fe
shell: bash
# https://github.com/actions/runner/issues/1478
# https://github.com/actions/setup-node/issues/410#issuecomment-1939482965
- uses: actions/cache/save@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
2 changes: 1 addition & 1 deletion .github/workflows/fe.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: fe
on:
push:
paths: [fe/**]
#paths: [fe/**]
defaults:
run:
working-directory: fe
Expand Down

0 comments on commit 568be54

Please sign in to comment.