Merge pull request #469 from MindTooth/docs/fix_broken_docker_example #132
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
--- | |
name: Website Tests | |
on: | |
push: | |
branches: | |
- gh-pages | |
pull_request: | |
branches: | |
- '**' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
LANG: en_US.UTF-8 | |
LANGUAGE: en_US:en | |
LC_ALL: en_US.UTF-8 | |
PODEXEC: 'podman exec --workdir /tmp/website --env-file .env web-tests' | |
steps: | |
- name: "Checkout repo" | |
uses: actions/checkout@v2 | |
- name: "Cache files" | |
uses: actions/cache@v2 | |
id: website-cache | |
with: | |
path: tmp/.htmlproofer | |
key: htmlproofer | |
- name: "Check for nonbreaking space in markdowns" | |
run: | | |
if grep -P '\xa0' `find source/ -name "*.md"` ; then | |
echo '/!\ nonbreaking spaces have been found within the markdown (see previous log entries)' | |
exit 2 | |
fi | |
# bundler just bump versions to the locally available ones | |
# which means developpers would always require bleeding edge versions not available on stable servers | |
# this is too simplistic and breaks deployment | |
# instead all changes are tested via CI on the same target OS and version than the production builder | |
- name: "Check for simplistic bundler requirement bump" | |
run: | | |
if grep -E "^(RUBY VERSION|BUNDLED WITH)" Gemfile.lock; then | |
echo '/!\ please remove "RUBY VERSION" and "BUNDLED WITH" requirements in Gemfile.lock' | |
exit 2 | |
fi | |
- name: "Install Podman" | |
run: sudo apt-get install -y podman | |
- name: "Create the Website Build Environment container" | |
# Duck: DO NOT change the target OS, it needs to be in sync with the production builder | |
run: podman run -dt --name web-tests --volume .:/tmp/website registry.fedoraproject.org/fedora:34 | |
- name: "Install locales data in the Website Build Environment" | |
run: podman exec --workdir /tmp/website web-tests dnf install -y glibc-langpack-en | |
- name: "Define Website Build Environment Variables" | |
run: | | |
touch .env | |
echo LANG=en_US.UTF-8 >>.env | |
echo LANGUAGE=en_US:en >>.env | |
echo LC_ALL=en_US.UTF-8 >>.env | |
echo NOKOGIRI_USE_SYSTEM_LIBRARIES=true >>.env | |
cat .env | |
- name: "Install git in the Website Build Environment" | |
run: $PODEXEC dnf install -y git | |
- name: "Initialize Website Build Environment" | |
run: $PODEXEC ./setup.sh | |
- name: "Website Build" | |
run: $PODEXEC bundle exec jekyll build | |
- name: "Website HTMLProofer Test" | |
run: $PODEXEC bundle exec ruby htmlproofer_test.rb | |
# TODO: remove when all problems are fixed | |
continue-on-error: true | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: site-without-markdown | |
path: | | |
_site |