Skip to content

Commit

Permalink
Build riscv64 from aosp-main
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Jun 13, 2024
1 parent 9b3d137 commit d9436a7
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Download GSI
- name: Download Image
run: |
curl -fsSLo ${{ matrix.type }}.zip ${{ matrix.link }}
- name: Mount GSI
- name: Mount Image
run: |
unzip ${{ matrix.type }}.zip
unzip ${{ matrix.type }}.zip system.img
mkdir sysroot
sudo mount -o loop,ro system.img sysroot
- name: List GSI Contents
- name: List Image Contents
run: |
cd sysroot
sudo find . -print0 | xargs -0 sudo ls -dl
Expand Down
130 changes: 130 additions & 0 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
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: Download Image
run: |
ID=$(curl -fsSL https://ci.android.com/builds/branches/aosp-main/status.json | yq '.targets[] | select(.name == "${{ matrix.type }}-trunk_staging-userdebug") | .last_known_good_build')
ARTIFACT_URL=$(node <<EOF
$(curl -fsSL "https://ci.android.com/builds/submitted/$ID/${{ matrix.type }}-trunk_staging-userdebug/latest/${{ matrix.type }}-img-$ID.zip" | grep 'var JSVariables = ')
console.log(JSVariables['artifactUrl'])
EOF
)
curl -fsSLo ${{ matrix.type }}.zip "$ARTIFACT_URL"
- name: Mount Image
run: |
unzip ${{ matrix.type }}.zip super.img
mkdir sysroot
sudo mount -o loop,ro super.img sysroot
- 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 }}

0 comments on commit d9436a7

Please sign in to comment.