-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from chipsalliance/ci
[ci] add github ci
- Loading branch information
Showing
18 changed files
with
372 additions
and
82 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Check the format of a PR | ||
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: | ||
|
||
check-format: | ||
name: "Check format" | ||
runs-on: [self-hosted, linux, nixos] | ||
strategy: | ||
fail-fast: false | ||
defaults: | ||
run: | ||
working-directory: ./templates/chisel | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: "Check Scala format" | ||
continue-on-error: true | ||
run: | | ||
nix develop -c bash -c 'mill -i gcd.checkFormat && mill -i elaborator.checkFormat' | ||
- name: "Check Rust format" | ||
continue-on-error: true | ||
run: | | ||
cd gcdemu | ||
nix develop -c cargo fmt --check | ||
cd .. | ||
- name: "Check nix format" | ||
continue-on-error: true | ||
run: | | ||
nix fmt -- --check nix flake.nix | ||
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
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Build and Run Simulation | ||
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 VCS" | ||
run: | | ||
nix build '.#gcd.vcs.tests.simple-sim' --impure -L | ||
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' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
.bloop | ||
.bsp | ||
.jvm-opts | ||
.mill-jvm-opts | ||
.metals/ | ||
.vscode/ | ||
|
||
out/ | ||
result* | ||
gcd-sim-result/ | ||
/dependencies/ | ||
target/ | ||
|
||
*.vcd | ||
*.fst | ||
*.fsdb | ||
*.log |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,6 @@ | |
"width": 16, | ||
"useAsyncReset": false | ||
}, | ||
"timeout": 5000, | ||
"timeout": 70000, | ||
"testSize": 100 | ||
} |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# SPDX-FileCopyrightText: 2024 Jiuyang Liu <[email protected]> | ||
|
||
{ lib, rustPlatform, tbConfig, dpiLibName, sv2023 ? true, vpi ? false | ||
, enable-trace ? false, timescale ? 1 }: | ||
{ lib | ||
, rustPlatform | ||
, tbConfig | ||
, dpiLibName | ||
, sv2023 ? true | ||
, vpi ? false | ||
, enable-trace ? false | ||
, timescale ? 1 | ||
}: | ||
|
||
rustPlatform.buildRustPackage rec { | ||
name = "dpi-lib"; | ||
|
Oops, something went wrong.