Skip to content

Commit 1ea4515

Browse files
committed
using cache instead of export
1 parent de25ecb commit 1ea4515

File tree

4 files changed

+46
-21
lines changed

4 files changed

+46
-21
lines changed

.github/workflows/collect-test-data.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,17 @@ jobs:
2727
restore-keys: |
2828
test-data-
2929
30-
- name: Get test data if not cached
30+
- name: Get and process test data
3131
if: steps.test-data-cache.outputs.cache-hit != 'true'
32+
id: get-test-data
33+
run: make get-test-data
34+
35+
- name: Calculate test data hash
36+
id: test-data-hash
3237
run: |
33-
make get-test-data
38+
# Create a hash of all the test data files
39+
find test/test_data -type f -exec sha256sum {} \; | sort | sha256sum | cut -d' ' -f1 > test_data_hash.txt
40+
echo "hash=$(cat test_data_hash.txt)" >> $GITHUB_OUTPUT
3441
3542
- name: Verify test data
3643
run: |

.github/workflows/docker-build-local.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,54 @@ env:
1515
jobs:
1616
build:
1717
runs-on: ubuntu-latest
18-
outputs:
19-
images: ${{ steps.save-images.outputs.images }}
2018
steps:
2119
- uses: actions/checkout@v4
2220

2321
- name: Set repository name
2422
id: repo
2523
run: echo "REPO_NAME=$(basename $GITHUB_WORKSPACE)" >> $GITHUB_ENV
2624

25+
- name: Cache Docker images
26+
uses: actions/cache@v4
27+
id: docker-cache
28+
with:
29+
path: |
30+
mongo.tar
31+
api.tar
32+
handler.tar
33+
ui.tar
34+
key: docker-local-images-${{ github.sha }}
35+
restore-keys: |
36+
docker-local-images-
37+
2738
- name: Pull required images
39+
if: steps.docker-cache.outputs.cache-hit != 'true'
2840
run: docker compose -f ${{ env.COMPOSE_FILE }} pull
2941

3042
- name: Build services
43+
if: steps.docker-cache.outputs.cache-hit != 'true'
3144
run: docker compose -f ${{ env.COMPOSE_FILE }} build
3245

3346
- name: Save images
34-
id: save-images
47+
if: steps.docker-cache.outputs.cache-hit != 'true'
3548
run: |
3649
# Save images to tar files
3750
docker save mongo > mongo.tar
3851
docker save ${REGISTRY_PREFIX}/${REPO_NAME}-api:latest > api.tar
3952
docker save ${REGISTRY_PREFIX}/${REPO_NAME}-handler:latest > handler.tar
4053
docker save ${REGISTRY_PREFIX}/${REPO_NAME}-ui:latest > ui.tar
41-
42-
# Upload as artifacts
43-
echo "images=mongo.tar,api.tar,handler.tar,ui.tar" >> $GITHUB_OUTPUT
44-
45-
- name: Upload images
46-
uses: actions/upload-artifact@v4
54+
55+
- name: Upload Docker images cache
56+
if: steps.docker-cache.outputs.cache-hit != 'true'
57+
uses: actions/cache@v4
4758
with:
48-
name: docker-images-local
4959
path: |
5060
mongo.tar
5161
api.tar
5262
handler.tar
5363
ui.tar
54-
retention-days: 1
64+
key: docker-images-${{ github.sha }}
5565

5666
- name: Clean up
67+
if: always()
5768
run: docker system prune -f

.github/workflows/test-upload-local.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- completed
88

99
jobs:
10-
test:
10+
Test-Local-Uploads:
1111
runs-on: ubuntu-latest
1212
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1313

@@ -35,16 +35,23 @@ jobs:
3535
- name: Get test data if not cached
3636
if: steps.test-data-cache.outputs.cache-hit != 'true'
3737
run: |
38-
cd test
39-
make gettestdata
38+
make get-test-data
4039
41-
- name: Download images
42-
uses: actions/download-artifact@v4
40+
- name: Cache Docker images
41+
uses: actions/cache@v4
42+
id: docker-cache
4343
with:
44-
name: docker-images-local
45-
path: .
44+
path: |
45+
mongo.tar
46+
api.tar
47+
handler.tar
48+
ui.tar
49+
key: docker-local-images-${{ github.event.workflow_run.head_sha }}
50+
restore-keys: |
51+
docker-local-images-
4652
4753
- name: Load images
54+
if: steps.docker-cache.outputs.cache-hit == 'true'
4855
run: |
4956
docker load < mongo.tar
5057
docker load < api.tar

test/cleantestdata

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ rm -rf .git/modules/test/test_data/dcm_qa_uih
1111
rm -rf .git/modules/test/test_data/dcm_qa_nih
1212
rm -rf .git/modules/test/test_data/petdicoms
1313
rm -rf test/test_data/mixed_dicoms
14-
rm -rf test/test_data
14+
rm -rf test/test_data

0 commit comments

Comments
 (0)