-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (58 loc) · 2.19 KB
/
Copy pathmetal-bake.yml
File metadata and controls
69 lines (58 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Metal SRAM Bake
run-name: ${{ github.workflow }} #${{ github.sha }} on ${{ github.ref_name }}
# Trigger on pushes to master when relevant files change
on:
push:
branches: ["master"]
paths:
- "**.guard"
- "src/**"
- ".github/workflows/metal-bake.yml"
- "flux_sram_bake.py"
- "binarize_logic.py"
# Required permission to push changes back to the repository
permissions:
contents: write
jobs:
sram-bake:
runs-on: ubuntu-latest
steps:
- name: Checkout full repository history
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for git commit/push operations
- name: Set up Python 3.10 with pip caching
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
# Add additional PyPI packages here if needed for your use case
shell: bash
- name: Generate SRAM output files
run: python flux_sram_bake.py
env:
PYTHONUNBUFFERED: 1 # Stream logs immediately to GitHub Actions
LOG_LEVEL: INFO
- name: Check for generated file changes
id: check-changes
run: |
# Exit 0 if no changes, non-zero if changes exist
git diff --exit-code flux-hardware/hdc/flux_kb.sram flux-hardware/hdc/flux_kb.h flux-hardware/hdc/flux_kb.json
echo "files_changed=$?" >> "$GITHUB_OUTPUT"
shell: bash
- name: Commit and push updated SRAM files
if: steps.check-changes.outputs.files_changed != 0
run: |
# Configure git identity for automated commits
git config --global user.name "GitHub Actions Bot"
git config --global user.email "actions@github.com"
# Stage only our generated output files
git add flux-hardware/hdc/flux_kb.sram flux-hardware/hdc/flux_kb.h flux-hardware/hdc/flux_kb.json
# Commit with [skip ci] to avoid infinite workflow loops
git commit -m "chore: regenerate SRAM images [skip ci]"
# Push changes back to master branch
git push origin master
shell: bash