-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ci: parallelize the mdbook build <language> process #2772
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
base: main
Are you sure you want to change the base?
Changes from all commits
9ad2542
ffd6442
de81b2f
2ee2402
8791e59
8895c86
98598e6
fce62f9
20307f6
0cc11a5
cd922c4
67e4a6a
0b30b28
1c62035
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,31 +3,45 @@ name: Publish | |
# See also TRANSLATIONS.md. | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: pages | ||
cancel-in-progress: true | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
# Update the language picker in index.hbs to link new languages. | ||
LANGUAGES: ar bn da de el es fa fr id it ja ko pl pt-BR ro ru tr uk vi zh-CN zh-TW | ||
|
||
jobs: | ||
publish: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
create-translation: | ||
strategy: | ||
matrix: | ||
language: | ||
[ | ||
"en", | ||
"ar", | ||
"bn", | ||
"da", | ||
"de", | ||
"el", | ||
"es", | ||
"fa", | ||
"fr", | ||
"id", | ||
"it", | ||
"ja", | ||
"ko", | ||
"pl", | ||
"pt-BR", | ||
"ro", | ||
"ru", | ||
"tr", | ||
"uk", | ||
"vi", | ||
"zh-CN", | ||
"zh-TW", | ||
] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
|
@@ -50,14 +64,49 @@ jobs: | |
uses: ./.github/workflows/install-mdbook | ||
|
||
- name: Build course in English | ||
if: matrix.language == 'en' | ||
run: .github/workflows/build.sh en book | ||
|
||
- name: Build all translations | ||
- name: Build ${{ matrix.language }} translation | ||
if: matrix.language != 'en' | ||
run: | | ||
for po_lang in ${{ env.LANGUAGES }}; do | ||
.github/workflows/build.sh $po_lang book/$po_lang | ||
mv book/$po_lang/html book/html/$po_lang | ||
done | ||
.github/workflows/build.sh ${{ matrix.language }} book/${{ matrix.language }} | ||
mkdir book/html | ||
mv book/${{ matrix.language }}/html book/html/${{ matrix.language }} | ||
|
||
- name: Upload translation | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: comprehensive-rust-${{ matrix.language }} | ||
path: book/ | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
needs: create-translation | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Update Rust | ||
run: rustup update | ||
|
||
- 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 | ||
Comment on lines
+90
to
+102
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small question: do we need to install Rust, |
||
|
||
- name: Download all translations | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: book/ | ||
pattern: comprehensive-rust-* | ||
merge-multiple: true | ||
|
||
- name: Build translation report | ||
run: i18n-report report book/html/translation-report.html po/*.po | ||
|
@@ -69,14 +118,8 @@ jobs: | |
for file in synced-po/*.po; do msgmerge --update $file synced-po/messages.pot ; done | ||
i18n-report report book/html/synced-translation-report.html synced-po/*.po | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
- name: Upload all translations (for verification) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: book/html | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
Comment on lines
-80
to
-82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm surprised this went away? Is this not the most important part, so to speak? 😄 |
||
name: comprehensive-rust-all | ||
path: book/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand of YAML, this can be simplified to
and so on, which seems ever so slightly more high level.