Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤖 Check if zsd docs are up to date #117

Merged
merged 6 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 📚 documentation
on: [push, pull_request, workflow_dispatch]

jobs:
zshelldoc:
runs-on: ubuntu-latest
steps:
- name: 📦 Install zshelldoc
run: |
sudo apt-get install -y zsh
git clone https://github.com/zdharma-continuum/zshelldoc.git /tmp/zsd.git
cd /tmp/zsd.git
sudo make install
zsd --help

- name: ♦️ Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
bundler-cache: true

- name: 📄 Install asciidoctor-pdf
run: |
gem install asciidoctor-pdf

- name: 📡 Check out repository
uses: actions/checkout@v2

- name: 👷 Generate zsd
run: |
make doc

- name: 📇 Generate PDF
run: |
make -C doc/zsdoc pdf

- name: 🗄️ Tar doc/
run: |
tar cvzf /tmp/doc.tar.gz doc

- name: ✉️ Upload doc.tar.gz
uses: actions/upload-artifact@v2
with:
name: docs
path: |
/tmp/doc.tar.gz

- name: 🕵️ Check if the zsd docs need to be updated
# NOTE: We need to run git diff twice here since w/o --quiet it's RC
# is always 0. The first is to display the diff output, the second one
# to test whether the diff is empty.
run: |
git --no-pager diff
if git --no-pager diff --quiet
then
echo "✅ The zshelldocs are up to date"
else
{
echo "❌ The zshelldocs in the repo are not up to date"
echo 'Please regenerate them with $ make doc'
} >&2
exit 1
fi
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ testD:
testE:
make VERBOSE=$(VERBOSE) NODIFF=$(NODIFF) DEBUG=$(DEBUG) OPTDUMP=$(OPTDUMP) OPTS="ignoreclosebraces" -C test test

# Set LC_ALL to avoid having to deal with different locales.
# The generated .adoc files will differ in sorting and or unicode char encoding.
# LC_ALL=C is sadly not an option here since it results in incorrect char
# encoding in some of the files created by zsd.
doc: export LC_ALL=en_US.UTF-8
doc: zinit.zsh zinit-side.zsh zinit-install.zsh zinit-autoload.zsh
rm -rf doc/zsdoc/data doc/zsdoc/*.adoc
# cd is required since zsd outputs to PWD/zsdoc/
Expand Down