mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-01-24 22:32:56 +02:00
1f37933b8b
* Extract common build steps to composite actions This allows us to repeat ourselves less across the different jobs. I also tested using a “reusable workflow” to factor out the common steps. However, this starts a separate job without a shared filesystem, which in turn requires us to upload/download artifacts when we want to use them in several jobs. The artifacts are downloaded one-by-one and this adds delays and extra steps to all jobs. * Move Rust cache setup to its own build step This made it easy to consistently setup the caching of our nested projects via the “workspacs” config key.
111 lines
2.6 KiB
YAML
111 lines
2.6 KiB
YAML
name: Test
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
mdbook:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Rust cache
|
|
uses: ./.github/workflows/setup-rust-cache
|
|
|
|
- name: Install mdbook
|
|
uses: ./.github/workflows/install-mdbook
|
|
|
|
- name: Test code snippets
|
|
run: mdbook test
|
|
|
|
cargo:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Rust cache
|
|
uses: ./.github/workflows/setup-rust-cache
|
|
|
|
- name: Test Rust code
|
|
run: cargo test
|
|
|
|
- name: Test i18n-helpers
|
|
run: cargo test
|
|
working-directory: i18n-helpers
|
|
|
|
i18n-helpers:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Rust cache
|
|
uses: ./.github/workflows/setup-rust-cache
|
|
|
|
- name: Install Gettext
|
|
run: sudo apt install gettext
|
|
|
|
- name: Install mdbook
|
|
uses: ./.github/workflows/install-mdbook
|
|
|
|
- name: Generate po/messages.pot
|
|
run: mdbook build -d po
|
|
env:
|
|
MDBOOK_OUTPUT: '{"xgettext": {"pot-file": "messages.pot"}}'
|
|
|
|
- name: Test messages.pot
|
|
run: msgfmt --statistics -o /dev/null po/messages.pot
|
|
|
|
- name: Expand includes without translation
|
|
run: mdbook build -d expanded
|
|
env:
|
|
MDBOOK_OUTPUT: '{"markdown": {}}'
|
|
|
|
- name: Expand includes with no-op translation
|
|
run: mdbook build -d no-op
|
|
env:
|
|
MDBOOK_OUTPUT: '{"markdown": {}}'
|
|
MDBOOK_PREPROCESSOR__GETTEXT__PO_FILE: po/messages.pot
|
|
|
|
- name: Compare no translation to no-op translation
|
|
run: diff -r expanded no-op
|
|
|
|
translations:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
language:
|
|
- da
|
|
env:
|
|
MDBOOK_BOOK__LANGUAGE: ${{ matrix.language }}
|
|
MDBOOK_PREPROCESSOR__GETTEXT__PO_FILE: po/${{ matrix.language }}.po
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Rust cache
|
|
uses: ./.github/workflows/setup-rust-cache
|
|
|
|
- name: Install Gettext
|
|
run: sudo apt install gettext
|
|
|
|
- name: Install mdbook
|
|
uses: ./.github/workflows/install-mdbook
|
|
|
|
- name: Test ${{ matrix.language }} translation
|
|
run: msgfmt --statistics -o /dev/null po/${{ matrix.language }}.po
|
|
|
|
- name: Build course with ${{ matrix.language }} translation
|
|
run: mdbook build
|
|
|
|
- name: Test code snippets with ${{ matrix.language }} translation
|
|
run: mdbook test
|