mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-12 23:27:48 +00:00
Cache public assets in CI
If cached assets exist, they will be downloaded which should be quicker than building them again. Then assets:precompile will build any missing assets, skipping over cached ones. Then finally, all assets are saved to a newer version of the cache. It sounds like GitHub automatically manages cache versions based on branch and time, so new branches will inherit the master cache, rather than cache from another branch. If this works, this generic code should live in a shared module or something.
This commit is contained in:
101
.github/workflows/build.yml
vendored
101
.github/workflows/build.yml
vendored
@@ -67,6 +67,15 @@ jobs:
|
||||
run: |
|
||||
bin/rake db:create db:schema:load
|
||||
|
||||
- name: Restore cached public assets
|
||||
id: cache-public-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 864ef557d85ea8e603e086c0387d5154
|
||||
@@ -85,6 +94,15 @@ jobs:
|
||||
git show --no-patch # the commit being tested (which is often a merge due to actions/checkout@v3)
|
||||
bin/rake knapsack_pro:rspec
|
||||
|
||||
- name: Save cached public assets
|
||||
id: cache-public-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
models:
|
||||
runs-on: ubuntu-22.04
|
||||
services:
|
||||
@@ -127,6 +145,15 @@ jobs:
|
||||
run: |
|
||||
bin/rake db:create db:schema:load
|
||||
|
||||
- name: Restore cached public assets
|
||||
id: cache-public-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674
|
||||
@@ -144,6 +171,15 @@ jobs:
|
||||
run: |
|
||||
bin/rake knapsack_pro:rspec
|
||||
|
||||
- name: Save cached public assets
|
||||
id: cache-public-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
system_admin:
|
||||
runs-on: ubuntu-22.04
|
||||
services:
|
||||
@@ -193,8 +229,16 @@ jobs:
|
||||
run: |
|
||||
bin/rake db:create db:schema:load
|
||||
|
||||
- name: Run tests
|
||||
- name: Restore cached public assets
|
||||
id: cache-public-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ff2456e64c9f2aa5157eb0daf711d3c3
|
||||
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
||||
@@ -212,6 +256,15 @@ jobs:
|
||||
run: |
|
||||
bin/rake knapsack_pro:queue:rspec
|
||||
|
||||
- name: Save cached public assets
|
||||
id: cache-public-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
- name: Archive failed tests screenshots
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
@@ -270,6 +323,15 @@ jobs:
|
||||
run: |
|
||||
bin/rake db:create db:schema:load
|
||||
|
||||
- name: Restore cached public assets
|
||||
id: cache-public-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
- name: Run tests
|
||||
|
||||
env:
|
||||
@@ -348,8 +410,16 @@ jobs:
|
||||
run: |
|
||||
bin/rake db:create db:schema:load
|
||||
|
||||
- name: Run tests
|
||||
- name: Restore cached public assets
|
||||
id: cache-public-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: d6ea7ceb766404ccd016c19aa2c81b1c
|
||||
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
||||
@@ -367,6 +437,15 @@ jobs:
|
||||
run: |
|
||||
bin/rake knapsack_pro:rspec
|
||||
|
||||
- name: Save cached public assets
|
||||
id: cache-public-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
- name: Archive failed tests screenshots
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
@@ -426,6 +505,15 @@ jobs:
|
||||
run: |
|
||||
bin/rake db:create db:schema:load
|
||||
|
||||
- name: Restore cached public assets
|
||||
id: cache-public-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: e3b8800198d2d89b70c7edbdd85f8fd8
|
||||
@@ -443,6 +531,15 @@ jobs:
|
||||
run: |
|
||||
bin/rake knapsack_pro:rspec
|
||||
|
||||
- name: Save cached public assets
|
||||
id: cache-public-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
public/assets
|
||||
public/packs-test
|
||||
key: public
|
||||
|
||||
non_knapsack_jest_karma:
|
||||
runs-on: ubuntu-22.04
|
||||
services:
|
||||
|
||||
Reference in New Issue
Block a user