Skip to content

Update bazel cache and deploy artifacts #14

Update bazel cache and deploy artifacts

Update bazel cache and deploy artifacts #14

name: Update bazel cache and deploy artifacts
on:
push:
branches:
- main
schedule:
- cron: '0 */3 * * *'
jobs:
update-cvd-test-bazel-cache:
if: github.repository_owner == 'google'
runs-on: ubuntu-24.04
steps:
- name: Free disk space
uses: jlumbroso/[email protected]
with:
large-packages: false
swap-storage: false
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Mount bazel cache
uses: ./.github/actions/mount-bazel-cache
with:
action-name: "run-cvd-unit-tests"
cache-path: "$HOME/bazel-disk-cache"
writable: "true"
- name: Run cvd unit tests
uses: ./.github/actions/run-cvd-unit-tests
with:
cache-path: "$HOME/bazel-disk-cache"
update-bazel-cache-and-deploy-debian-package-amd64:
if: github.repository_owner == 'google'
environment: deployment
runs-on: ubuntu-22.04
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # aka v1.3.1
with:
docker-images: false
swap-storage: false
- name: checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Mount bazel cache
uses: ./.github/actions/mount-bazel-cache
with:
action-name: "build-debian-packages"
cache-path: "$HOME/bazel-disk-cache"
writable: "true"
- name: Build CF host debian packages
uses: ./.github/actions/build-debian-packages
with:
cache-path: "$HOME/bazel-disk-cache"
- name: Authentication on GCP project android-cuttlefish-artifacts
if: github.event_name == 'push'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.ARTIFACT_REGISTRY_UPLOADER }}'
- name: Deploy CF host debian packages
if: github.event_name == 'push'
uses: ./.github/actions/deploy-debian-packages
with:
path: .
update-bazel-cache-and-deploy-debian-package-arm64:
if: github.repository_owner == 'google'
environment: deployment
runs-on: ubuntu-22.04-arm
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # aka v1.3.1
with:
docker-images: false
swap-storage: false
- name: checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Mount bazel cache
uses: ./.github/actions/mount-bazel-cache
with:
action-name: "build-debian-packages"
cache-path: "$HOME/bazel-disk-cache"
writable: "true"
- name: Build CF host debian packages
uses: ./.github/actions/build-debian-packages
with:
cache-path: "$HOME/bazel-disk-cache"
- name: Authentication on GCP project android-cuttlefish-artifacts
if: github.event_name == 'push'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.ARTIFACT_REGISTRY_UPLOADER }}'
- name: Deploy CF host debian packages
if: github.event_name == 'push'
uses: ./.github/actions/deploy-debian-packages
with:
path: .
deploy-docker-image-amd64:
if: github.repository_owner == 'google' && github.event_name == 'push'
environment: deployment
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Build docker image
run: docker/image-builder.sh
- name: Authentication on GCP project android-cuttlefish-artifacts
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.ARTIFACT_REGISTRY_UPLOADER }}'
- name: Login to Artifact Registry
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # aka v3.5.0
with:
registry: us-docker.pkg.dev
username: _json_key
password: '${{ secrets.ARTIFACT_REGISTRY_UPLOADER }}'
- name: Deploy docker image
uses: ./.github/actions/deploy-docker-image
with:
arch: amd64
deploy-docker-image-arm64:
if: github.repository_owner == 'google' && github.event_name == 'push'
environment: deployment
runs-on: ubuntu-22.04-arm
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Build docker image
run: docker/image-builder.sh
- name: Authentication on GCP project android-cuttlefish-artifacts
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.ARTIFACT_REGISTRY_UPLOADER }}'
- name: Login to Artifact Registry
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # aka v3.5.0
with:
registry: us-docker.pkg.dev
username: _json_key
password: '${{ secrets.ARTIFACT_REGISTRY_UPLOADER }}'
- name: Deploy docker image
uses: ./.github/actions/deploy-docker-image
with:
arch: arm64
deploy-docker-manifest:
if: github.repository_owner == 'google' && github.event_name == 'push'
needs: [deploy-docker-image-amd64, deploy-docker-image-arm64]
environment: deployment
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Authentication on GCP project android-cuttlefish-artifacts
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.ARTIFACT_REGISTRY_UPLOADER }}'
- name: Login to Artifact Registry
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # aka v3.5.0
with:
registry: us-docker.pkg.dev
username: _json_key
password: '${{ secrets.ARTIFACT_REGISTRY_UPLOADER }}'
- name: Deploy manifests
run: |
# TODO(b/440196950): Setup condition on this step when we build
# stable/unstable versions here too.
# Stable/Unstable version tag : X.Y.Z
# Nightly version tag : gitYYYYMMDD-<Github SHA 8 digit>
DATE=$(date -u +'%Y%m%d')
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
TAG="git${DATE}-${SHORT_SHA}"
IMAGE=us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-orchestration
for MANIFEST_TAG in ${TAG} nightly; do
docker manifest create ${IMAGE}:${MANIFEST_TAG} \
--amend ${IMAGE}:${TAG}-amd64 \
--amend ${IMAGE}:${TAG}-arm64
docker manifest push ${IMAGE}:${MANIFEST_TAG}
done