Skip to content

Test uber cache

Test uber cache #275

Workflow file for this run

name: Build, Run and Test Docker Image
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
actions: read
jobs:
pre-commit:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
with:
auto-commit: "true"
build-cache-check:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/cache@v4
id: cache
with:
path: path/to/dependencies
key: docker-${{ runner.os }}-${{ hashFiles('docker-bake.hcl','**/Dockerfile','**/artifacts.json','**/entrypoint.sh') }}
lookup-only: true
build-test:
runs-on: ubuntu-latest
needs: build-cache-check
if: '! needs.build-cache-check.outputs.cache-hit'
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup nexus authentication
run: |
echo "machine nexus.alfresco.com" >> ~/.netrc
echo "login ${{ secrets.NEXUS_USERNAME }}" >> ~/.netrc
echo "password ${{ secrets.NEXUS_PASSWORD }}" >> ~/.netrc
- name: Fetch artifacts from nexus
run: ./scripts/fetch-artifact.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Login to Quay.io
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Collect Workflow Telemetry
uses: catchpoint/workflow-telemetry-action@v2
with:
comment_on_pr: false
- name: Bake Docker images
uses: docker/bake-action@a4d7f0b5b91c14a296d792d4ec53a9db17f02e67 # v5.5.0
- name: Show all built images
run: docker images
- name: Docker save all baked images whose name include `alfresco`
run: |
docker save -o /tmp/alfresco-docker-images.tar $(docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco)
- name: Save docker archive
id: cache-save
uses: actions/cache/save@v4
with:
path: /tmp/alfresco-docker-images.tar
key: docker-${{ runner.os }}-${{ hashFiles('docker-bake.hcl','**/Dockerfile','**/artifacts.json','**/entrypoint.sh') }}
compose-test:
name: compose-test ${{ matrix.docker-compose-file }}
needs: build-test
runs-on: ubuntu-latest
strategy:
matrix:
docker-compose-file: [docker-compose.yml, docker-compose-components.yml]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: /tmp/alfresco-docker-images.tar
key: docker-${{ runner.os }}-${{ hashFiles('docker-bake.hcl','**/Dockerfile','**/artifacts.json','**/entrypoint.sh') }}
- name: Load Docker images
run: |
ls -1 /tmp/*.tar | xargs --no-run-if-empty -L 1 docker load -i
docker image ls -a
- name: Verify docker-compose
uses: Alfresco/alfresco-build-tools/.github/actions/dbp-charts/[email protected]
timeout-minutes: 10
with:
compose_pull: false
compose_file_path: docker-compose/${{ matrix.docker-compose-file }}
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_password: ${{ secrets.QUAY_PASSWORD }}
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]