Skip to content

Commit

Permalink
Align build with OSCAL Reference (#63)
Browse files Browse the repository at this point in the history
* Replace submodule with Hugo module
* Added makefile for hugo and lychee operations
  • Loading branch information
nikitawootten-nist committed Nov 21, 2023
1 parent 7ec0414 commit ba7749a
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 33 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/config/.lycheeignore

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/workflow-generate-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: recursive
fetch-depth: 0
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
Expand Down Expand Up @@ -98,7 +97,7 @@ jobs:
- name: Check Links
uses: lycheeverse/lychee-action@76ab977fedbeaeb32029313724a2e56a8a393548
with:
args: --exclude-file ./.github/workflows/config/.lycheeignore --verbose --no-progress --accept 200,206,429 './website/**/*.html' --exclude-mail
args: --config ./src/lychee.toml './website/**/*.html'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save Report
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
node_modules/
src/public
src/resources/_gen

lychee_report.md
.hugo_build.lock
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

58 changes: 58 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
SHELL:=/usr/bin/env bash

.PHONY: help
# Run "make" or "make help" to get a list of user targets
# Adapted from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## Show this help message
@grep -E '^[a-zA-Z_-]+:.*?##.*$$' $(MAKEFILE_LIST) | awk 'BEGIN { \
FS = ":.*?## "; \
printf "\033[1m%-30s %s\033[0m\n", "TARGET", "DESCRIPTION" \
} \
{ printf "\033[32m%-30s\033[0m %s\n", $$1, $$2 }'

.PHONY: clean
clean: clean-site clean-linkcheck ## Clean all

#
# Website generation / hugo
#

SITE_OUTPUT_DIR:=src/public

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

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

$(SITE_OUTPUT_DIR):
cd src; hugo --minify

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

#
# Checks
#

LYCHEE_OUTPUT_FILE:=lychee_report.md
LYCHEE_CONFIG_FILE:=./src/lychee.toml
# Flags that currently cannot be configured via the configuration file
LYCHEE_FLAGS:=--verbose --format markdown
# Extra flags for the user to override (used to set github token in GHA workflow)
LYCHEE_EXTRA_FLAGS:=

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

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

clean-linkcheck: ## Clean the linkcheck report
rm -f $(LYCHEE_OUTPUT_FILE)
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,11 @@ If you have any questions about OSCAL in general or if you would like to get inv
Run the following Git command to clone the OSCAL-Pages repository, and you can begin editing content without any special setup.

```sh
git clone --recurse-submodules https://github.com/usnistgov/OSCAL-Pages.git
git clone https://github.com/usnistgov/OSCAL-Pages.git
```

The website content in this repository is generated into the full website with [Hugo](https://gohugo.io/). If you wish to run the website locally, you can either install hugo, or use Docker and docker-compose.

## Initializing for Development

This repository uses submodules to load design elements required by the website. You can initialize these submodules with the command inside the cloned repository:

```sh
cd OSCAL-Pages
git submodule update --init --recursive
```

## Using Hugo

In terminal:
Expand Down
3 changes: 2 additions & 1 deletion src/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ languages:
languageName: English
weight: 1
MetaDataFormat: "yaml"
theme: "uswds"
googleAnalytics: UA-66610693-1
enableGitInfo: true
pygmentsCodeFences: true
Expand Down Expand Up @@ -43,6 +42,8 @@ menu:
url: https://github.com/usnistgov/OSCAL
weight: 90
module:
imports:
- path: github.com/usnistgov/hugo-uswds
mounts:
# - source: content
# target: content
Expand Down
5 changes: 5 additions & 0 deletions src/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/usnistgov/OSCAL-Pages/src

go 1.20

require github.com/usnistgov/hugo-uswds v1.0.0 // indirect
2 changes: 2 additions & 0 deletions src/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/usnistgov/hugo-uswds v1.0.0 h1:6Nwrs4XWOkxOheWWM8VTEl6aMM7cLQUNv0chuUokB8o=
github.com/usnistgov/hugo-uswds v1.0.0/go.mod h1:MkgH5fvt5GIZo70VkBav+wP6br+MzrD/+OMZ9EqDkHM=
22 changes: 22 additions & 0 deletions src/lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
no_progress = true
exclude_mail = true
accept = [200, 206, 429]
exclude = [
'https://defense.gov/',
'https://federal-agency.gov/.*',
'http://federal-agency.gov/ns/oscal',
'http://fedramp.gov/ns/oscal',
'https://fedramp.gov/ns/oscal',
'http://www.first.org/cvss/v2.0',
'http://www.first.org/cvss/v3.0',
'http://www.first.org/cvss/v3.1',
'https://tools.ietf.org/html.*',
'http://csrc.nist.gov/ns/.*',
'http://csrc.nist.gov/oscal',
'https://csrc.nist.gov/projects/cryptographic-module-validation-program/certificate/xxxx',
'https://cdn.telos.com/wp-content/uploads/2021/06/22150746/Xacta-360-EULA-US.pdf',
'https://search.usa.gov/search',
'https://example.com/.*',
'https://doi.org/.*',
'http://doi.org/.*',
]
1 change: 0 additions & 1 deletion src/themes/uswds
Submodule uswds deleted from 96c1d7

0 comments on commit ba7749a

Please sign in to comment.