Skip to content

Commit

Permalink
2024.10.03
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuMoalic committed Oct 3, 2024
1 parent 2ef9851 commit 0949b15
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
10 changes: 7 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,19 @@
owner = "MathieuMoalic";
repo = "amumax";
rev = releaseVersion;
hash = "sha256-hrAigQ3VwreBqLh76CM//p6MiGw4obaKpC364ilQKQQ=";
hash = "sha256-cMJKWMPHpBdRN6q5YX0POx9TCMvz2oZOuzTjtBF/ffI="; # gh hash
};

ReleaseFrontend = buildFrontend {
src = "${ReleaseSrc}/frontend";
npmDepsHash = "sha256-bLImLy3SU9DfyzY+mdZr+cTP4NLHcz957G+ZLLA0/6I=";
npmDepsHash = "sha256-NNr/4Py+YlXK+fYDidYlygyHSuVg4dy2nYRGefX4MwA=";
version = releaseVersion;
};

ReleaseBuildAmumax = buildAmumax {
src = ReleaseSrc;
frontend = ReleaseFrontend;
vendorHash = "sha256-c3se+OjvhF+femBirB7YhudV/MYLjWVg3xow9z53KjI=";
vendorHash = "sha256-nCjAc54HKOeHlus9scYSq9OMnnsbsijLM/9wm5RGkTw=";
version = releaseVersion;
};

Expand All @@ -119,6 +119,10 @@
pkgs.golangci-lint
pkgs.gcc11
pkgs.nodejs_22
pkgs.nix-prefetch-github
pkgs.prefetch-npm-deps
pkgs.nix-prefetch
pkgs.jq
];

LD_LIBRARY_PATH = "${cuda.libcufft}/lib:${cuda.libcurand}/lib:/run/opengl-driver/lib/";
Expand Down
40 changes: 24 additions & 16 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
image:
podman build -t matmoa/amumax:build .

build_cuda:
podman run --rm -v $PWD:/src matmoa/amumax:build sh cuda/build_cuda.sh
build-cuda:
podman run --rm -v $PWD:/src matmoa/amumax:build sh src/cuda/build-cuda.sh

copy_pcss:
copy-pcss:
scp -r ./build/amumax pcss:grant_398/scratch/bin/amumax_versions/amumax$(date -I)
ssh pcss "cd ~/grant_398/scratch/bin && ln -sf amumax_versions/amumax$(date -I) amumax"

Expand All @@ -17,17 +17,25 @@ build-frontend:
docker.io/node:18.20.4-alpine3.20 -c 'npm install && npm run build && mv dist ../src/api/static'

build:
podman run --rm -v $PWD/src:/src matmoa/amumax:build

test:
podman run --rm -v $PWD/src:/src -it --device=nvidia.com/gpu=all -p 35367:35367 matmoa/amumax:build /src/build/amumax -d -i /src/mytest/t2.mx3

release: image build_cuda build-frontend build
VERSION=$(date -u +'%Y.%m.%d') && \
echo $VERSION && \
sed -i 's/releaseVersion = "[^"]*"/releaseVersion = "'"$VERSION"'"/' flake.nix && \
git add flake.nix flake.lock && \
git commit -m "Release of ${VERSION}" && \
git push && \
podman run --rm -v $PWD:/src matmoa/amumax:build

update-flake-hashes VERSION:
#!/usr/bin/env sh
set -euxo pipefail
sed -i 's/releaseVersion = "[^"]*"/releaseVersion = "'"{{VERSION}}"'"/' flake2.nix
GH_HASH=$(nix-prefetch-github MathieuMoalic amumax --rev {{VERSION}} | jq -r '.hash')
sed -i "/# gh hash/ s|hash = \".*\";|hash = \"$GH_HASH\";|" flake2.nix

NPM_HASH=$(prefetch-npm-deps frontend/package-lock.json)
sed -i "/# npm hash/ s|npmDepsHash = \".*\";|npmDepsHash = \"$NPM_HASH\";|" flake2.nix

release: image build-cuda build-frontend build
#!/usr/bin/env sh
VERSION=$(date -u +'%Y.%m.%d')
just update-flake $VERSION
git add flake.nix flake.lock
git commit -m "Release of ${VERSION}"
git push
gh release create $VERSION ./build/* --title $VERSION --notes "Release of ${VERSION}"
just copy_pcss
just copy-pcss

0 comments on commit 0949b15

Please sign in to comment.