Chisel and CIRCT Bump #155
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Chisel and CIRCT Bump | |
on: | |
schedule: | |
# Run this job everyday at 5:30 AM UTC+8 | |
- cron: '30 21 * * *' | |
jobs: | |
bump-deps: | |
name: "Bump Chisel and CIRCT" | |
if: ${{ !cancelled() }} | |
runs-on: [self-hosted, linux, nixos] | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: master | |
- name: Bump Chisel | |
run: | | |
cd nix/t1 | |
nix run '.#nvfetcher' -- -f '^chisel$' | |
- name: Bump circt | |
run: | | |
oldFirtool="$(nix build '.#circt' --no-link --print-out-paths)/bin/firtool" | |
nix flake update nixpkgs-for-circt | |
newFirtool="$(nix build '.#circt' --no-link --print-out-paths)/bin/firtool" | |
diff_bin="$(nix build '.#diffutils' --no-link --print-out-paths)/bin/diff" | |
if "$diff_bin" -u <($oldFirtool --version) <($newFirtool --version); then | |
# if unchanged | |
git restore flake.lock | |
fi | |
- name: Bump all mill deps | |
run: | | |
oldHash=$(nix derivation show .#t1.elaborator.millDeps | jq -r 'to_entries[0].value.env.outputHash') | |
nix build '.#t1.elaborator.millDeps' --rebuild > t1-milldeps-log.txt 2>&1 || true | |
newHash=$(cat t1-milldeps-log.txt \ | |
| grep -P '^\s+got:\s+sha256-.*$' \ | |
| cut -d':' -f2 \ | |
| xargs) | |
if [ -z "$newHash" ] || [ "$newHash" = "$oldHash" ]; then | |
echo "Original build logs for debug: " | |
cat t1-milldeps-log.txt | |
echo "Hash unchanged, exit" | |
exit 0 | |
fi | |
echo "Updating hash $oldHash to $newHash" | |
sed -i "s|$oldHash|$newHash|" nix/t1/t1.nix | |
- name: Commit changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.T1_PR_PAT }} | |
run: | | |
git config user.name Avimitin | |
git config user.email [email protected] | |
currentDate=$(date +%F) | |
branch="dependencies-bumping-$currentDate" | |
git checkout -b "$branch" | |
git add 'nix/t1' | |
git add 'flake.lock' | |
fileUnchanged() { | |
git diff --quiet --exit-code "$@" | |
} | |
if ! git diff --quiet --cached --exit-code; then | |
updatedFiles=$(git diff --cached --name-only) | |
echo "File changed" | |
git commit -m "[deps] Bump T1 dependencies" | |
git push origin "$branch" --force-with-lease | |
nix run '.#gh' -- \ | |
pr create --title "Bump T1 dependencies" --body "Updated: $updatedFiles" | |
fi |