-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial GitHub Actions (Android and Linux)
b/355035766
- Loading branch information
1 parent
589c9bb
commit c180d36
Showing
21 changed files
with
1,037 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Build Cobalt | ||
description: Builds Cobalt targets | ||
inputs: | ||
targets: | ||
description: "List of ninja targets for Chrobalt build." | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get depot tools | ||
run: git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | ||
shell: bash | ||
- name: Add directory to PATH | ||
run: echo "$GITHUB_WORKSPACE/depot_tools" >> $GITHUB_PATH | ||
shell: bash | ||
- name: Generate gclient file | ||
run: gclient config --name=src https://github.com/${{ github.repository }} | ||
shell: bash | ||
- name: Set target OS for Android | ||
if: startsWith(${{matrix.platform}}, 'android') | ||
run: | | ||
echo "target_os=['android']" >> .gclient | ||
gclient validate | ||
shell: bash | ||
- name: Gclient sync | ||
run: gclient sync -v --shallow --no-history -r ${{ github.sha }} | ||
shell: bash | ||
- name: sccache check | ||
run: sccache -s | ||
shell: bash | ||
- name: gn gen | ||
run: | | ||
cd src | ||
chrobalt/build/gn.py -p ${{ matrix.platform }} -C ${{ matrix.config }} --no-check | ||
shell: bash | ||
- name: gn dump args | ||
run: | | ||
cd src | ||
gn args --list --short --overrides-only out/${{ matrix.platform }}_${{ matrix.config }} | ||
shell: bash | ||
- name: ninja build | ||
env: | ||
TARGETS: ${{ inputs.targets }} | ||
run: | | ||
set -x | ||
cd src | ||
ninja -C out/${{ matrix.platform }}_${{ matrix.config }} $(echo "${TARGETS}" | tr -d '"') | ||
shell: bash | ||
- name: sccache check | ||
run: sccache -s | ||
shell: bash | ||
- name: find apks | ||
run: find src/out -name \*.apk -print | ||
shell: bash | ||
- name: Archive Android APKs | ||
if: startsWith(${{matrix.platform}}, 'android') | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.platform }} APKs | ||
path: | | ||
src/out/${{ matrix.platform }}_qa/apks/*.apk | ||
src/out/${{ matrix.platform }}_qa/*_apk/*.apk |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Docker Image Build | ||
description: Builds Cobalt build docker images. | ||
inputs: | ||
docker_service: | ||
description: "Docker compose service." | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout files | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 | ||
- name: Set env vars | ||
run: | | ||
set -x | ||
tag=${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref_name }} | ||
tag=${tag//\//__} | ||
tag="${tag%.1[+,-]}" | ||
echo "FLOATING_TAG=${tag}" >> $GITHUB_ENV | ||
full_git_sha=${{ github.sha }} | ||
short_git_sha="${full_git_sha::7}" | ||
echo "GIT_SHA=${short_git_sha}" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Set Docker Tag | ||
id: set-docker-tag-github | ||
if: ${{ (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository) }} | ||
run: | | ||
set -x | ||
echo "DOCKER_TAG=ghcr.io/${{ github.repository }}/${{ inputs.docker_service }}:${GIT_SHA}" >> $GITHUB_ENV | ||
echo "DOCKER_FLOATING_TAG=ghcr.io/${{ github.repository }}/${{ inputs.docker_service }}:${FLOATING_TAG}" >> $GITHUB_ENV | ||
shell: bash | ||
# Handle Google Artifact Registry used for pull requests off forked repos. | ||
- name: Set up Cloud SDK | ||
if: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name != github.repository) }} | ||
uses: isarkis/setup-gcloud@40dce7857b354839efac498d3632050f568090b6 # v1.1.1 | ||
- name: Login to GAR and set tag | ||
if: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name != github.repository) }} | ||
run: | | ||
# Need to login to GAR to be able to push images created by fork based PR workflows. | ||
PROJECT_NAME=$(gcloud config get-value project) | ||
METADATA="http://metadata.google.internal./computeMetadata/v1" | ||
SVC_ACCT="${METADATA}/instance/service-accounts/default" | ||
ACCESS_TOKEN=$(curl -H 'Metadata-Flavor: Google' ${SVC_ACCT}/token | cut -d'"' -f 4) | ||
printf ${ACCESS_TOKEN} | docker login -u oauth2accesstoken --password-stdin https://us-central1-docker.pkg.dev | ||
full_git_sha=${{ github.sha }} | ||
echo "DOCKER_TAG=us-central1-docker.pkg.dev/${PROJECT_NAME}/github/${{ inputs.docker_service }}:${GIT_SHA}" >> $GITHUB_ENV | ||
echo "DOCKER_FLOATING_TAG=us-central1-docker.pkg.dev/${PROJECT_NAME}/github/${{ inputs.docker_service }}:${FLOATING_TAG}" >> $GITHUB_ENV | ||
shell: bash | ||
# Proceed with docker pull, build, tag, and push. | ||
- name: Docker Pull | ||
run: | | ||
docker pull "${DOCKER_TAG}" || true | ||
docker pull "${DOCKER_FLOATING_TAG}" || true | ||
shell: bash | ||
- name: Docker Build | ||
run: docker compose build ${{inputs.docker_service}} | ||
shell: bash | ||
- name: Docker Tag | ||
run: | | ||
docker tag ghcr.io/${{ github.repository }}/${{ inputs.docker_service }}:latest ${DOCKER_TAG} | ||
docker tag ghcr.io/${{ github.repository }}/${{ inputs.docker_service }}:latest ${DOCKER_FLOATING_TAG} | ||
shell: bash | ||
- name: Docker Push | ||
run: | | ||
docker push ${DOCKER_TAG} | ||
docker push ${DOCKER_FLOATING_TAG} | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: pre-commit | ||
description: Runs pre-commit | ||
inputs: | ||
base_ref: | ||
description: "Ref to run from" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- run: python -m pip install pre-commit | ||
shell: bash | ||
- run: python -m pip freeze --local | ||
shell: bash | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
- run: pre-commit run --show-diff-on-failure --color=always --all-files | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
{ | ||
"docker_service": "linux", | ||
"platforms": [ | ||
"android-arm" | ||
], | ||
"targets": [ | ||
"base_unittests", | ||
"sql_unittests", | ||
"net_unittests", | ||
"url_unittests", | ||
"ipc_tests", | ||
"mojo_unittests", | ||
"gpu_unittests", | ||
"gin_unittests", | ||
"blink_unittests", | ||
"content_shell", | ||
"system_webview_apk", | ||
"system_webview_shell_apk" | ||
], | ||
"includes": [ | ||
{ | ||
"name":"arm", | ||
"platform":"android-arm" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"docker_service": "linux", | ||
"platforms": [ | ||
"android-arm64" | ||
], | ||
"targets": [ | ||
"base_unittests", | ||
"sql_unittests", | ||
"net_unittests", | ||
"url_unittests", | ||
"ipc_tests", | ||
"mojo_unittests", | ||
"gpu_unittests", | ||
"gin_unittests", | ||
"blink_unittests", | ||
"content_shell", | ||
"system_webview_apk", | ||
"system_webview_shell_apk" | ||
], | ||
"includes": [ | ||
{ | ||
"name":"arm64", | ||
"platform":"android-arm64" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"docker_service": "linux", | ||
"platforms": [ | ||
"android-x86" | ||
], | ||
"targets": [ | ||
"base_unittests", | ||
"sql_unittests", | ||
"net_unittests", | ||
"url_unittests", | ||
"ipc_tests", | ||
"mojo_unittests", | ||
"gpu_unittests", | ||
"gin_unittests", | ||
"blink_unittests", | ||
"content_shell", | ||
"system_webview_apk", | ||
"system_webview_shell_apk" | ||
], | ||
"includes": [ | ||
{ | ||
"name":"x86", | ||
"platform":"android-x86" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"docker_service": "linux", | ||
"platforms": [ | ||
"linux-x64x11" | ||
], | ||
"targets": [ | ||
"base_unittests", | ||
"sql_unittests", | ||
"net_unittests", | ||
"url_unittests", | ||
"ipc_tests", | ||
"mojo_unittests", | ||
"gpu_unittests", | ||
"gin_unittests", | ||
"blink_unittests", | ||
"content_shell" | ||
], | ||
"includes": [ | ||
{ | ||
"name":"x64", | ||
"platform":"linux-x64x11" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: android | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, labeled] | ||
branches: | ||
- main | ||
- experimental/* | ||
push: | ||
branches: | ||
- main | ||
- experimental/* | ||
workflow_dispatch: | ||
inputs: | ||
nightly: | ||
description: 'Nightly workflow.' | ||
required: true | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
android-arm64: | ||
uses: ./.github/workflows/main.yaml | ||
permissions: | ||
packages: write | ||
pull-requests: write | ||
with: | ||
platform: android-arm64 | ||
nightly: ${{ github.event.inputs.nightly }} | ||
android-arm: | ||
uses: ./.github/workflows/main.yaml | ||
permissions: | ||
packages: write | ||
pull-requests: write | ||
with: | ||
platform: android-arm | ||
nightly: ${{ github.event.inputs.nightly }} | ||
android-x86: | ||
uses: ./.github/workflows/main.yaml | ||
permissions: | ||
packages: write | ||
pull-requests: write | ||
with: | ||
platform: android-x86 | ||
nightly: ${{ github.event.inputs.nightly }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: linux | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, labeled] | ||
branches: | ||
- main | ||
- experimental/* | ||
push: | ||
branches: | ||
- main | ||
- experimental/* | ||
workflow_dispatch: | ||
inputs: | ||
nightly: | ||
description: 'Nightly workflow.' | ||
required: true | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
linux-x64: | ||
uses: ./.github/workflows/main.yaml | ||
permissions: | ||
packages: write | ||
pull-requests: write | ||
with: | ||
platform: linux | ||
nightly: ${{ github.event.inputs.nightly }} |
Oops, something went wrong.