Skip to content

Commit

Permalink
Rework old TravisCI test config to GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jrha committed Aug 25, 2023
1 parent 55fe487 commit fef0b56
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 84 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run Tests

on: [push, pull_request]

jobs:
runtests:
runs-on: ubuntu-latest
steps:
- name: Set up Ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
bundler-cache: true
ruby-version: '3.1'
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: 3
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pyenchant
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 250
- name: Install Ruby gems
run: bundle install
env:
NOKOGIRI_USE_SYSTEM_LIBRARIES: true # speeds up installation of html-proofer
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Check Spelling
run: .tests/spellchecker
- name: Check HTML
run: .tests/htmlproofer
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
_site
*~
Gemfile.lock
vendor/

# Eclipse project
.project
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions .travis-scripts/html-proofer → .tests/htmlproofer
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ done < "${url_ignore_file}"
url_ignore_patterns=$(echo "${url_ignore_patterns}" | sed -e 's/^,//')
if [ -n "${url_ignore_patterns}" ]
then
url_ignore_option="--url-ignore ${url_ignore_patterns}"
url_ignore_option="--ignore-urls=${url_ignore_patterns}"
fi
echo "html-proofer url-ignore option: ${url_ignore_option}"

bundle exec jekyll build
set +e # do not halt script on error
bundle exec htmlproofer --disable-external ${url_ignore_option} ${debug_option} --check-html ./_site
cmd="bundle exec htmlproofer --disable-external=true --enforce-https=false ${url_ignore_option} ${debug_option} ./_site"
echo "Running: $cmd"
$cmd
status=$?
if [ ${status} -ne 0 -a -z "${debug_option}" ]
then
Expand Down
35 changes: 35 additions & 0 deletions .tests/spellchecker
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -e # halt script on error

SCVERSION="1.4"

wget https://github.com/stfc/markdown-spellchecker/archive/$SCVERSION.tar.gz -O /tmp/spellchecker.tar.gz
(cd /tmp && tar -xvzf spellchecker.tar.gz)

cp -f .tests/dictionary.txt /tmp/markdown-spellchecker-$SCVERSION/src/dict.txt

echo
echo spellchecker config:
echo --------------------
cat /tmp/markdown-spellchecker-$SCVERSION/src/config.ini
echo --------------------
echo

commit_range="HEAD^..HEAD"

echo "Commit Range: ${commit_range}"

# Ignore deleted files
md_files="$(git diff --name-only --diff-filter=d "${commit_range}" -- | grep '\.md$' | grep -v '^assets/' || true)"

if [[ -n "$md_files" ]]; then
echo "Markdown files changed:"
#shellcheck disable=SC2001
echo "$md_files" | sed 's/^/ /g'
echo "Running markdown-spellchecker:"
python3 /tmp/markdown-spellchecker-$SCVERSION/src/spellchecker.py $md_files || exit 1
exit 0
else
echo "No markdown files changed, nothing to do."
exit 0
fi
File renamed without changes.
35 changes: 0 additions & 35 deletions .travis-scripts/spellchecker

This file was deleted.

37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

10 changes: 2 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
source 'https://rubygems.org'

gem 'github-pages', '>= 175'
gem 'jekyll-feed'
gem 'jekyll-redirect-from'
gem 'html-proofer', '~> 3'

# Suggested by Jekyll
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
ruby "~> 3"
gem 'html-proofer', '~> 4'

0 comments on commit fef0b56

Please sign in to comment.