test #5
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: schedule | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
schedule: | |
- cron: '0 0/8 * * *' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
archive: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- type: aosp_aarch64 | |
- type: aosp_x86_64 | |
- type: aosp_cf_riscv64_phone | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: | | |
TARGET=aosp_cf_x86_64_phone | |
ID=$(curl -fsSL https://ci.android.com/builds/branches/aosp-main/status.json | yq '.targets[] | select(.name == "$TARGET-trunk_staging-userdebug") | .last_known_good_build') | |
ARTIFACT_URL=$(node <<EOF | |
$(curl -fsSL "https://ci.android.com/builds/submitted/$ID/$TARGET-trunk_staging-userdebug/latest/cvd-host_package.zip" | grep 'var JSVariables = ') | |
console.log(JSVariables['artifactUrl']) | |
EOF | |
) | |
curl -fsSLo cvd-host_package.tar.gz "$ARTIFACT_URL" | |
tar -xzf cvd-host_package.tar.gz | |
- name: Download Image | |
run: | | |
TARGET=${{ matrix.type }} | |
ID=$(curl -fsSL https://ci.android.com/builds/branches/aosp-main/status.json | yq '.targets[] | select(.name == "$TARGET-trunk_staging-userdebug") | .last_known_good_build') | |
ARTIFACT_URL=$(node <<EOF | |
$(curl -fsSL "https://ci.android.com/builds/submitted/$ID/$TARGET-trunk_staging-userdebug/latest/$TARGET-img-$ID.zip" | grep 'var JSVariables = ') | |
console.log(JSVariables['artifactUrl']) | |
EOF | |
) | |
set -x | |
curl -fsSLo $TARGET.zip "$ARTIFACT_URL" | |
- name: Mount Image | |
run: | | |
if unzip ${{ matrix.type }}.zip system.img; then | |
mkdir sysroot | |
sudo mount -o loop,ro super/system.img sysroot | |
else | |
unzip ${{ matrix.type }}.zip super.img | |
./bin/lpunpack super.img | |
mkdir sysroot | |
sudo mount -o loop,ro system_a.img sysroot | |
fi | |
- name: List Contents | |
run: | | |
cd sysroot | |
sudo find . -print0 | xargs -0 sudo ls -dl | |
- name: Archive | |
run: | | |
cd sysroot | |
sudo ../libexec/ls-files | sudo tar -cvzf ../${{ matrix.type }}.tar.gz -T- | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.type }} | |
path: ${{ matrix.type }}.tar.gz | |
if-no-files-found: error | |
compression-level: 0 | |
build: | |
needs: [archive] | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: aosp_aarch64 | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: aosp_x86_64 | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: aosp_cf_riscv64_phone | |
- name: Docker Metadata | |
id: docker-metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=edge | |
type=ref,event=branch | |
type=ref,event=pr | |
type=ref,event=tag | |
type=schedule | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ startsWith(github.ref, 'refs/tags/') }} | |
tags: ${{ steps.docker-metadata.outputs.tags }} | |
labels: ${{ steps.docker-metadata.outputs.labels }} |