name: Compile StarPilot on: workflow_dispatch: inputs: target_ref: description: "Branch to build and publish back to" type: string default: "master" required: true jobs: description: "Optional parallel job count passed to ./build" type: string default: "12" required: false concurrency: group: compile-starpilot-${{ inputs.target_ref }} cancel-in-progress: false permissions: contents: write env: GIT_EMAIL: "168790843+firestar5683@users.noreply.github.com" GIT_NAME: "StarPilot Build Bot" TARGET_REF: ${{ inputs.target_ref }} jobs: build_and_push: runs-on: [self-hosted, truenas, starpilot-build] timeout-minutes: 720 steps: - name: Validate target branch shell: bash run: | set -euo pipefail if [[ -z "${TARGET_REF}" ]]; then echo "target_ref is required." >&2 exit 1 fi if [[ "${TARGET_REF}" == refs/heads/* ]]; then echo "BUILD_BRANCH=${TARGET_REF#refs/heads/}" >> "$GITHUB_ENV" else echo "BUILD_BRANCH=${TARGET_REF}" >> "$GITHUB_ENV" fi - name: Checkout target branch uses: actions/checkout@v4 with: ref: ${{ env.BUILD_BRANCH }} fetch-depth: 0 submodules: recursive - name: Configure git identity shell: bash run: | set -euo pipefail git config user.name "$GIT_NAME" git config user.email "$GIT_EMAIL" git config http.postBuffer 104857600 - name: Ensure branch exists on origin shell: bash run: | set -euo pipefail git ls-remote --exit-code --heads origin "refs/heads/${BUILD_BRANCH}" >/dev/null - name: Link persistent sysroot shell: bash run: | set -euo pipefail ls -ld /runner /runner/sysroots /runner/sysroots/default || true ls -ld /runner/sysroots/default/usr /runner/sysroots/default/usr/local /runner/sysroots/default/usr/local/lib || true rm -rf .comma_sysroot ln -s /runner/sysroots/default .comma_sysroot ls -ld .comma_sysroot .comma_sysroot/usr .comma_sysroot/usr/local .comma_sysroot/usr/local/lib - name: Run StarPilot device build shell: bash run: | set -euo pipefail export COMMA_HOST_ROOT_DIR="/mnt/Apparition/My_App_Data/starpilot-runner/_work/${GITHUB_REPOSITORY#*/}/${GITHUB_REPOSITORY#*/}" export COMMA_HOST_SYSROOT_DIR="/mnt/Apparition/My_App_Data/starpilot-runner/sysroots/default" export COMMA_HOST_CACHE_DIR="/mnt/Apparition/My_App_Data/starpilot-runner/cache/work" export COMMA_HOST_VENV_DIR="/mnt/Apparition/My_App_Data/starpilot-runner/cache/venv-linux-arm64" export COMMA_SYSROOT_DIR="/runner/sysroots/default" if [[ -n "${{ inputs.jobs }}" ]]; then ./build "${{ inputs.jobs }}" else ./build fi - name: Commit build output shell: bash run: | set -euo pipefail if [[ -z "$(git status --porcelain --untracked-files=no)" ]]; then echo "No build output changes detected." exit 0 fi git add -u git commit -m "build" - name: Push build commit shell: bash run: | set -euo pipefail git push origin "HEAD:refs/heads/${BUILD_BRANCH}"