Skip to content

Commit

Permalink
[ci] merge dump-wave into pr workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin committed Oct 27, 2023
1 parent 8d274a7 commit 00bca28
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 80 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/dump-wave.yml

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/postpr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ jobs:
builders = ssh://nix-remote@${{secrets.ROCKETCHIP_NIX_REMOTE_HOST}}?ssh-key=/etc/nix/builder-key
builders-use-substitutes = true
- id: ci-tests
run: nix develop '.?submodules=1#ci' -c make ci-unpassed-tests DEFAULT_PASSED=.github/passed/default.txt
run: |
nix develop '.#ci' -c make ci-unpassed-tests DEFAULT_PASSED=.github/passed/default.txt
ci:
name: "CI"
Expand Down Expand Up @@ -75,8 +76,8 @@ jobs:
builders-use-substitutes = true
- id: ci-run
run: |
nix develop '.?submodules=1#ci' -c make ci-run "NAME=${{ matrix.name }}"
nix develop '.?submodules=1#ci' -c make convert-perf-to-md
nix develop '.#ci' -c make ci-run "NAME=${{ matrix.name }}"
nix develop '.#ci' -c make convert-perf-to-md
- uses: actions/upload-artifact@v3
if: always()
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- run: sudo -E .github/setup-actions.sh
env:
AWS_CREDENTIALS: ${{secrets.AWS_CREDENTIALS}}
Expand All @@ -30,12 +31,12 @@ jobs:
post-build-hook = /etc/nix/upload-to-cache.sh
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= minio.inner.fi.c-3.moe:gDg5SOIH65O0tTV89dUawME5BTmduWWaA7as/cqvevM=
extra-substituters = https://${{secrets.CACHE_DOMAIN}}/nix
sandbox = relaxed
max-jobs = 0
builders = ssh://nix-remote@${{secrets.ROCKETCHIP_NIX_REMOTE_HOST}}?ssh-key=/etc/nix/builder-key
builders-use-substitutes = true
- id: ci-tests
run: nix develop '.?submodules=1#ci' -c make ci-passed-tests DEFAULT_PASSED=.github/passed/default.txt
run: |
nix develop '.#ci' --show-trace -c make ci-passed-tests DEFAULT_PASSED=.github/passed/default.txt
ci:
name: "CI"
Expand Down Expand Up @@ -71,7 +72,7 @@ jobs:
builders-use-substitutes = true
- id: ci-run
run: |
nix develop '.?submodules=1#ci' -c make ci-run "NAME=${{ matrix.name }}"
nix develop '.#ci' -c make ci-run "NAME=${{ matrix.name }}"
- uses: actions/upload-artifact@v3
if: always()
Expand Down Expand Up @@ -149,8 +150,14 @@ jobs:
builders-use-substitutes = true
- run: |
millTask=$(echo ${{ matrix.name }} | sed 's/v1024l8b2-test/v1024l8b2-test-trace/')
nix develop '.?submodules=1#ci' -c mill -i "$millTask"
find out -name 'wave.fst' -exec mv {} "$millTask".fst \;
nix develop '.#ci' -c mill -i "$millTask"
waveFile=$(find out -name 'wave.fst')
hierFile=$(find out -name 'wave.hier')
if [[ -z "$waveFile" || -n "$hierFile" ]]; then
echo "Verilator doesn't generate wave correctly"
exit 1
fi
mv "$waveFile" ./wave-"$millTask".fst
- uses: actions/upload-artifact@v3
with:
name: fail-test-wave
Expand Down
5 changes: 1 addition & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@
buildInputs = commonDeps ++ chiselDeps ++ testcaseDeps ++ emulatorDeps;
env =
let
verilatorEmulator = pkgs.callPackage ./nix/verilator-emulator.nix {
emulatorTypes = [ "v1024l8b2-test" "v1024l8b2-test-trace" ];
emulatorSrc = self;
};
verilatorEmulator = pkgs.callPackage ./nix/verilator-emulator.nix {};
in
{
VERILATOR_EMULATOR_BIN_PATH = "${verilatorEmulator}/bin";
Expand Down
43 changes: 16 additions & 27 deletions nix/verilator-emulator.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib
, runCommandLocal
, fetchFromGitHub
, mill
, fetchMillDeps
, millSetupHook
Expand All @@ -22,45 +22,34 @@
, # Try speed up compilation
llvmPackages_14
, # Compile options
emulatorTypes ? [ "v1024l8b2-test" ]
emulatorTypes ? [ "v1024l8b2-test" "v1024l8b2-test-trace" ]
, emulatorSrc ? null
}:

assert lib.assertMsg ((builtins.typeOf emulatorTypes) == "list") "`emulatorTypes` is not a `list`";

let
srcs = [
../build.sc
../common.sc
../v
../run
../emulator
../elaborator
../dependencies
../configs
];
# We can simpliy reference the whole repository, but it will let the emulator build again and again
# even when we are editing GitHub Action workflow.
pureEmulatorSrc = runCommandLocal "prepareEmulatorSrc" { inherit srcs; } ''
mkdir -p $out && cd $out
srcArray=( $srcs )
for src in ''${srcArray[@]}; do
dest="$(stripHash "$src")"
cp -pr --reflink=auto -- "$src" "$dest"
done
'';

src = if (builtins.typeOf emulatorSrc != "null") then emulatorSrc else pureEmulatorSrc;
t1 = (fetchFromGitHub {
owner = "chipsalliance";
repo = "t1";
rev = "1f6bf0b79682d88dc3e95c24c9567a584d6fd9dd";
hash = "sha256-okDsnjmEJplIfiIMdb0X1hvMYWEj/Wg7w26XJ2KdXvE=";
fetchSubmodules = true;
}).overrideAttrs (_: {
GIT_CONFIG_COUNT = 1;
GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
GIT_CONFIG_VALUE_0 = "[email protected]:";
});
in
llvmPackages_14.stdenv.mkDerivation rec {
version = "unstable-2023-10";
pname = "emulator";
inherit src;

src = if (builtins.typeOf emulatorSrc != "null") then emulatorSrc else t1;

millDeps = fetchMillDeps {
inherit src pname;
millDepsHash = "sha256-Z/CobcyBWB3y81iT+IFVapRn1gJh7ky71es11a4NvCU=";
millDepsHash = "sha256-8dUmHN85GLthNzHCt5vSO/bH+KdOMopLQ6rCgTnoRPk=";
};

nativeBuildInputs = [
Expand Down

0 comments on commit 00bca28

Please sign in to comment.