Verified Commit e58c814c authored by doshitan's avatar doshitan

Add linkchecking to build and sync process

parent 6ef4b1f5
......@@ -24,25 +24,34 @@ in rec {
cp $(echo $srcs | cut -d ' ' -f 1) ./makefile
cp -a $(echo $srcs | cut -d ' ' -f 2)/. content
'';
phases = [ "unpackPhase" "buildPhase" ];
phases = [ "unpackPhase" "buildPhase" "checkPhase" ];
buildInputs = contentBuildInputs ++ [
executable search-app
];
doCheck = true;
LOCALE_ARCHIVE = pkgs.stdenv.lib.optionalString pkgs.stdenv.isLinux
"${pkgs.glibcLocales}/lib/locale/locale-archive";
LANG = "en_US.UTF-8";
LC_TYPE = "en_US.UTF-8";
SITE_CMD = "${executable}/bin/site";
buildPhase = ''
export DEST_DIR=$out
export CONTENT_DIR=./content
export LUNR_FILE=${contentLunrFile}
export SEARCH_APP_FILE=${search-app}/SearchMain.js
export COMPILED_CLAY_FILE=${doshitan-css}
site rebuild
make content-rebuild
make version-assets
'';
checkPhase = ''
export DEST_DIR=$out
make content-check-internal
'';
};
build-search-index = pkgs.stdenv.mkDerivation rec {
......@@ -116,5 +125,5 @@ in rec {
'';
};
ciInputs = [ pkgs.awscli pkgs.bash pkgs.git pkgs.gnumake pkgs.parallel pkgs.s3cmd ];
ciInputs = [ pkgs.awscli pkgs.bash pkgs.coreutils pkgs.git pkgs.gnumake pkgs.linkchecker pkgs.parallel pkgs.s3cmd ];
}
......@@ -3,6 +3,8 @@ export CACHE_DIR ?= $(abspath _cache)
export TMP_DIR ?= $(abspath _cache/tmp)
export CONTENT_DIR ?= $(abspath content)
SITE_CMD ?= cabal new-run doshitan-site --
build:
cabal new-build doshitan-site
......@@ -10,7 +12,7 @@ clean:
cabal new-clean doshitan-site
content-build:
cabal new-run doshitan-site -- build
$(SITE_CMD) build
content-build-prod: | drafts-unlink content-rebuild
......@@ -18,13 +20,22 @@ content-build-nix: | drafts-unlink
nix-build -A content
content-clean:
cabal new-run doshitan-site -- clean
$(SITE_CMD) clean
content-check-internal:
$(SITE_CMD) check --internal-links
content-check-all:
TMPFILE=$$(mktemp); \
trap 'rm -rf "$$TMPFILE"' EXIT; \
echo -e "[checking]\nlocalwebroot=$(DEST_DIR)/" > "$$TMPFILE"; \
linkchecker --config $$TMPFILE $(DEST_DIR)/ --check-extern
content-rebuild:
cabal new-run doshitan-site -- rebuild
$(SITE_CMD) rebuild
content-watch:
cabal new-run doshitan-site -- watch
$(SITE_CMD) watch
copy-to-ci:
nix copy --to $(CI_SERVER) $$(nix-store -qR --include-outputs $$(nix-instantiate --quiet -Q -A content))
......
......@@ -10,4 +10,4 @@ export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
export LC_ALL="en_US.UTF-8"
nix-build -A content
DEST_DIR=result nix run -f . ciInputs -c make sync
DEST_DIR=result nix run -f . ciInputs -c make sync content-check-all
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment