SBW 2025 edits (#183) #918
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# workflow for building and deploying a Jekyll site to GitHub Pages | |
# based on https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml | |
name: Deploy Jekyll site to Pages | |
on: | |
push: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
## Use this job step to debug | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v3 | |
# if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled && always() }} | |
# with: | |
# limit-access-to-actor: true | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
env: | |
# Omit installation of packages in "test" group in Gemfile & prevent | |
# `bundle exec` from checking for the existence of those packages in | |
# the (generated) Gemfile.lock | |
BUNDLE_WITHOUT: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3' # Not needed with a .ruby-version file | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
cache-version: 0 # Increment this number if you need to re-download cached gems | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
- run: bundle exec jekyll build --profile --trace # --baseurl "${{ steps.pages.outputs.base_path }}" # sub-uri currently not supported by site | |
- uses: actions/cache/restore@v4 | |
id: restore-cache-jbrowse | |
with: | |
path: ./_site/assets/js/jbrowse | |
key: jbrowse-${{ hashFiles('_data/datastore-metadata/**', '_scripts/jbrowse-tracks.sh', 'Makefile', 'assets/js/jbrowse-config.json') }} | |
- uses: actions/setup-node@v4 | |
if: steps.restore-cache-jbrowse.outputs.cache-hit != 'true' | |
with: | |
node-version: 20 | |
- name: Make JBrowse | |
if: steps.restore-cache-jbrowse.outputs.cache-hit != 'true' | |
run: | | |
make jbrowse | |
rm -rf assets/js/jbrowse/test_data | |
mv assets/js/jbrowse _site/assets/js | |
- uses: actions/cache/save@v4 | |
id: save-cache-jbrowse | |
if: steps.restore-cache-jbrowse.outputs.cache-hit != 'true' | |
with: | |
path: ./_site/assets/js/jbrowse | |
key: jbrowse-${{ hashFiles('_data/datastore-metadata/**', '_scripts/jbrowse-tracks.sh', 'Makefile', 'assets/js/jbrowse-config.json') }} | |
# create artifact.tar from ./_site directory & upload as artifact named 'github-pages' | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
yamllint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install yamllint | |
run: python3 -mpip install --no-cache-dir yamllint | |
- name: Run yamllint | |
run: yamllint . | |
check-links: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: github-pages | |
- run: tar -xf artifact.tar && rm artifact.tar | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3' # Not needed with a .ruby-version file | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
cache-version: 0 # Increment this number if you need to re-download cached gems | |
- name: install htmlproofer | |
# need ruby >= 3.1 for html-proofer 5.x | |
run: gem install html-proofer -v 5.0.9 | |
# Cache HTMLProofer external URL results for 30 days, but using actions/cache/restore | |
# and actions/cache/save so cache can still be saved when failure is reported | |
# https://github.com/gjtorikian/html-proofer/#caching-with-continuous-integration | |
- uses: actions/cache/restore@v4 | |
id: restore-cache-htmlproofer | |
with: | |
path: ./tmp/.htmlproofer | |
key: html-proofer | |
- name: run htmlproofer | |
# ignore HTTP status 301 (htmlproofer strips trailing slashes) | |
run: | | |
htmlproofer --allow-missing-href --ignore-missing-alt --ignore-files '/\/uikit\/tests\//' --ignore-status-codes '301,403,503' --cache '{"timeframe": {"external": "30d"}}' --ignore-url '/germplasm-map.legumeinfo.org/,/pgrc-rpc.agr.gc.ca\/gringlobal\/search/' | |
# https://github.com/actions/cache/blob/main/save/README.md#always-save-cache | |
- uses: actions/cache/save@v4 | |
id: save-cache-htmlproofer | |
if: always() | |
with: | |
path: ./tmp/.htmlproofer | |
key: html-proofer | |
pa11y: | |
# https://github.com/GSA/notifications-admin/pull/475 | |
runs-on: ubuntu-20.04 | |
needs: build | |
steps: | |
# need repository for .pa11yci | |
- uses: actions/download-artifact@v4 | |
with: | |
name: github-pages | |
- run: tar -xf artifact.tar && rm artifact.tar | |
- run: npm install -g [email protected] | |
- run: busybox httpd -p 4000 | |
# FIXME: patty-ci concurrency > 1 results in errors in this GA workflow | |
- run: | | |
printf '{"defaults": {"runners": ["axe"], "concurrency": 4, "useIncognitoBrowserContext": false}}\n' > .pa11yci | |
- run: pa11y-ci --sitemap http://0.0.0.0:4000/sitemap.xml --sitemap-exclude '/cmap-*' --sitemap-find '^/' --sitemap-replace http://0.0.0.0:4000/ | |
# Deployment job | |
deploy: | |
# deploy if default branch for GitHub repo | |
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: [build, yamllint] | |
permissions: | |
id-token: write | |
pages: write | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |