Skip to content

Commit

Permalink
[WIP] Do not rebuild the site on linkcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitawootten-nist committed Sep 22, 2023
1 parent cf82d29 commit 456ddff
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:
pull_request: {}
workflow_dispatch:
inputs:
swap_size_gb:
description: The amount of swap to allocate
default: 10
required: false
type: number
ignore_linkcheck:
description: Ignore link checker results when deploying
required: false
Expand Down
28 changes: 19 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,40 @@ SHELL:=/usr/bin/env bash
help: ## Show this help message
@grep -E '^[a-zA-Z_-]+:.*?##.*$$' $(MAKEFILE_LIST) | awk 'BEGIN { \
FS = ":.*?## "; \
printf "\033[1m%-30s\033[0m %s\n", "TARGET", "DESCRIPTION" \
printf "\033[1m%-30s %s\033[0m\n", "TARGET", "DESCRIPTION" \
} \
{ printf "\033[32m%-30s\033[0m %s\n", $$1, $$2 }'

.PHONY: clean
clean: clean-modeldoc clean-site clean-release-assets ## Clean all
clean: clean-modeldoc clean-site clean-release-assets clean-linkcheck ## Clean all

#
# Website generation / hugo
#

# Override REVISIONS to build a subset of the site or a special branch
# (e.g. `make site REVISIONS='v1.1.0 my-special-branch'`)
REVISIONS:=develop $(shell ./support/list_revisions.sh)

MODELDOC_CONTENT_DIR:=site/content/models
MODELDOC_REVISION_CONTENT_DIR:=$(patsubst %,$(MODELDOC_CONTENT_DIR)/%/,$(REVISIONS))
MODELDOC_DATA_DIR:=site/data/models
MODELDOC_REVISION_DATA_DIR:=$(patsubst %,$(MODELDOC_DATA_DIR)/%/,$(REVISIONS))
SITE_OUTPUT:=site/public
SITE_OUTPUT_DIR:=site/public

.PHONY: serve
serve: modeldoc release-assets ## Spin up a static web server for local dev
cd site; hugo serve

.PHONY: site
site: $(SITE_OUTPUT) ## Build the site
site: $(SITE_OUTPUT_DIR) ## Build the site

$(SITE_OUTPUT): modeldoc release-assets
$(SITE_OUTPUT_DIR): $(MODELDOC_REVISION_CONTENT_DIR) $(RELEASE_ASSET_REDIRECTS_DIR)
cd site; hugo --minify

.PHONY: clean-site
clean-site: ## Clean the site
rm -fr $(SITE_OUTPUT)
rm -fr $(SITE_OUTPUT_DIR)

#
# Model documentation
Expand Down Expand Up @@ -68,12 +71,13 @@ $(RELEASE_ASSET_REDIRECTS_DIR):

.PHONY: clean-release-assets
clean-release-assets: ## Clean release redirects
rm -fr site/content/release-assets/latest/
rm -fr $(RELEASE_ASSET_REDIRECTS_DIR)

#
# Checks
#

LYCHEE_OUTPUT_FILE:=lychee_report.md
LYCHEE_IGNORE_FILE:=./support/lychee_ignore.txt
LYCHEE_CONFIG_FILE:=./support/lychee.toml
# Flags that currently cannot be configured via the configuration file
Expand All @@ -82,9 +86,15 @@ LYCHEE_FLAGS:=--verbose --format markdown
LYCHEE_EXTRA_FLAGS:=

.PHONY: linkcheck
linkcheck: site
linkcheck: $(LYCHEE_OUTPUT_FILE) ## Generate a report of all site links

$(LYCHEE_OUTPUT_FILE): $(SITE_OUTPUT_DIR)
lychee \
--exclude-file '$(LYCHEE_IGNORE_FILE)' \
--config '$(LYCHEE_CONFIG_FILE)' \
--output $(LYCHEE_OUTPUT_FILE) \
$(LYCHEE_FLAGS) $(LYCHEE_EXTRA_FLAGS) \
'$(SITE_OUTPUT)/**/*.html'
'$(SITE_OUTPUT_DIR)/**/*.html'

clean-linkcheck: ## Clean the linkcheck report
rm -f $(LYCHEE_OUTPUT_FILE)
1 change: 0 additions & 1 deletion support/lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ accept = [200, 206, 429]

cache = true

output = "lychee_report.md"
# format = "markdown" # currently does not exist, must specify --format markdown

0 comments on commit 456ddff

Please sign in to comment.