Skip to content

Commit

Permalink
[ci] add github ci
Browse files Browse the repository at this point in the history
Signed-off-by: unlsycn <[email protected]>
  • Loading branch information
unlsycn committed Sep 9, 2024
1 parent 70f0b3d commit 8fa83d8
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/daily-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Dependencies 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
defaults:
run:
working-directory: ./templates/chisel
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master
- name: Bump nixpkgs
run: |
nix flake update
- name: Bump Chisel
run: |
cd nix/pkgs/dependencies
nix run '.#nvfetcher' -- -f '^chisel$'
- name: Bump all mill deps
run: |
oldHash=$(nix derivation show .#gcd.gcd-compiled.millDeps | jq -r 'to_entries[0].value.env.outputHash')
nix build '.#gcd.gcd-compiled.millDeps' --rebuild > milldeps-log.txt 2>&1 || true
newHash=$(cat 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 milldeps-log.txt
echo "Hash unchanged, exit"
exit 0
fi
echo "Updating hash $oldHash to $newHash"
sed -i "s|$oldHash|$newHash|" nix/gcd/gcd.nix
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.BIYUN_GITHUB_ACTION }}
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
currentDate=$(date +%F)
branch="dependencies-bumping-$currentDate"
git checkout -b "$branch"
git add 'nix/pkgs/dependencies'
git add 'flake.lock'
if ! git diff --quiet --cached --exit-code; then
updatedFiles=$(git diff --cached --name-only)
echo "File changed"
git commit -m "[deps] Bump dependencies"
git push origin "$branch" --force-with-lease
nix run '.#gh' -- \
pr create --title "Bump dependencies" --body "Updated: $updatedFiles"
fi
75 changes: 75 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: VCS Test
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
- labeled
env:
USER: runner

# Cancel the current workflow when new commit pushed
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:

build-simulators:
name: "Build Simulators"
runs-on: [self-hosted, linux, nixos, BIGRAM]
strategy:
fail-fast: false
defaults:
run:
working-directory: ./templates/chisel
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Build vcs simulator"
run: |
nix build '.#gcd.vcs' --impure
- name: "Build vcs simulator with trace"
run: |
nix build '.#gcd.vcs-trace' --impure
- name: "Build verilator simulator"
run: |
nix build '.#gcd.verilated'
- name: "Build verilator simulator with trace"
run: |
nix build '.#gcd.verilated-trace'
run-vcs:
name: "Run VCS"
strategy:
fail-fast: false
runs-on: [self-hosted, linux, nixos]
defaults:
run:
working-directory: ./templates/chisel
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Run verilator"
run: |
nix run '.#gcd.vcs' --impure
run-verilator:
name: "Run Verilator"
strategy:
fail-fast: false
runs-on: [self-hosted, linux, nixos]
defaults:
run:
working-directory: ./templates/chisel
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Run verilator"
run: |
nix run '.#gcd.verilated'

0 comments on commit 8fa83d8

Please sign in to comment.