fix caching x2 #362
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- "**" | |
env: | |
REGISTRY: "quay.io" | |
IMAGE_BASE_NAME: "quay.io/travelping/fpp-vpp" | |
IMAGE_EXPIRES_AFTER: 7d | |
jobs: | |
build: | |
runs-on: | |
- ubuntu-22.04 | |
strategy: | |
matrix: | |
build_type: [debug, release] | |
env: | |
QUAY_USER_ID: ${{ secrets.QUAY_USER_ID }} | |
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
driver-opts: | | |
image=moby/buildkit:latest | |
- name: Prepare repo | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "dummy user" | |
hack/update-vpp.sh | |
- name: Get image tags | |
id: tags | |
run: | | |
. vpp.spec | |
VPP_VERSION=$(vpp/build-root/scripts/version | sed 's/~.*//') | |
GIT_SHA=$(git rev-parse HEAD | cut -c1-9) | |
BASE_TAG="${VPP_VERSION}-${GIT_SHA}" | |
echo "base_tag=${BASE_TAG}" >> $GITHUB_OUTPUT | |
echo "dev_tag=${BASE_TAG}_dev_${{ matrix.build_type }}" >> $GITHUB_OUTPUT | |
echo "final_tag=${BASE_TAG}_${{ matrix.build_type }}" >> $GITHUB_OUTPUT | |
echo "vpp_release=${VPP_RELEASE}" >> $GITHUB_OUTPUT | |
echo "vpp_commit=${VPP_COMMIT}" >> $GITHUB_OUTPUT | |
- name: Login to quay.io | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.QUAY_USER_ID }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Build base artifacts | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: false | |
target: artifacts | |
outputs: type=local,dest=/tmp/_out | |
build-args: | | |
BUILD_TYPE=${{ matrix.build_type }} | |
cache-from: | | |
type=gha | |
type=gha,scope=ccache | |
cache-to: | | |
type=gha,mode=max | |
type=gha,mode=max,scope=ccache | |
- name: Build dev image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
target: dev-stage | |
tags: ${{ env.IMAGE_BASE_NAME }}:${{ steps.tags.outputs.dev_tag }} | |
build-args: | | |
BUILD_TYPE=${{ matrix.build_type }} | |
labels: | | |
vpp.release=${{ steps.tags.outputs.vpp_release }} | |
vpp.commit=${{ steps.tags.outputs.vpp_commit }} | |
quay.expires-after=${{ env.IMAGE_EXPIRES_AFTER }} | |
cache-from: | | |
type=gha | |
type=gha,scope=ccache | |
cache-to: | | |
type=gha,mode=max | |
type=gha,mode=max,scope=ccache | |
- name: Build final image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
target: final-stage | |
tags: ${{ env.IMAGE_BASE_NAME }}:${{ steps.tags.outputs.final_tag }} | |
build-args: | | |
BUILD_TYPE=${{ matrix.build_type }} | |
labels: | | |
vpp.release=${{ steps.tags.outputs.vpp_release }} | |
vpp.commit=${{ steps.tags.outputs.vpp_commit }} | |
quay.expires-after=${{ env.IMAGE_EXPIRES_AFTER }} | |
cache-from: | | |
type=gha | |
type=gha,scope=ccache | |
- name: Save image names | |
run: | | |
echo "${{ env.IMAGE_BASE_NAME }}:${{ steps.tags.outputs.dev_tag }}" > "image-dev-${{ matrix.build_type }}.txt" | |
echo "${{ env.IMAGE_BASE_NAME }}:${{ steps.tags.outputs.final_tag }}" > "image-${{ matrix.build_type }}.txt" | |
- name: Upload debs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debs-${{ matrix.build_type }} | |
path: /tmp/_out/* | |
- name: Upload image.txt | |
uses: actions/upload-artifact@v4 | |
with: | |
name: image-${{ matrix.build_type }} | |
path: image-${{ matrix.build_type }}.txt | |
- name: Upload image.txt for the dev image | |
uses: actions/upload-artifact@v4 | |
with: | |
name: image-dev-${{ matrix.build_type }} | |
path: image-dev-${{ matrix.build_type }}.txt | |
# dummy job for release.yaml to wait on | |
conclude: | |
runs-on: | |
- ubuntu-22.04 | |
needs: | |
- build | |
steps: | |
- name: Dummy step | |
run: echo ok |