Skip to content

Commit

Permalink
Cache Docker images in CI (GalaChain#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzikowski authored Oct 15, 2024
1 parent a55ecf9 commit 42dad28
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ github.ref_name }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
Expand Down
41 changes: 37 additions & 4 deletions .github/workflows/test-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,38 @@ jobs:
- name: Test
run: npm run test

ensure-docker-cache:
name: Ensure Docker cache
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ github.ref_name }}
- name: Prefetch Fabric Docker layers
run: |
cd chain-cli/network
curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/fablo.sh -o ./fablo && chmod +x ./fablo
./fablo generate fablo-config-default.json
docker compose -f fablo-target/fabric-docker/docker-compose.yaml pull
template-ci:
name: Chaincode template CI
runs-on: ubuntu-latest
needs: [ci]
needs: [ci, ensure-docker-cache]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ github.ref_name }}
- name: Install local CLI
run: .github/scripts/install-local-cli.sh
- name: Create test project
Expand All @@ -58,7 +79,7 @@ jobs:
template-e2e:
name: Chaincode template E2E (watch mode)
runs-on: ubuntu-latest
needs: [ci]
needs: [ci, ensure-docker-cache]
env:
GALA_CLIENT_DEV_MODE: "true"
steps:
Expand All @@ -81,6 +102,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ github.ref_name }}
- name: Install local CLI
run: .github/scripts/install-local-cli.sh
- name: Create test project
Expand Down Expand Up @@ -109,7 +134,7 @@ jobs:
template-e2e-rest:
name: Chaincode template E2E (REST API)
runs-on: ubuntu-latest
needs: [ci]
needs: [ci, ensure-docker-cache]
env:
GALA_CLIENT_DEV_MODE: "false"
CURATORORG_OPS_API_URL: "http://localhost:8801"
Expand All @@ -133,6 +158,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ github.ref_name }}
- name: Install local CLI
run: .github/scripts/install-local-cli.sh
- name: Create test project
Expand All @@ -150,7 +179,7 @@ jobs:

template-image-check:
name: Chaincode template image check
needs: [ci]
needs: [ci, ensure-docker-cache]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -159,6 +188,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ github.ref_name }}
- name: Install local CLI
run: .github/scripts/install-local-cli.sh
- name: Create test project
Expand Down

0 comments on commit 42dad28

Please sign in to comment.