Skip to content

Commit

Permalink
Optimize script result caching
Browse files Browse the repository at this point in the history
  • Loading branch information
almirsarajcic committed Dec 6, 2024
1 parent cafb0d3 commit 1e4e4de
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 13 deletions.
11 changes: 10 additions & 1 deletion .github/github_workflows.ex
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ defmodule GithubWorkflows do
checkout_step(),
[
name: "Restore script result cache",
uses: "actions/cache@v3",
uses: "actions/cache/restore@v4",
id: "result_cache",
with: [
key:
Expand Down Expand Up @@ -480,6 +480,15 @@ defmodule GithubWorkflows do
retry_wait_seconds: 5,
timeout_seconds: 1
]
],
[
name: "Save script result cache",
uses: "actions/cache/save@v4",
with: [
key:
"${{ runner.os }}-#{shell}-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}",
path: "priv/script.sh"
]
]
]
]
Expand Down
42 changes: 36 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand All @@ -324,6 +324,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
test_macos_bash:
name: Test macOS script with bash shell
runs-on: macos-latest
Expand All @@ -334,7 +339,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand Down Expand Up @@ -363,6 +368,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
test_linux_fish:
name: Test Linux script with fish shell
runs-on: ubuntu-latest
Expand All @@ -373,7 +383,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand Down Expand Up @@ -402,6 +412,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
test_macos_fish:
name: Test macOS script with fish shell
runs-on: macos-latest
Expand All @@ -412,7 +427,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand Down Expand Up @@ -444,6 +459,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
test_linux_zsh:
name: Test Linux script with zsh shell
runs-on: ubuntu-latest
Expand All @@ -454,7 +474,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand Down Expand Up @@ -483,6 +503,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
test_macos_zsh:
name: Test macOS script with zsh shell
runs-on: macos-latest
Expand All @@ -493,7 +518,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand Down Expand Up @@ -525,6 +550,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
deploy_production_app:
name: Deploy production app
needs:
Expand Down
42 changes: 36 additions & 6 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand All @@ -328,6 +328,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
test_macos_bash:
name: Test macOS script with bash shell
runs-on: macos-latest
Expand All @@ -338,7 +343,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand Down Expand Up @@ -367,6 +372,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
test_linux_fish:
name: Test Linux script with fish shell
runs-on: ubuntu-latest
Expand All @@ -377,7 +387,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand Down Expand Up @@ -406,6 +416,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
test_macos_fish:
name: Test macOS script with fish shell
runs-on: macos-latest
Expand All @@ -416,7 +431,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand Down Expand Up @@ -448,6 +463,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
test_linux_zsh:
name: Test Linux script with zsh shell
runs-on: ubuntu-latest
Expand All @@ -458,7 +478,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand Down Expand Up @@ -487,6 +507,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
test_macos_zsh:
name: Test macOS script with zsh shell
runs-on: macos-latest
Expand All @@ -497,7 +522,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Restore script result cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: result_cache
with:
key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
Expand Down Expand Up @@ -529,6 +554,11 @@ jobs:
max_attempts: 7
retry_wait_seconds: 5
timeout_seconds: 1
- name: Save script result cache
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/script.sh
deploy_preview_app:
name: Deploy preview app
needs:
Expand Down

0 comments on commit 1e4e4de

Please sign in to comment.