From dde8d89c3145665fcc886edffa3f7aa504e5200a Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Sun, 19 Apr 2026 12:24:58 -0700 Subject: [PATCH] refactor: remove custom_build_test.yml workflow and update references in actions.ts to use custom_build.yml --- .github/workflows/custom_build.yml | 2 +- .github/workflows/custom_build_test.yml | 220 ------------------------ convex/actions.ts | 5 +- 3 files changed, 3 insertions(+), 224 deletions(-) delete mode 100644 .github/workflows/custom_build_test.yml diff --git a/.github/workflows/custom_build.yml b/.github/workflows/custom_build.yml index 4b882de..37a3d5b 100644 --- a/.github/workflows/custom_build.yml +++ b/.github/workflows/custom_build.yml @@ -96,7 +96,7 @@ jobs: path: | ~/.platformio/.cache ~/.platformio/packages - key: platformio-${{ runner.os }}-v1-${{ hashFiles('.github/workflows/custom_build.yml', '.github/workflows/custom_build_test.yml') }} + key: platformio-${{ runner.os }}-v1-${{ hashFiles('.github/workflows/custom_build.yml') }} restore-keys: | platformio-${{ runner.os }}-v1- diff --git a/.github/workflows/custom_build_test.yml b/.github/workflows/custom_build_test.yml deleted file mode 100644 index 4b882de..0000000 --- a/.github/workflows/custom_build_test.yml +++ /dev/null @@ -1,220 +0,0 @@ -name: Repo PlatformIO Build - -on: - workflow_dispatch: - inputs: - owner: - required: true - type: string - repo: - required: true - type: string - ref: - required: true - type: string - target_env: - required: true - type: string - repo_build_id: - required: true - type: string - build_key: - required: true - type: string - resolved_source_sha: - required: true - type: string - convex_url: - required: true - type: string - -jobs: - build: - runs-on: ubuntu-latest - env: - CONVEX_URL: ${{ inputs.convex_url }} - REPO_BUILD_ID: ${{ inputs.repo_build_id }} - CONVEX_BUILD_TOKEN: ${{ secrets.CONVEX_BUILD_TOKEN }} - CI_PROGRESS_TOTAL: "10" - PLATFORMIO_LIBDEPS_DIR: ${{ github.workspace }}/.pio-libdeps/${{ inputs.owner }}/${{ inputs.repo }}/${{ inputs.target_env }} - steps: - - uses: actions/checkout@v4 - - - name: Notify Convex — running - shell: bash - run: | - curl -sSf -X POST "$CONVEX_URL/ingest-repo-build" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $CONVEX_BUILD_TOKEN" \ - -d "{\"repo_build_id\":\"$REPO_BUILD_ID\",\"state\":\"running\",\"github_run_id\":${{ github.run_id }}}" - - - name: CI progress — build started - shell: bash - env: - STEP_INDEX: 1 - LABEL: Build started on Actions - run: python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - - name: Setup Bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: latest - - - name: CI progress — tooling ready - shell: bash - env: - STEP_INDEX: 2 - LABEL: Runner tooling ready - run: python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - - - name: Download source archive - shell: bash - env: - OWNER: ${{ inputs.owner }} - REPO: ${{ inputs.repo }} - REF: ${{ inputs.ref }} - run: | - STEP_INDEX=3 LABEL="Downloading source archive" python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - ENC_REF=$(python3 -c "import urllib.parse,os; print(urllib.parse.quote(os.environ['REF'], safe=''))") - curl -fsSL -o /tmp/src.zip "https://codeload.github.com/${OWNER}/${REPO}/zip/${ENC_REF}" - - - name: CI progress — restoring PlatformIO global cache - shell: bash - env: - STEP_INDEX: 4 - LABEL: Restoring PlatformIO global cache (toolchains) - run: python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - - - name: Cache PlatformIO global store - uses: actions/cache@v4 - with: - path: | - ~/.platformio/.cache - ~/.platformio/packages - key: platformio-${{ runner.os }}-v1-${{ hashFiles('.github/workflows/custom_build.yml', '.github/workflows/custom_build_test.yml') }} - restore-keys: | - platformio-${{ runner.os }}-v1- - - - name: CI progress — restoring PlatformIO libdeps cache - shell: bash - env: - STEP_INDEX: 5 - LABEL: Restoring PlatformIO libdeps cache - run: python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - - # Key is owner/repo/env only (not source SHA); bump …-v2 if lib_deps get out of sync. - - name: Cache PlatformIO libdeps (per repo + target) - uses: actions/cache@v4 - with: - path: ${{ github.workspace }}/.pio-libdeps/${{ inputs.owner }}/${{ inputs.repo }}/${{ inputs.target_env }} - key: pio-libdeps-${{ inputs.owner }}-${{ inputs.repo }}-${{ inputs.target_env }}-v1 - - - name: Extract firmware source - shell: bash - run: | - STEP_INDEX=6 LABEL="Extracting firmware source" python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - set -e - sudo apt-get update -qq && sudo apt-get install -y -qq unzip - rm -rf /tmp/src - mkdir -p /tmp/src - unzip -q /tmp/src.zip -d /tmp/src - ROOT=$(find /tmp/src -mindepth 1 -maxdepth 1 -type d | head -1) - printf '%s\n' "$ROOT" > /tmp/fw-src-root.txt - mkdir -p "$PLATFORMIO_LIBDEPS_DIR" - - - name: Install PlatformIO - shell: bash - run: | - STEP_INDEX=7 LABEL="Installing PlatformIO" python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - set -e - ROOT=$(cat /tmp/fw-src-root.txt) - cd "$ROOT" - python -m pip install -q --upgrade pip - pip install -q platformio adafruit-nrfutil - - - name: Install PlatformIO dependencies - shell: bash - run: | - STEP_INDEX=8 LABEL="Installing firmware dependencies (PlatformIO)" python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - set -e - ROOT=$(cat /tmp/fw-src-root.txt) - cd "$ROOT" - pio pkg install -e "${{ inputs.target_env }}" - - - name: Compile firmware (PlatformIO) - shell: bash - run: | - STEP_INDEX=9 LABEL="Compiling firmware (PlatformIO)" python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - set -e - ROOT=$(cat /tmp/fw-src-root.txt) - cd "$ROOT" - MKLITTLEFS_BIN=$(find "$HOME/.platformio/packages" -type f -name mklittlefs 2>/dev/null | head -1) - if [ -n "$MKLITTLEFS_BIN" ]; then - export PATH="$(dirname "$MKLITTLEFS_BIN"):$PATH" - fi - command -v mklittlefs >/dev/null 2>&1 || echo "WARNING: mklittlefs not on PATH; LittleFS build may fail" - pio run -e "${{ inputs.target_env }}" 2>&1 | tee /tmp/pio.log - BUILD_DIR=".pio/build/${{ inputs.target_env }}" - if [ ! -d "$BUILD_DIR" ]; then - echo "Build output directory missing" - exit 1 - fi - - - name: Package and upload firmware bundle - id: pio - env: - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - R2_BUCKET_NAME: ${{ secrets.R2_BUCKET_NAME }} - shell: bash - run: | - STEP_INDEX=10 LABEL="Packaging and uploading firmware bundle" python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - set -e - ROOT=$(cat /tmp/fw-src-root.txt) - BUILD_DIR_ABS="$ROOT/.pio/build/${{ inputs.target_env }}" - ARTIFACT_NAME="firmware-${{ inputs.build_key }}-${{ github.run_id }}.tar.gz" - MESHTASTIC_OTA=1 bash "${{ github.workspace }}/scripts/ci/common/fw-bundle-pipeline.sh" "$ROOT" "$BUILD_DIR_ABS" "/tmp/$ARTIFACT_NAME" - OBJECT_PATH="${R2_BUCKET_NAME}/${ARTIFACT_NAME}" - bunx wrangler r2 object put "$OBJECT_PATH" --file "/tmp/$ARTIFACT_NAME" --remote - STEP_INDEX=10 LABEL="Firmware bundle uploaded" python3 "${{ github.workspace }}/scripts/ci/report-convex-ci-progress.py" - echo "r2_key=${ARTIFACT_NAME}" >> "$GITHUB_OUTPUT" - - - name: Notify Convex — success - if: success() - shell: bash - env: - R2_KEY: ${{ steps.pio.outputs.r2_key }} - run: | - curl -sSf -X POST "$CONVEX_URL/ingest-repo-build" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $CONVEX_BUILD_TOKEN" \ - -d "{\"repo_build_id\":\"$REPO_BUILD_ID\",\"state\":\"succeeded\",\"github_run_id\":${{ github.run_id }},\"r2ObjectKey\":\"$R2_KEY\"}" - - - name: Notify Convex — failure - if: failure() - shell: bash - env: - GITHUB_RUN_ID: ${{ github.run_id }} - run: | - python3 -c " - import json, os, urllib.request - err = open('/tmp/pio.log').read()[-4000:] if os.path.exists('/tmp/pio.log') else 'build failed' - body = { - 'repo_build_id': os.environ['REPO_BUILD_ID'], - 'state': 'failed', - 'github_run_id': int(os.environ['GITHUB_RUN_ID']), - 'errorSummary': err, - } - req = urllib.request.Request( - os.environ['CONVEX_URL'] + '/ingest-repo-build', - data=json.dumps(body).encode(), - headers={'Content-Type': 'application/json', 'Authorization': 'Bearer ' + os.environ['CONVEX_BUILD_TOKEN']}, - method='POST', - ) - urllib.request.urlopen(req) - " diff --git a/convex/actions.ts b/convex/actions.ts index 76dde47..367f86d 100644 --- a/convex/actions.ts +++ b/convex/actions.ts @@ -23,8 +23,7 @@ export const dispatchRepoBuild = action({ } const isDev = process.env.CONVEX_ENV === "dev" - const workflowFile = isDev ? "custom_build_test.yml" : "custom_build.yml" - const workflowRef = isDev ? "v2" : "main" + const workflowRef = isDev ? "develop" : "main" const payload = { ref: workflowRef, @@ -40,7 +39,7 @@ export const dispatchRepoBuild = action({ }, } - const url = `https://api.github.com/repos/MeshEnvy/mesh-forge/actions/workflows/${workflowFile}/dispatches` + const url = `https://api.github.com/repos/MeshEnvy/mesh-forge/actions/workflows/custom_build.yml/dispatches` const headers = { Authorization: `Bearer ${githubToken}`, Accept: "application/vnd.github.v3+json",