mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-07-10 01:02:08 +08:00
b040fcd2a9
* package_ota.py & upload to commaai/ci-artifacts * fix simg2img incorrectly using shell=True [upload] * fix output path * [upload] * Apply suggestions from code review --------- Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
103 lines
3.9 KiB
YAML
103 lines
3.9 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
name: build kernel and system
|
|
runs-on: namespace-profile-arm64-8x16-2004-caching
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
submodules: true
|
|
|
|
- name: Get commit message
|
|
run: |
|
|
{
|
|
echo 'LAST_COMMIT_MESSAGE<<EOF'
|
|
if [ "${{ github.event_name }}" == "push" ]; then
|
|
echo "${{ github.event.head_commit.message }}"
|
|
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
|
COMMIT_URL=$(echo "${{ github.event.repository.commits_url }}" | sed "s|{/sha}|/${{ github.sha }}|")
|
|
echo "$(curl -s "$COMMIT_URL" | jq -r '.commit.message')"
|
|
elif [ "${{ github.event_name }}" == "pull_request" ]; then
|
|
PR_COMMIT_URL=$(echo "${{ github.event.repository.commits_url }}" | sed "s|{/sha}|/${{ github.event.pull_request.head.sha }}|")
|
|
echo "$(curl -s "$PR_COMMIT_URL" | jq -r '.commit.message')"
|
|
fi
|
|
echo EOF
|
|
} | tee -a $GITHUB_ENV
|
|
|
|
- name: Checkout ci-artifacts
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: commaai/ci-artifacts
|
|
ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }}
|
|
path: ${{ github.workspace }}/ci-artifacts
|
|
ref: master
|
|
|
|
- name: Get kernel submodule ref
|
|
id: kernel-submodule
|
|
run: echo "ref=$(git ls-tree HEAD | awk '$4 == "agnos-kernel-sdm845"' | awk '{print $3}')" | tee -a $GITHUB_OUTPUT
|
|
|
|
- name: ccache
|
|
uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92
|
|
with:
|
|
key: kernel-${{ steps.kernel-submodule.outputs.ref }}
|
|
restore-keys: kernel-
|
|
|
|
- name: Build kernel
|
|
run: ./build_kernel.sh
|
|
|
|
- name: Build system
|
|
run: ./build_system.sh
|
|
|
|
- name: Package and OTA push
|
|
if: "contains(env.LAST_COMMIT_MESSAGE, '[upload]')"
|
|
env:
|
|
AGNOS_UPDATE_URL: https://raw.githubusercontent.com/commaai/ci-artifacts/agnos-builder/pr-${{ github.event.number }}/
|
|
run: |
|
|
sudo apt-get install -y android-sdk-libsparse-utils
|
|
scripts/package_ota.py
|
|
|
|
- name: Copy and push boot, system and agnos.json
|
|
if: false
|
|
working-directory: ${{ github.workspace }}/ci-artifacts
|
|
run: |
|
|
cp ${{ github.workspace }}/output/ota/*.img.xz .
|
|
cp ${{ github.workspace }}/output/ota/ota.json agnos.json
|
|
git checkout -b agnos-builder/pr-${{ github.event.number }}
|
|
git config user.name "GitHub Actions Bot"
|
|
git config user.email "<>"
|
|
git add ${{ github.workspace }}/ci-artifacts/*
|
|
git commit -m "build artifacts for PR #${{ github.event.number }}"
|
|
git push origin agnos-builder/pr-${{ github.event.number }} --force
|
|
|
|
- name: Comment on PR
|
|
if: false
|
|
uses: thollander/actions-comment-pull-request@v2
|
|
with:
|
|
message: |
|
|
<!-- _(run_id **${{ github.run_id }}**)_ -->
|
|
## Build agnos.json
|
|
Download <a href="https://raw.githubusercontent.com/commaai/ci-artifacts/agnos-builder/pr-${{ github.event.number }}/agnos.json" target="_blank">agnos.json</a> and replace `openpilot/system/hardware/tici/agnos.json` in your openpilot branch.
|
|
|
|
If you need to flash locally, you can download the <a href="https://github.com/commaai/ci-artifacts/tree/agnos-builder/pr-${{ github.event.number }}" target="_blank">images</a> and unarchive them in `agnos-builder/output` and flash with `./flash_all.sh`.
|
|
|
|
---
|
|
comment_tag: run_id
|
|
pr_number: ${{ github.event.number }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|