Skip to content

Commit

Permalink
Add option to locally run HTMLProofer (#2285)
Browse files Browse the repository at this point in the history
* Add Ruby installation and html-proofer gem to devcontainer

Add Ruby installation and html-proofer gem to devcontainer

Add Ruby installation and html-proofer gem to devcontainer

* Update the Check links action with the new Gemfile

* Fix "Set up Ruby" Github Action

Co-authored-by: Sam <[email protected]>

* Add x86_64-linux as a platfiorm for Ruby on Ubuntu (Github Action)

* Add bundle install after Ruby setup

* Update .github/workflows/ubuntu.yml

* Fix "Set up Ruby" Github Action indentation

Co-authored-by: Sam <[email protected]>

* Fix htmlproofer command in CI

---------

Co-authored-by: Nick Spaargaren <[email protected]>
Co-authored-by: Sam <[email protected]>
  • Loading branch information
3 people authored Jan 25, 2025
1 parent 684d457 commit 163afe8
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 6 deletions.
9 changes: 7 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"name": "Python 3",
"name": "Python and Ruby",
"image": "mcr.microsoft.com/devcontainers/python:1-3.9-bookworm",
"postCreateCommand": "pip3 install --user -r requirements.txt"
"features": {
"ghcr.io/devcontainers/features/ruby:1": {
"version": "3.4.1"
}
},
"postCreateCommand": "pip3 install --user -r requirements.txt && bundle install"
}
14 changes: 10 additions & 4 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ jobs:
path: ${{ env.pythonLocation }}
key: v2-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}

- name: Install html-proofer
run: sudo gem install html-proofer -v '<4.4'

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
Expand All @@ -56,9 +53,18 @@ jobs:
with:
name: html
path: html.tar.gz

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true

- name: Install Ruby dependencies
run: bundle install

# TODO: Look into why we need to ignore archive/tag/index
- name: Check links
if: success()
run: |
htmlproofer --ignore-files "/404/,/2013/,/2014/,/2015/,/2016/,/2017/,/search\/index.html/,/archive\/tag\/index/" --allow-hash-href=true --enforce-https=false --ignore-missing-alt=true --disable-external=true docs/_build/html
bundle exec htmlproofer --ignore-files "/404/,/2013/,/2014/,/2015/,/2016/,/2017/,/search\/index.html/,/archive\/tag\/index/" --allow-hash-href=true --enforce-https=false --ignore-missing-alt=true --disable-external=true docs/_build/html
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

gem "html-proofer", '<4.4'
41 changes: 41 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.17.1-aarch64-linux-gnu)
ffi (1.17.1-x86_64-linux-gnu)
html-proofer (4.3.2)
addressable (~> 2.3)
mercenary (~> 0.3)
nokogiri (~> 1.13)
parallel (~> 1.10)
rainbow (~> 3.0)
typhoeus (~> 1.3)
yell (~> 2.0)
zeitwerk (~> 2.5)
mercenary (0.4.0)
nokogiri (1.18.1-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.1-x86_64-linux-gnu)
racc (~> 1.4)
parallel (1.26.3)
public_suffix (6.0.1)
racc (1.8.1)
rainbow (3.1.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
yell (2.2.2)
zeitwerk (2.7.1)

PLATFORMS
aarch64-linux-gnu
x86_64-linux

DEPENDENCIES
html-proofer (< 4.4)

BUNDLED WITH
2.6.2

0 comments on commit 163afe8

Please sign in to comment.