diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000..d4e8e0ec --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,55 @@ +name: Build and Deploy the Schema Browser + +"on": + merge_group: {} + pull_request: {} + push: + branches-ignore: + # These should always correspond to pull requests, so ignore them for + # the push trigger and let them be triggered by the pull_request + # trigger, avoiding running the workflow twice. This is a minor + # optimization so there's no need to ensure this is comprehensive. + - "dependabot/**" + - "gh-readonly-queue/**" + - "renovate/**" + - "tickets/**" + - "u/**" + release: + types: [published] + +jobs: + + docs: + + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # full history for setuptools_scm + + - name: Install Ruby and other prerequisites + run: sudo apt-get install -y ruby-full build-essential zlib1g-dev + + - name: Install required Ruby gems + run: sudo gem install bundler jekyll jekyll-theme-cayman jekyll-last-modified-at + + - name: Build the schema browser site + run: jekyll build + + # Only attempt documentation uploads for tagged releases and pull + # requests from ticket branches in the same repository. This avoids + # version clutter in the docs and failures when a PR doesn't have access + # to secrets. + - name: Upload to LSST the Docs + uses: lsst-sqre/ltd-upload@v1 + with: + project: "sdm-schemas" + dir: "_site" + username: ${{ secrets.LTD_USERNAME }} + password: ${{ secrets.LTD_PASSWORD }} + if: > + github.event_name != 'merge_group' + && (github.event_name != 'pull_request' + || startsWith(github.head_ref, 'tickets/')) diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..6d02f880 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +# Makefile for building the SDM Schemas browser site +.PHONY: help init run build clean + +# Print help +help: + @echo "Available targets for sdm_schemas:" + @echo " init - Install the required Ruby gems" + @echo " build - Build the schema browser site" + @echo " run - Serve the schema browser site" + @echo " clean - Clean the schema browser site" + +# Install required Ruby gems (Ruby must be installed externally.) +init: + @command -v gem >/dev/null 2>&1 || { \ + echo >&2 "gem command not found. Please install Ruby using your package manager."; \ + echo >&2 "For more information, visit: https://jekyllrb.com/docs/installation"; \ + exit 1; \ + } + gem install -q --silent --no-verbose jekyll bundler jekyll-theme-cayman jekyll-last-modified-at + +# Run the web server and watch for changes +run: + jekyll serve --watch + +# Build the site +build: + jekyll build + +# Cleanup local config and remove the generated site +clean: + jekyll clean && rm -rf _site &> /dev/null diff --git a/_config.yml b/_config.yml index 356873bc..a28d5bc8 100644 --- a/_config.yml +++ b/_config.yml @@ -1,11 +1,35 @@ theme: jekyll-theme-cayman +plugins: + - jekyll-last-modified-at +last-modified-at: + date-format: '%B %d, %Y' + data_dir: ./yml -layouts_dir: ./browser/_layouts +layouts_dir: _layouts +source: ./browser +baseurl: "" + +repository_url: "https://github.com/lsst/sdm_schemas" +repository_name: "SDM Schemas" +owner_url: "https://rubinobservatory.org/" +owner_name: "Rubin Observatory" + exclude: - Gemfile - /datalink - /tap-schema - /ups - /yml + - Makefile + - README.md + - requirements.txt + - yml/archive + readme_index: remove_originals: true + +safe: false + +sass: + sass_dir: _sass + # style: compressed diff --git a/browser/_includes/_footer.html b/browser/_includes/_footer.html new file mode 100644 index 00000000..9fc18384 --- /dev/null +++ b/browser/_includes/_footer.html @@ -0,0 +1,7 @@ +
+ +

+ {{ site.repository_name }} is maintained by + {{ site.owner_name }}. +

+ diff --git a/browser/_includes/_header.html b/browser/_includes/_header.html new file mode 100644 index 00000000..c77e6fd0 --- /dev/null +++ b/browser/_includes/_header.html @@ -0,0 +1,7 @@ + +{% seo %} + + + + + diff --git a/browser/_includes/_logo.html b/browser/_includes/_logo.html new file mode 100644 index 00000000..316f15e7 --- /dev/null +++ b/browser/_includes/_logo.html @@ -0,0 +1,3 @@ + + + diff --git a/browser/_includes/_schema_list.html b/browser/_includes/_schema_list.html new file mode 100644 index 00000000..c649e4cb --- /dev/null +++ b/browser/_includes/_schema_list.html @@ -0,0 +1,13 @@ + diff --git a/browser/_layouts/schema.html b/browser/_layouts/schema.html index 8796443d..102abc88 100644 --- a/browser/_layouts/schema.html +++ b/browser/_layouts/schema.html @@ -1,17 +1,15 @@ - - -{% seo %} - - - + {% include _header.html %}
+ + +

{{ page.title }}

{{ content }} @@ -41,7 +42,9 @@

{{ table.name }}

