Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp build process #56

Merged
merged 92 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
f28b595
chore: Add submodule cc-admin-documents under src-documents
ribose-jeffreylau Jan 27, 2025
b87f478
chore: Add 54 cc-* repos as submodules
ribose-jeffreylau Jan 27, 2025
07f00a0
chore: Add scripts to query all cc-* repos within CalConnect, and to …
ribose-jeffreylau Jan 27, 2025
29994fa
chore: Add nix flake for external dependencies
ribose-jeffreylau Jan 27, 2025
cade59b
chore: Add .tool-versions for Ruby version control
ribose-jeffreylau Jan 27, 2025
aa8e520
chore: Add nix flake-direnv support
ribose-jeffreylau Jan 27, 2025
2dc68ba
wip: Revamp build process
ribose-jeffreylau Jan 27, 2025
4d3a0e0
wip: Transition to metanorma site generate
ribose-jeffreylau Jan 27, 2025
651b259
wip: Bring back jekyll. Still needed for the scaffolding.
ribose-jeffreylau Jan 27, 2025
978099f
wip: Transition to metanorma site generate
ribose-jeffreylau Jan 27, 2025
c29945f
chore(gitignore): Add more to ignore
ribose-jeffreylau Jan 27, 2025
c0fd5a8
chore: Add yq to flakes
ribose-jeffreylau Jan 27, 2025
f858f5d
chore(scripts): Add get-all-doc-paths-of-type
ribose-jeffreylau Jan 27, 2025
2ce845a
chore: Makescripts/get-all-doc-paths-of-type filter by mn-document-cl…
ribose-jeffreylau Jan 28, 2025
ad0321f
chore: Add scrips/repopulate-metanorma-yaml
ribose-jeffreylau Jan 28, 2025
3ef8c60
chore: Re-populate metanorma-admin.yml
ribose-jeffreylau Jan 28, 2025
6cbf6d0
chore: Re-populate metanorma-standards.yml
ribose-jeffreylau Jan 28, 2025
9a01a4c
fixup
ribose-jeffreylau Jan 28, 2025
39680fa
chore: Update Gem dependencies
ribose-jeffreylau Jan 28, 2025
212684f
chore: Add missing unitsml dependency for metanorma
ribose-jeffreylau Jan 28, 2025
90345a0
wip: Clean up makefile
ribose-jeffreylau Jan 28, 2025
70f202a
ci: Build the admin and standards documents
ribose-jeffreylau Jan 28, 2025
779d97a
Revert "chore: Update Gem dependencies"
ribose-jeffreylau Jan 28, 2025
fb0ef9f
Revert "chore: Add missing unitsml dependency for metanorma"
ribose-jeffreylau Jan 28, 2025
ffe9caa
Revert "Revert "chore: Update Gem dependencies""
ribose-jeffreylau Jan 28, 2025
92d7562
Revert "Revert "chore: Add missing unitsml dependency for metanorma""
ribose-jeffreylau Jan 28, 2025
5f6900d
chore: Separate Gemfile by env var to make metanorma and jekyll coexi…
ribose-jeffreylau Feb 3, 2025
cf655ce
chore(jekyll): Ignore git submodules directory
ribose-jeffreylau Feb 3, 2025
a8894e9
fix(jekyll/sass): Make main.scss compile in Jekyll
ribose-jeffreylau Feb 3, 2025
c6ab1de
chore(sass): Fix deprecation warnings
ribose-jeffreylau Feb 3, 2025
c2202de
chore(sass): Fix aftermath of @import => @use migration
ribose-jeffreylau Feb 3, 2025
a55bf85
chore(sass): Fix missing calc() from deprecation migration
ribose-jeffreylau Feb 3, 2025
df94228
ci: Try to parallelize document build process
ribose-jeffreylau Feb 3, 2025
3f357db
ci: Add docs on job splitting
ribose-jeffreylau Feb 3, 2025
b54a7c4
fix(sass): Work around a SASS build error
ribose-jeffreylau Feb 3, 2025
09f6ecb
fix(sass): Use a simpler workaround for the SASS import error
ribose-jeffreylau Feb 3, 2025
4fe4429
ci: Add missing JEKYLL=1 env var for jekyll job
ribose-jeffreylau Feb 3, 2025
bfa880a
chore(sass): Fix more deprecation warnings
ribose-jeffreylau Feb 4, 2025
b7ef1e8
chore(jekyll): Ignore scripts/ directory
ribose-jeffreylau Feb 4, 2025
9753279
chore: Make metanorma site generate replace _site/{standards,administ…
ribose-jeffreylau Feb 4, 2025
74217c6
chore(Makefile): Remove duplicated task
ribose-jeffreylau Feb 4, 2025
3b365fa
chore(Makefile): Add build-parallel and build-all-parallel for local dev
ribose-jeffreylau Feb 4, 2025
4fa3e81
ci: Reverse build dependencies to try to make Jekyll not remove metan…
ribose-jeffreylau Feb 4, 2025
7255465
ci: Make jobs share artifacts
ribose-jeffreylau Feb 4, 2025
ca42a1c
wip(ci): Add debug logs
ribose-jeffreylau Feb 4, 2025
5779ffb
ci: Fix merging of artifacts
ribose-jeffreylau Feb 5, 2025
c6e2255
ci: Debug ENV
ribose-jeffreylau Feb 5, 2025
2c14b54
Revert "ci: Debug ENV"
ribose-jeffreylau Feb 5, 2025
38e66d0
ci: Fix artifacts paths
ribose-jeffreylau Feb 5, 2025
d02f8dd
ci: Add metacacher
ribose-jeffreylau Feb 4, 2025
65a35aa
ci(metacacher): Use Ruby hash_files script
ribose-jeffreylau Feb 5, 2025
84a189a
ci(hash_files): Use STDERR for logs
ribose-jeffreylau Feb 5, 2025
d45e6bf
ci(metacacher): Translate {bash => ruby}
ribose-jeffreylau Feb 5, 2025
cbbad86
ci(metacacher): Allow override of hash_files by $HASH_FILES_BIN
ribose-jeffreylau Feb 5, 2025
4948df1
ci(metacacher): Calculate hash depending on actual GitHub workflow file
ribose-jeffreylau Feb 5, 2025
6437343
ci(metacacher): Make hashes more stable
ribose-jeffreylau Feb 5, 2025
37ef421
ci(metacacher): Print out hash in segments
ribose-jeffreylau Feb 5, 2025
6cdc413
ci(metacacher): Format
ribose-jeffreylau Feb 5, 2025
cd6a1e5
ci: Try to implement caching to sub-parts of site
ribose-jeffreylau Feb 5, 2025
1b38c8e
ci(build_deploy): Fix checkout options
ribose-jeffreylau Feb 5, 2025
77d175b
chore: Fix updated metanorma-cc link
ribose-jeffreylau Feb 5, 2025
f8fdacf
chore(Gemfile): Remove explicit dependency on unitsml
ribose-jeffreylau Feb 5, 2025
8002c94
ci: Fix deprecated usage of set-output
ribose-jeffreylau Feb 5, 2025
c34e26d
chore: Remove _input/{admin.yaml,csd}
ribose-jeffreylau Feb 5, 2025
6995267
chore(hash_files): Make it clear that missing files are not fatal
ribose-jeffreylau Feb 5, 2025
f975485
chore: Align metanorma YAML file names with doc types
ribose-jeffreylau Feb 5, 2025
d7a257e
chore: Make metanorma minisites use CalConnect styles
ribose-jeffreylau Feb 6, 2025
b33d52f
chore(minisite): Remove most references to `page` and `site`
ribose-jeffreylau Feb 6, 2025
44874e5
fix(minisite): Fix styling
ribose-jeffreylau Feb 6, 2025
49dc9ff
fix(minisite): Fix nav menu via javascript links
ribose-jeffreylau Feb 6, 2025
adcda07
fix(minisite): Fix footer links by removing dysfunctional variables
ribose-jeffreylau Feb 6, 2025
59edbdd
chore(minisite): Remove unused liquid interpolations
ribose-jeffreylau Feb 6, 2025
519e3c0
fix(minisite): Fix rendering of doc type
ribose-jeffreylau Feb 6, 2025
79235b0
chore(minisite): Fix "public-review" and add "pending-publication"
ribose-jeffreylau Feb 6, 2025
da59bca
wip:docs(README): Update instructions
ribose-jeffreylau Feb 6, 2025
3adad98
fix: build gha administrative documents
ronaldtse Feb 6, 2025
f27b5c2
fix: typo of "metanormal"
ronaldtse Feb 6, 2025
0a47a96
ci/wip: Remove debug logs
ribose-jeffreylau Feb 6, 2025
be13b51
fix(minisite): Hide nav bar under a smaller threshold
ribose-jeffreylau Feb 6, 2025
0d88456
chore(minisite): Simplify index page heading
ribose-jeffreylau Feb 6, 2025
d781aab
chore(minisite): Fix nav menu links
ribose-jeffreylau Feb 6, 2025
8449331
chore(minisite): Fix `make repopulate-metanorma-yamls` for doc types …
ribose-jeffreylau Feb 6, 2025
6e88333
chore(ci): Rename metacacher => metacachekey
ribose-jeffreylau Feb 6, 2025
f7f264b
chore(css): DRY up responsive screen width definitions
ribose-jeffreylau Feb 6, 2025
99eba6a
chore(minisite): Add sections `reports`/`specifications`/`directives`
ribose-jeffreylau Feb 6, 2025
9501e39
ci: Add build process for pending-publication and public-review
ribose-jeffreylau Feb 6, 2025
abebbc1
ci: Add build process for report/specification/directive
ribose-jeffreylau Feb 6, 2025
59527e9
ci(metacachekey): Look into metanorma.template.{path,stylesheet} for …
ribose-jeffreylau Feb 6, 2025
128dc6b
Revert "fix(minisite): Hide nav bar under a smaller threshold"
ribose-jeffreylau Feb 6, 2025
bce77aa
chore(index): Show links to reports/specifications/directives
ribose-jeffreylau Feb 6, 2025
74c2ce1
chore(nav): Show extra links only in mobile nav
ribose-jeffreylau Feb 6, 2025
8bc1d42
chore(nav): Always show hamburger toggle
ribose-jeffreylau Feb 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
344 changes: 340 additions & 4 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,357 @@ concurrency:
cancel-in-progress: false

jobs:
build:
#
# For each document category (administrative, standard, etc.),
# build using `metanorma site generate`.
#
# At the very end, integrate them all with Jekyll.
#
# NOTE: Try to parallelize the build process as much as possible.
# This is currently done by building the admin and standard docs in
# parallel.
#
build-pending-publication:
name: Build pending-publication docs
needs: build-site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
- name: Calculate cache key
id: cache-key
run: |
echo "cache-key=$(scripts/metacachekey metanorma metanorma-pending-publication.yml)" >> $GITHUB_OUTPUT
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
path: _site/pending-publication
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Use Ruby
if: steps.cache.outputs.cache-hit != 'true'
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build site
if: steps.cache.outputs.cache-hit != 'true'
run: |
make build-pending-publication
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: pending-publication-docs
path: _site/pending-publication

build-public-review:
name: Build public-review docs
needs: build-site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
- name: Calculate cache key
id: cache-key
run: |
echo "cache-key=$(scripts/metacachekey metanorma metanorma-public-review.yml)" >> $GITHUB_OUTPUT
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
path: _site/public-review
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Use Ruby
if: steps.cache.outputs.cache-hit != 'true'
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build site
if: steps.cache.outputs.cache-hit != 'true'
run: |
make build-public-review
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: public-review-docs
path: _site/public-review

build-administrative:
name: Build administrative docs
needs: build-site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
- name: Calculate cache key
id: cache-key
run: |
echo "cache-key=$(scripts/metacachekey metanorma metanorma-administrative.yml)" >> $GITHUB_OUTPUT
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
path: _site/administrative
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Use Ruby
if: steps.cache.outputs.cache-hit != 'true'
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build site
if: steps.cache.outputs.cache-hit != 'true'
run: |
make build-administrative
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: administrative-docs
path: _site/administrative

build-specification:
name: Build specification docs
needs: build-site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
- name: Calculate cache key
id: cache-key
run: |
echo "cache-key=$(scripts/metacachekey metanorma metanorma-specification.yml)" >> $GITHUB_OUTPUT
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
# 'specifications' instead of 'specification' to match link in index.adoc
path: _site/specifications
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Use Ruby
if: steps.cache.outputs.cache-hit != 'true'
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build site
if: steps.cache.outputs.cache-hit != 'true'
run: |
make build-specification
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: specification-docs
# 'specifications' instead of 'specification' to match link in index.adoc
path: _site/specifications

build-report:
name: Build report docs
needs: build-site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
- name: Calculate cache key
id: cache-key
run: |
echo "cache-key=$(scripts/metacachekey metanorma metanorma-report.yml)" >> $GITHUB_OUTPUT
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
# 'reports' instead of 'report' to match link in index.adoc
path: _site/reports
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Use Ruby
if: steps.cache.outputs.cache-hit != 'true'
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build site
if: steps.cache.outputs.cache-hit != 'true'
run: |
make build-report
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: report-docs
# 'reports' instead of 'report' to match link in index.adoc
path: _site/reports

build-directive:
name: Build directive docs
needs: build-site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
- name: Calculate cache key
id: cache-key
run: |
echo "cache-key=$(scripts/metacachekey metanorma metanorma-directive.yml)" >> $GITHUB_OUTPUT
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
# 'directives' instead of 'directive' to match link in index.adoc
path: _site/directives
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Use Ruby
if: steps.cache.outputs.cache-hit != 'true'
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build site
if: steps.cache.outputs.cache-hit != 'true'
run: |
make build-directive
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: directive-docs
# 'directives' instead of 'directive' to match link in index.adoc
path: _site/directives

build-standard:
name: Build standard docs
needs: build-site
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the approach now to build 3 sites independently and then combining them in the directory to publish? Are we able to use the CalConnect styling for the metanorma mini-sites?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the approach now to build 3 sites independently and then combining them in the directory to publish?

Yes.

Are we able to use the CalConnect styling for the metanorma mini-sites?

Not at the moment. Will investigate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this approach requires a set of .liquid templates (via relaton, via metanorma-cli) for the CalConnect style. If there exists none, I'll create them...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observation: {% include tag as used in Jekyll is not available in Relaton, as it is specific to Jekyll: https://github.com/jekyll/jekyll/blob/master/lib/jekyll/tags/include.rb

Meanwhile, Relaton uses straight liquid.

This makes the current set of Jekyll _includes and _layouts unreusable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case you are not aware of the original approach, which is to build the documents, and input the Relaton Bib YAML files into Jekyll to render the site. This way Jekyll reads the Relaton files as native "data files".

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
- name: Calculate cache key
id: cache-key
run: |
echo "cache-key=$(scripts/metacachekey metanorma metanorma-standard.yml)" >> $GITHUB_OUTPUT
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
# 'standards' instead of 'standard' to match link in index.adoc
path: _site/standards
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Use Ruby
if: steps.cache.outputs.cache-hit != 'true'
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build site
if: steps.cache.outputs.cache-hit != 'true'
run: |
make build-standard
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: standard-docs
# 'standards' instead of 'standard' to match link in index.adoc
path: _site/standards

build-site:
name: Build site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
- name: Calculate cache key
id: cache-key
run: |
echo "cache-key=$(scripts/metacachekey jekyll _config.yml)" >> $GITHUB_OUTPUT
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
path: _site
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Use Ruby
if: steps.cache.outputs.cache-hit != 'true'
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
bundler-cache: true
bundler: '2.2.31'
env:
JEKYLL: 1
- name: Build site
if: steps.cache.outputs.cache-hit != 'true'
run: |
make _site
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: jekyll-site
path: _site

upload-artifact:
name: Upload pages artifact
needs:
- build-site
- build-administrative
- build-directive
- build-pending-publication
- build-public-review
- build-report
- build-specification
- build-standard
runs-on: ubuntu-latest
steps:
# NOTE: Order is important.
# Downloading _site/ first ensures metanorma-generated docs are not
# overwritten.
- name: Download Jekyll artifacts
uses: actions/download-artifact@v4
with:
name: jekyll-site
path: _site
- name: Download Directive docs artifacts
uses: actions/download-artifact@v4
with:
name: directive-docs
# 'directives' instead of 'directive' to match link in index.adoc
path: _site/directives
- name: Download Report docs artifacts
uses: actions/download-artifact@v4
with:
name: report-docs
# 'reports' instead of 'report' to match link in index.adoc
path: _site/reports
- name: Download Specification docs artifacts
uses: actions/download-artifact@v4
with:
name: specification-docs
# 'specifications' instead of 'specification' to match link in index.adoc
path: _site/specifications
- name: Download Public Review docs artifacts
uses: actions/download-artifact@v4
with:
name: public-review-docs
path: _site/public-review
- name: Download Pending Publication docs artifacts
uses: actions/download-artifact@v4
with:
name: pending-publication-doc
path: _site/pending-publication
- name: Download Standard docs artifacts
uses: actions/download-artifact@v4
with:
name: standard-docs
# 'standards' instead of 'standard' to match link in index.adoc
path: _site/standards
- name: Download Administrative docs artifacts
uses: actions/download-artifact@v4
with:
name: administrative-docs
path: _site/administrative
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v3
Expand All @@ -46,7 +381,8 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
needs: build
# needs: [build-admin, build-standards]
needs: upload-artifact
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Direnv
.direnv/

# Relaton
relaton
iev

# Metanorma / jekyll
*.err.html
*.abort
_site
.sass-cache
.jekyll-cache/
Expand All @@ -12,3 +22,6 @@ bib/
bibcoll/
csd/
.vscode/

# This is not a Gem, so lock file should be checked in.
# Gemfile.lock
Loading
Loading