Skip to content

Commit

Permalink
fix crane
Browse files Browse the repository at this point in the history
  • Loading branch information
NexVeridian committed Sep 16, 2024
1 parent d87d4fb commit 2cb8142
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 27 deletions.
1 change: 0 additions & 1 deletion .github/workflows/crane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:

env:
CARGO_TERM_COLOR: always
NIX_CONFIG: 'download-buffer-size = 5000MB'

jobs:
check:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ env:
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
NIX_CONFIG: 'download-buffer-size = 5000MB'

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rand = "0.8"

[dev-dependencies]
rstest = "0.22"
surrealdb-alpha = { version = "2.0.9", features = ["kv-mem"] }
surrealdb-beta = { version = "2.0.2", features = ["kv-mem"] }
criterion = { version = "0.5", features = ["async_tokio"] }
pprof = { version = "0.13", features = ["criterion", "protobuf-codec"] }

Expand Down
2 changes: 1 addition & 1 deletion docker-compose-surrealdb.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
surrealdb:
container_name: surrealdb
image: surrealdb/surrealdb:v2.0.0-alpha.9
image: surrealdb/surrealdb:v2.0.0-beta.2
env_file:
- .env
entrypoint:
Expand Down
23 changes: 9 additions & 14 deletions flake.lock

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

22 changes: 16 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";

fenix = {
url = "github:nix-community/fenix";
Expand All @@ -31,8 +28,21 @@
inherit (pkgs) lib;

craneLib = crane.mkLib pkgs;

# src = craneLib.cleanCargoSource ./.;
src = ./.;
# src = ./.;
src =
let
jsonFilter = path: _type: builtins.match ".*json$" path != null;
surqlFilter = path: _type: builtins.match ".*surql$" path != null;
customFilter = path: type:
(jsonFilter path type) || (surqlFilter path type) || (craneLib.filterCargoSources path type);
in
pkgs.lib.cleanSourceWith {
src = ./.;
filter = customFilter;
name = "source";
};

# Common arguments can be set here to avoid repeating them later
commonArgs = {
Expand Down Expand Up @@ -125,7 +135,7 @@

packages = {
default = my-crate;
dockerImage = dockerImage;
inherit my-crate dockerImage;
};

apps.default = flake-utils.lib.mkApp {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async fn main() -> Result<(), Error> {
None::<Surreal<Client>>,
reader,
Some(pb.clone()),
500,
1_000,
1_000,
)
.await?;
Expand Down
2 changes: 2 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ impl CreateVersion {

let file_path = format!("data/temp/{}.surql", file_name);

tokio::fs::create_dir_all("data/temp").await?;

db_mem.export(&file_path).await?;
db.import(&file_path).await?;

Expand Down

0 comments on commit 2cb8142

Please sign in to comment.