Skip to content

Commit

Permalink
Merge branch 'master' into sliakh-11019-Flakes-in-liveslots-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
siarhei-agoric authored Feb 20, 2025
2 parents 1725df2 + 0e76960 commit 97ecaed
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 32 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/nix-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Nix Flake Check

on:
pull_request:
push:
branches:
- master
- 'release-*'
- 'dev-*'
permissions:
contents: read

jobs:
flake-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9

- name: Enable flakes
uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Check Nix flake inputs
run: nix flake check

- name: Show flake metadata
if: always() # Run even if previous step fails
run: nix flake metadata

- name: Validate flake outputs
if: always() # Run even if previous step fails
run: nix flake show

- name: Check build in Nix dev shell
run: |
# Enter nix develop and run build commands
nix develop --command bash -c '
# Install dependencies
yarn install
# Build the project
yarn build
# Build cosmic-swingset
cd packages/cosmic-swingset && make
'
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
description = "Agoric SDK Development Environment";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
# Custom Node.js 20.9.0 package
custom_node_20_9 = pkgs.stdenv.mkDerivation {
pname = "nodejs";
version = "20.9.0";

src = pkgs.fetchurl {
url = "https://nodejs.org/dist/v20.9.0/node-v20.9.0-${if pkgs.stdenv.isDarwin then "darwin" else "linux"}-${if pkgs.stdenv.isAarch64 then "arm64" else "x64"}.tar.gz";
sha256 = if pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64 then
"0snfsz2mmjdavi38nglayw5yia74q9h1xzz2ahpri8yqx1md9lii" # darwin-arm64
else if pkgs.stdenv.isDarwin then
"1j6cw6i3hjqv8zk1nbsqg560k7rgcmyl9cfd4vlvn5wclzr76nzw" # darwin-x64
else if pkgs.stdenv.isAarch64 then
"0skah3bal5irvramnfn86vgi0c375ywsyb4xaxmx3gvlnbpdp9yj" # linux-arm64
else if (pkgs.stdenv.isLinux && !pkgs.stdenv.isAarch64) then
"0q3gy4z5b8dd0w37ya5wlkbv4xhyqa1s0zwh71258x5z5w4rz4gh" # linux-x64
else
throw "Unsupported system: This derivation only supports Linux (x64/arm64) and Darwin (x64/arm64) systems";
};

installPhase = ''
echo "installing nodejs"
mkdir -p $out
cp -r ./ $out/
'';


# Meta information for the package
meta = with pkgs.lib; {
description = "Node.js 20.9.0 JavaScript runtime";
homepage = "https://nodejs.org";
license = licenses.mit;
platforms = platforms.unix;
};
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
custom_node_20_9
(yarn.override { nodejs = custom_node_20_9; })
(python3.withPackages (ps: [ ps.distutils ]))
pkg-config
go_1_23
gopls
delve
gcc
gnumake
protobuf
buf
git
];

shellHook = ''
export PATH=$PATH:$HOME/go/bin
echo "Node.js $(node --version)"
echo "NPM $(npm --version)"
echo "Yarn using Node.js $(yarn node -v)"
'';
};
}
);
}
32 changes: 0 additions & 32 deletions patches/ava+5.3.1.patch
Original file line number Diff line number Diff line change
Expand Up @@ -94,38 +94,6 @@ index 7630baa..78ced77 100644

notifyOfPeerFailure() {
send({type: 'peer-failed'});
diff --git a/node_modules/ava/lib/reporters/tap.js b/node_modules/ava/lib/reporters/tap.js
index b1989a4..fa1617f 100644
--- a/node_modules/ava/lib/reporters/tap.js
+++ b/node_modules/ava/lib/reporters/tap.js
@@ -45,6 +45,10 @@ function dumpError(error) {
return object;
}

+function durationOut(dur) {
+ return dur ? ` %ava-dur=${dur}ms` : '';
+}
+
export default class TapReporter {
constructor(options) {
this.i = 0;
@@ -96,6 +100,7 @@ export default class TapReporter {
}

writeTest(evt, flags) {
+ evt.title += durationOut(evt.duration);
this.reportStream.write(supertap.test(this.prefixTitle(evt.testFile, evt.title), {
comment: evt.logs,
error: evt.err ? dumpError(evt.err) : null,
@@ -108,7 +113,7 @@ export default class TapReporter {

writeCrash(evt, title) {
this.crashCount++;
- this.reportStream.write(supertap.test(title || evt.err.summary || evt.type, {
+ this.reportStream.write(supertap.test((title || evt.err.summary || evt.type) + durationOut(evt.duration), {
comment: evt.logs,
error: evt.err ? dumpError(evt.err) : null,
index: ++this.i,
diff --git a/node_modules/ava/lib/worker/base.js b/node_modules/ava/lib/worker/base.js
index cdd3c4a..4302a4a 100644
--- a/node_modules/ava/lib/worker/base.js
Expand Down

0 comments on commit 97ecaed

Please sign in to comment.