format md files using dprint fmt
, update docs
#16
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: Test | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install formatting dependencies | |
run: | | |
sudo apt update | |
sudo apt install gettext yapf3 | |
- name: Check formatting | |
uses: dprint/[email protected] | |
typos: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check for typos | |
uses: crate-ci/[email protected] | |
with: | |
config: ./.github/typos.toml | |
find-languages: | |
runs-on: ubuntu-latest | |
outputs: | |
languages: ${{ steps.find-languages.outputs.languages }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Find languages | |
id: find-languages | |
shell: python | |
run: | | |
import os, json, pathlib | |
languages = ["en"] + [p.stem for p in pathlib.Path("po").iterdir() if p.suffix == ".po"] | |
github_output = open(os.environ["GITHUB_OUTPUT"], "a") | |
github_output.write("languages=") | |
json.dump(sorted(languages), github_output) | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- find-languages | |
strategy: | |
matrix: | |
language: ${{ fromJSON(needs.find-languages.outputs.languages) }} | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # We need the full history for build.sh below. | |
- name: Setup Rust cache | |
uses: ./.github/workflows/setup-rust-cache | |
- name: Install Gettext | |
run: | | |
sudo apt update | |
sudo apt install gettext | |
- name: Install mdbook | |
uses: ./.github/workflows/install-mdbook | |
- name: Test format of ${{ matrix.language }} translation | |
if: matrix.language != 'en' | |
run: msgfmt --statistics -o /dev/null po/${{ matrix.language }}.po | |
- name: Test extracting English strings | |
if: matrix.language == 'en' | |
run: | | |
MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot"}}' mdbook build -d po | |
msgfmt -o /dev/null --statistics po/messages.pot | |
- name: Build ${{ matrix.language }} translation | |
run: | | |
chmod +x .github/workflows/build.sh | |
.github/workflows/build.sh ${{ matrix.language }} book/ankidroiddocs-${{ matrix.language }} | |
# Upload the book now to retain it in case mdbook test fails. | |
- name: Upload book | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ankidroiddocs-${{ matrix.language }} | |
path: book/ | |