{%- for col in table.columns %} - {{ col.name }} + + {{ col.name }} + {{ col.datatype }} {{ col['ivoa:unit'] | default: col['fits:tunit'] }} @@ -53,10 +56,7 @@

{{ table.name }}

{%- endfor %} - + {% include _footer.html %}
diff --git a/browser/_layouts/schema_index.html b/browser/_layouts/schema_index.html index b0d3e623..c23ecfa0 100644 --- a/browser/_layouts/schema_index.html +++ b/browser/_layouts/schema_index.html @@ -1,37 +1,28 @@ - - -{% seo %} - - - + {% include _header.html %}
+ +

{{ page.title }}

{{ content }} - + {% include _footer.html %}
diff --git a/browser/assets/css/style2.scss b/browser/_sass/style2.scss similarity index 91% rename from browser/assets/css/style2.scss rename to browser/_sass/style2.scss index c8b689e2..d5ef6b21 100644 --- a/browser/assets/css/style2.scss +++ b/browser/_sass/style2.scss @@ -1,7 +1,3 @@ ---- -permalink: /assets/css/style2.css ---- - @import 'jekyll-theme-cayman'; html { @@ -18,6 +14,7 @@ a { } #container { + display: flex; height: 100%; } @@ -40,7 +37,7 @@ a { #sidebar ul { list-style-type: none; margin-left: 1rem; - padding: 0; + padding: 0; } #sidebar ul ul ul { @@ -74,5 +71,5 @@ a { } .main-content .schema-table .column-name { - font-family: monospace; + font-family: monospace; } diff --git a/browser/apdb.md b/browser/apdb.md index 9a549726..66f2ee97 100644 --- a/browser/apdb.md +++ b/browser/apdb.md @@ -1,6 +1,6 @@ --- layout: schema -title: Alert Production Database schema +title: Alert Production Database schema: apdb sort-index: 15 --- diff --git a/browser/assets/css/main.scss b/browser/assets/css/main.scss new file mode 100644 index 00000000..ffdc9242 --- /dev/null +++ b/browser/assets/css/main.scss @@ -0,0 +1,3 @@ +--- +--- +@import "style2"; diff --git a/browser/dp01.md b/browser/dp01.md index b45213a5..4143d3ae 100644 --- a/browser/dp01.md +++ b/browser/dp01.md @@ -1,6 +1,6 @@ --- layout: schema -title: Data Preview 0.1 Schema +title: Data Preview 0.1 schema: dp01_dc2 sort-index: 10 --- diff --git a/browser/dp02.md b/browser/dp02.md index 601a84f9..6f7ae30c 100644 --- a/browser/dp02.md +++ b/browser/dp02.md @@ -1,6 +1,6 @@ --- layout: schema -title: Data Preview 0.2 Schema +title: Data Preview 0.2 schema: dp02_dc2 sort-index: 9 --- diff --git a/browser/favicon.ico b/browser/favicon.ico new file mode 100644 index 00000000..b76aa026 Binary files /dev/null and b/browser/favicon.ico differ diff --git a/browser/hsc.md b/browser/hsc.md index 3fa96007..3005b505 100644 --- a/browser/hsc.md +++ b/browser/hsc.md @@ -1,8 +1,10 @@ --- layout: schema -title: HSC Schema +title: HyperSuprimeCam schema: hsc sort-index: 20 --- -The HSC Schema describes the outputs of the latest data release production pipelines for HyperSuprimeCam. This schema is used by [ci_hsc](https://github.com/lsst/ci_hsc), which -verifies the schema of the pipeline output files. +The HyperSuprimeCam (HSC) Schema describes the outputs of the latest data release production pipelines for +HyperSuprimeCam. +This schema is used by [ci_hsc](https://github.com/lsst/ci_hsc), which verifies the schema of the pipeline +output files. diff --git a/browser/imsim.md b/browser/imsim.md index 58e8dabd..4957dee5 100644 --- a/browser/imsim.md +++ b/browser/imsim.md @@ -1,6 +1,6 @@ --- layout: schema -title: LSSTCam-imSim Schema +title: LSSTCam ImSim schema: imsim sort-index: 30 --- diff --git a/browser/index.md b/browser/index.md index 661e5e38..4aa32f40 100644 --- a/browser/index.md +++ b/browser/index.md @@ -5,15 +5,8 @@ title: Science Data Model Schemas This schema browser provides a view on a curated subset of the Rubin Observatory's database schemas for user-facing data products (the Science Data Model, or SDM). These pages are rendered directly from the latest revisions of schema definition YAML files maintained in the [sdm_schemas](https://github.com/lsst/sdm_schemas) -github repository. +GitHub repository. Schemas available here for browsing include: - +{% include _schema_list.html include_description=true %} diff --git a/browser/yml b/browser/yml new file mode 120000 index 00000000..114cd3f0 --- /dev/null +++ b/browser/yml @@ -0,0 +1 @@ +../yml/ \ No newline at end of file