|
| 1 | +name: Materialize direct source PR |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - agent/import-scheiber-can-analysis |
| 7 | + paths: |
| 8 | + - "bootstrap/**" |
| 9 | + - ".github/workflows/materialize-direct-pr.yml" |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + materialize: |
| 16 | + if: github.actor != 'github-actions[bot]' |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Check out import branch |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - name: Reconstruct and verify source payload |
| 25 | + shell: bash |
| 26 | + run: | |
| 27 | + set -Eeuo pipefail |
| 28 | + mkdir -p /tmp/scheiber-payload |
| 29 | + cat bootstrap/payload.b64.* | tr -d '\r\n' | base64 --decode > /tmp/scheiber-payload.tar.xz |
| 30 | + echo "06e355c118516a0b97e92c7a6ced0458b0eeed67fda14be49fd51308003cd816 /tmp/scheiber-payload.tar.xz" | sha256sum --check --strict |
| 31 | + tar -xJf /tmp/scheiber-payload.tar.xz -C /tmp/scheiber-payload |
| 32 | + rm -rf /tmp/scheiber-payload/scripts/__pycache__ /tmp/scheiber-payload/tests/__pycache__ |
| 33 | + find /tmp/scheiber-payload -type f -name '*.py[co]' -delete |
| 34 | + ( |
| 35 | + cd /tmp/scheiber-payload |
| 36 | + rm -f SHA256SUMS |
| 37 | + find . -type f ! -path './SHA256SUMS' -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS |
| 38 | + ) |
| 39 | +
|
| 40 | + - name: Validate decoder and example analysis |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + set -Eeuo pipefail |
| 44 | + cd /tmp/scheiber-payload |
| 45 | + python3 -m unittest discover -s tests -v |
| 46 | + python3 scripts/scheiber_can_analyze.py \ |
| 47 | + data/examples/selected_frames.log \ |
| 48 | + --config config/system_config.json \ |
| 49 | + --output /tmp/scheiber-smoke-test |
| 50 | + test -s /tmp/scheiber-smoke-test/summary.md |
| 51 | +
|
| 52 | + - name: Replace bootstrap history with normal project files |
| 53 | + shell: bash |
| 54 | + env: |
| 55 | + IMPORT_BRANCH: ${{ github.ref_name }} |
| 56 | + EXPECTED_REMOTE_HEAD: ${{ github.sha }} |
| 57 | + run: | |
| 58 | + set -Eeuo pipefail |
| 59 | + git config user.name "Scheiber CAN Analysis Import" |
| 60 | + git config user.email "22434466+danielkope@users.noreply.github.com" |
| 61 | + git fetch origin main |
| 62 | + git reset --hard origin/main |
| 63 | + find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf -- {} + |
| 64 | + tar -C /tmp/scheiber-payload -cf - . | tar -xf - |
| 65 | + git add -A |
| 66 | + git commit -m "Import Scheiber CAN analysis and NMEA 2000 handoff" |
| 67 | + git push \ |
| 68 | + --force-with-lease="refs/heads/${IMPORT_BRANCH}:${EXPECTED_REMOTE_HEAD}" \ |
| 69 | + origin "HEAD:refs/heads/${IMPORT_BRANCH}" |
0 commit comments