Skip to content

Commit 186a7f4

Browse files
committed
[ci] add github ci
Signed-off-by: unlsycn <[email protected]>
1 parent 70f0b3d commit 186a7f4

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

.github/workflows/daily-bump.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Dependencies Bump
2+
on:
3+
schedule:
4+
# Run this job everyday at 5:30 AM UTC+8
5+
- cron: '30 21 * * *'
6+
7+
jobs:
8+
bump-deps:
9+
name: "Bump Chisel and CIRCT"
10+
if: ${{ !cancelled() }}
11+
runs-on: [self-hosted, linux, nixos]
12+
permissions:
13+
contents: write
14+
defaults:
15+
run:
16+
working-directory: ./templates/chisel
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
ref: master
22+
- name: Bump nixpkgs
23+
run: |
24+
nix flake update
25+
- name: Bump Chisel
26+
run: |
27+
cd nix/pkgs/dependencies
28+
nix run '.#nvfetcher' -- -f '^chisel$'
29+
- name: Bump all mill deps
30+
run: |
31+
oldHash=$(nix derivation show .#gcd.gcd-compiled.millDeps | jq -r 'to_entries[0].value.env.outputHash')
32+
nix build '.#gcd.gcd-compiled.millDeps' --rebuild > milldeps-log.txt 2>&1 || true
33+
newHash=$(cat milldeps-log.txt \
34+
| grep -P '^\s+got:\s+sha256-.*$' \
35+
| cut -d':' -f2 \
36+
| xargs)
37+
if [ -z "$newHash" ] || [ "$newHash" = "$oldHash" ]; then
38+
echo "Original build logs for debug: "
39+
cat milldeps-log.txt
40+
echo "Hash unchanged, exit"
41+
exit 0
42+
fi
43+
echo "Updating hash $oldHash to $newHash"
44+
sed -i "s|$oldHash|$newHash|" nix/gcd/gcd.nix
45+
- name: Commit changes
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.BIYUN_GITHUB_ACTION }}
48+
run: |
49+
git config user.name github-actions[bot]
50+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
51+
52+
currentDate=$(date +%F)
53+
branch="dependencies-bumping-$currentDate"
54+
git checkout -b "$branch"
55+
56+
git add 'nix/pkgs/dependencies'
57+
git add 'flake.lock'
58+
59+
if ! git diff --quiet --cached --exit-code; then
60+
updatedFiles=$(git diff --cached --name-only)
61+
echo "File changed"
62+
git commit -m "[deps] Bump dependencies"
63+
git push origin "$branch" --force-with-lease
64+
nix run '.#gh' -- \
65+
pr create --title "Bump dependencies" --body "Updated: $updatedFiles"
66+
fi

.github/workflows/main.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build and Run Simulation
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- synchronize
7+
- reopened
8+
- ready_for_review
9+
- labeled
10+
env:
11+
USER: runner
12+
13+
# Cancel the current workflow when new commit pushed
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
20+
build-simulators:
21+
name: "Build Simulators"
22+
runs-on: [self-hosted, linux, nixos, BIGRAM]
23+
strategy:
24+
fail-fast: false
25+
defaults:
26+
run:
27+
working-directory: ./templates/chisel
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
ref: ${{ github.event.pull_request.head.sha }}
32+
- name: "Build vcs simulator"
33+
run: |
34+
nix build '.#gcd.vcs' --impure
35+
- name: "Build vcs simulator with trace"
36+
run: |
37+
nix build '.#gcd.vcs-trace' --impure
38+
- name: "Build verilator simulator"
39+
run: |
40+
nix build '.#gcd.verilated'
41+
- name: "Build verilator simulator with trace"
42+
run: |
43+
nix build '.#gcd.verilated-trace'
44+
45+
run-vcs:
46+
name: "Run VCS"
47+
strategy:
48+
fail-fast: false
49+
runs-on: [self-hosted, linux, nixos]
50+
defaults:
51+
run:
52+
working-directory: ./templates/chisel
53+
steps:
54+
- uses: actions/checkout@v4
55+
with:
56+
ref: ${{ github.event.pull_request.head.sha }}
57+
- name: "Run VCS"
58+
run: |
59+
nix run '.#gcd.vcs' --impure
60+
61+
run-verilator:
62+
name: "Run Verilator"
63+
strategy:
64+
fail-fast: false
65+
runs-on: [self-hosted, linux, nixos]
66+
defaults:
67+
run:
68+
working-directory: ./templates/chisel
69+
steps:
70+
- uses: actions/checkout@v4
71+
with:
72+
ref: ${{ github.event.pull_request.head.sha }}
73+
- name: "Run verilator"
74+
run: |
75+
nix run '.#gcd.verilated'

0 commit comments

Comments
 (0)