Skip to content

Commit 6b49d26

Browse files
authored
ci: use foundry nightly (#6129)
1 parent c685130 commit 6b49d26

File tree

6 files changed

+174
-142
lines changed

6 files changed

+174
-142
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,7 @@ jobs:
172172
- name: Install Foundry
173173
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1
174174
with:
175-
# Pinned to specific version since newer versions do not produce
176-
# deterministic block hashes. Unpin once that's fixed upstream
177-
version: v1.2.3
175+
version: nightly
178176

179177
- name: Install pnpm
180178
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4

flake.lock

Lines changed: 9 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 144 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
inputs = {
33
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
4-
foundry.url = "github:shazow/foundry.nix/5af12b6f2b708858ef3120041546ed6b038474a5";
4+
foundry.url = "github:shazow/foundry.nix";
55
fenix = {
66
url = "github:nix-community/fenix";
77
inputs.nixpkgs.follows = "nixpkgs";
@@ -11,160 +11,185 @@
1111
flake-parts.url = "github:hercules-ci/flake-parts";
1212
};
1313

14-
outputs = inputs@{ flake-parts, process-compose-flake, services-flake, nixpkgs, fenix, foundry, ... }:
15-
flake-parts.lib.mkFlake { inherit inputs; } {
16-
imports = [ process-compose-flake.flakeModule ];
14+
outputs = inputs @ {
15+
flake-parts,
16+
process-compose-flake,
17+
services-flake,
18+
nixpkgs,
19+
fenix,
20+
foundry,
21+
...
22+
}:
23+
flake-parts.lib.mkFlake {inherit inputs;} {
24+
imports = [process-compose-flake.flakeModule];
1725
systems = [
1826
"x86_64-linux" # 64-bit Intel/AMD Linux
1927
"aarch64-linux" # 64-bit ARM Linux
2028
"x86_64-darwin" # 64-bit Intel macOS
2129
"aarch64-darwin" # 64-bit ARM macOS
2230
];
2331

24-
perSystem = { config, self', inputs', pkgs, system, ... }:
25-
let
26-
overlays = [
27-
fenix.overlays.default
28-
foundry.overlay
29-
];
32+
perSystem = {
33+
config,
34+
self',
35+
inputs',
36+
pkgs,
37+
system,
38+
...
39+
}: let
40+
overlays = [
41+
fenix.overlays.default
42+
foundry.overlay
43+
];
3044

31-
pkgs = import nixpkgs {
32-
inherit overlays system;
33-
};
45+
pkgs = import nixpkgs {
46+
inherit overlays system;
47+
};
3448

35-
toolchain = with fenix.packages.${system}; combine [
49+
toolchain = with fenix.packages.${system};
50+
combine [
3651
(fromToolchainFile {
3752
file = ./rust-toolchain.toml;
3853
sha256 = "sha256-+9FmLhAOezBZCOziO0Qct1NOrfpjNsXxc/8I0c7BdKE=";
3954
})
4055
stable.rust-src # This is needed for rust-analyzer to find stdlib symbols. Should use the same channel as the toolchain.
4156
];
42-
in {
43-
devShells.default = pkgs.mkShell {
44-
packages = (with pkgs; [
45-
toolchain
46-
foundry-bin
47-
solc
48-
protobuf
49-
uv
50-
cmake
51-
corepack
52-
nodejs
53-
postgresql
54-
just
55-
cargo-nextest
56-
]);
57-
};
57+
in {
58+
formatter = pkgs.alejandra;
59+
devShells.default = pkgs.mkShell {
60+
packages = with pkgs; [
61+
toolchain
62+
foundry-bin
63+
solc
64+
protobuf
65+
uv
66+
cmake
67+
corepack
68+
nodejs
69+
postgresql
70+
just
71+
cargo-nextest
72+
];
73+
};
5874

59-
process-compose = let
60-
inherit (services-flake.lib) multiService;
61-
ipfs = multiService ./nix/ipfs.nix;
62-
anvil = multiService ./nix/anvil.nix;
75+
process-compose = let
76+
inherit (services-flake.lib) multiService;
77+
ipfs = multiService ./nix/ipfs.nix;
78+
anvil = multiService ./nix/anvil.nix;
6379

64-
# Helper function to create postgres configuration with graph-specific defaults
65-
mkPostgresConfig = { name, port, user, password, database, dataDir }: {
66-
enable = true;
67-
inherit port dataDir;
68-
initialScript = {
69-
before = ''
70-
CREATE USER \"${user}\" WITH PASSWORD '${password}' SUPERUSER;
71-
'';
72-
};
73-
initialDatabases = [
74-
{
75-
inherit name;
76-
schemas = [ (pkgs.writeText "init-${name}.sql" ''
80+
# Helper function to create postgres configuration with graph-specific defaults
81+
mkPostgresConfig = {
82+
name,
83+
port,
84+
user,
85+
password,
86+
database,
87+
dataDir,
88+
}: {
89+
enable = true;
90+
inherit port dataDir;
91+
initialScript = {
92+
before = ''
93+
CREATE USER \"${user}\" WITH PASSWORD '${password}' SUPERUSER;
94+
'';
95+
};
96+
initialDatabases = [
97+
{
98+
inherit name;
99+
schemas = [
100+
(pkgs.writeText "init-${name}.sql" ''
77101
CREATE EXTENSION IF NOT EXISTS pg_trgm;
78-
CREATE EXTENSION IF NOT EXISTS btree_gist;
102+
CREATE EXTENSION IF NOT EXISTS btree_gist;
79103
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
80104
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
81105
GRANT USAGE ON FOREIGN DATA WRAPPER postgres_fdw TO "${user}";
82106
ALTER DATABASE "${database}" OWNER TO "${user}";
83-
'') ];
84-
}
85-
];
86-
settings = {
87-
shared_preload_libraries = "pg_stat_statements";
88-
log_statement = "all";
89-
default_text_search_config = "pg_catalog.english";
90-
max_connections = 500;
91-
};
107+
'')
108+
];
109+
}
110+
];
111+
settings = {
112+
shared_preload_libraries = "pg_stat_statements";
113+
log_statement = "all";
114+
default_text_search_config = "pg_catalog.english";
115+
max_connections = 500;
92116
};
93-
in {
94-
# Unit tests configuration
95-
unit = {
96-
imports = [
97-
services-flake.processComposeModules.default
98-
ipfs
99-
anvil
100-
];
117+
};
118+
in {
119+
# Unit tests configuration
120+
unit = {
121+
imports = [
122+
services-flake.processComposeModules.default
123+
ipfs
124+
anvil
125+
];
101126

102-
cli = {
103-
environment.PC_DISABLE_TUI = true;
104-
options = {
105-
port = 8881;
106-
};
127+
cli = {
128+
environment.PC_DISABLE_TUI = true;
129+
options = {
130+
port = 8881;
107131
};
132+
};
108133

109-
services.postgres."postgres-unit" = mkPostgresConfig {
110-
name = "graph-test";
111-
port = 5432;
112-
dataDir = "./.data/unit/postgres";
113-
user = "graph";
114-
password = "graph";
115-
database = "graph-test";
116-
};
134+
services.postgres."postgres-unit" = mkPostgresConfig {
135+
name = "graph-test";
136+
port = 5432;
137+
dataDir = "./.data/unit/postgres";
138+
user = "graph";
139+
password = "graph";
140+
database = "graph-test";
141+
};
117142

118-
services.ipfs."ipfs-unit" = {
119-
enable = true;
120-
dataDir = "./.data/unit/ipfs";
121-
port = 5001;
122-
gateway = 8080;
123-
};
143+
services.ipfs."ipfs-unit" = {
144+
enable = true;
145+
dataDir = "./.data/unit/ipfs";
146+
port = 5001;
147+
gateway = 8080;
124148
};
149+
};
125150

126-
# Integration tests configuration
127-
integration = {
128-
imports = [
129-
services-flake.processComposeModules.default
130-
ipfs
131-
anvil
132-
];
151+
# Integration tests configuration
152+
integration = {
153+
imports = [
154+
services-flake.processComposeModules.default
155+
ipfs
156+
anvil
157+
];
133158

134-
cli = {
135-
environment.PC_DISABLE_TUI = true;
136-
options = {
137-
port = 8882;
138-
};
159+
cli = {
160+
environment.PC_DISABLE_TUI = true;
161+
options = {
162+
port = 8882;
139163
};
164+
};
140165

141-
services.postgres."postgres-integration" = mkPostgresConfig {
142-
name = "graph-node";
143-
port = 3011;
144-
dataDir = "./.data/integration/postgres";
145-
user = "graph-node";
146-
password = "let-me-in";
147-
database = "graph-node";
148-
};
166+
services.postgres."postgres-integration" = mkPostgresConfig {
167+
name = "graph-node";
168+
port = 3011;
169+
dataDir = "./.data/integration/postgres";
170+
user = "graph-node";
171+
password = "let-me-in";
172+
database = "graph-node";
173+
};
149174

150-
services.ipfs."ipfs-integration" = {
151-
enable = true;
152-
dataDir = "./.data/integration/ipfs";
153-
port = 3001;
154-
gateway = 3002;
155-
};
175+
services.ipfs."ipfs-integration" = {
176+
enable = true;
177+
dataDir = "./.data/integration/ipfs";
178+
port = 3001;
179+
gateway = 3002;
180+
};
156181

157-
services.anvil."anvil-integration" = {
158-
enable = true;
159-
package = pkgs.foundry-bin;
160-
port = 3021;
161-
timestamp = 1743944919;
162-
gasLimit = 100000000000;
163-
baseFee = 1;
164-
blockTime = 2;
165-
};
182+
services.anvil."anvil-integration" = {
183+
enable = true;
184+
package = pkgs.foundry-bin;
185+
port = 3021;
186+
timestamp = 1743944919;
187+
gasLimit = 100000000000;
188+
baseFee = 1;
189+
blockTime = 2;
166190
};
167191
};
168192
};
193+
};
169194
};
170195
}

nix/anvil.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
{ pkgs, lib, name, config, ... }:
21
{
2+
pkgs,
3+
lib,
4+
name,
5+
config,
6+
...
7+
}: {
38
options = {
49
package = lib.mkOption {
510
type = lib.types.package;

0 commit comments

Comments
 (0)