1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-16 14:53:28 +02:00
Commit Graph

49 Commits

Author SHA1 Message Date
Martin Geisler
b6d51a7f22
Update mdbook-i18n-helpers to latest version (#1115)
I have created PRs to normalize all PO files to the new version of
mdbook-i18n-helpers. Simultaneously, we need to update the version used
to publish the course.

This is indirectly part of #330.
2023-08-23 12:34:12 -04:00
Martin Geisler
2e92da7acd
Update mdbook to 0.4.34 (#1066)
I also updated `book.js` and `index.hbs` to the latest versions while
keeping our local modifications.

I tested this locally with `mdbook serve` for both English and
Brazilian Portuguese and everything seems to work fine.
2023-08-11 15:40:01 +02:00
Martin Geisler
186d333227
Run builds on both Mac OS and Linux (#830)
* Run builds on both Mac OS and Linux

This would have helped us catch #570.

* Fix MacOS CI (#848)

* Revert unnecessary changes

The changes might be good, but I want to keep this PR small and
focused. If we end up with the extra `cfg` statements, we should
include a comment to let students know what they do: we’re targeting
people new to Rust, so we need to be careful with explanations.

---------

Co-authored-by: Dominik Maier <domenukk@gmail.com>
2023-06-22 10:38:41 +02:00
Ming-Ying Chung
a5fbd2fd7c
Add PR labeler action to label translation-related PRs (#845)
* Add PR labeler action to label translation-related PRs

* Sync labels when PR changes

* Update instructions for new translation
2023-06-22 14:21:33 +09:00
Md. Rasel Mandol
5d56a529da
Bengali translation: to link incomplete Bengali translation (#819)
Bengali translation: to link incomplete Bengali translation
2023-06-14 19:37:22 +01:00
Martin Geisler
5de9cdafea
Link to incomplete French, German, and Japanese translations (#730)
These translations all have more than 200 translated messages and
they’ve been updated in the last month.

I suggest we update the list here every few weeks based on input from
the translators: we don’t need a super strict rule here, we just need
interested translators who would like to see their work celebrated.

I suggest we only link completed translations in the language picker
since we have limited space there to differentiate the different
levels of completeness.
2023-05-31 11:55:39 +02:00
Martin Geisler
aaca44f62b
Format files with dprint (#711)
The dprint formatter is a flexible system which will use sandboxed
WebAssembly formatters to format our code (mostly: it calls out to
`rustfmt` for Rust code).

A particularly interesting feature is that dprint can format Rust code
blocks in the Markdown files. However, before we turn that on, we need
to have a way to normalize the Markdown text as it is extracted[1].
That is so that the word put into the translations is kept after the
reformatting.

[1]: https://github.com/google/mdbook-i18n-helpers/issues/19
2023-05-30 17:04:19 +02:00
Martin Geisler
2ddd7770f4
No need to run apt update before apt install (#634)
The VMs on GitHub have updated APT caches.
2023-05-24 15:58:34 -04:00
Martin Geisler
b9959bfeb1
Publish the in-progress Italian translation (#645)
This makes the translation available on the official site. It's not linked yet, but having it available there should make it easier to review the state.
2023-05-19 14:25:51 +02:00
Martin Geisler
b4fb870af6
Enable imports_granularity for rustfmt (#637)
This requires us to run a nightly Rust for our formatting check[1]. Other
users will see a warning when invoking `rustfmt`:

  Warning: can't set `imports_granularity = Module`, unstable features
  are only available in nightly channel.

This should be harmless overall and help us ensure better consistency
in our import formatting.

[1]: https://rust-lang.github.io/rustfmt/?version=v1.5.1&search=#imports_granularity
2023-05-16 12:35:49 +02:00
Martin Geisler
e19fc8bfd2
Simplify GitHub actions (#621)
* Remove unnecessary jobs names

They are inconsistent with the rest of the jobs and they overflow the
horizontal space in the GitHub UI.

* Remove unnecessary toolchain action

The GitHub runners include rustup and a recent stable Rust. We only
need to add the necessary target and we’re good to go.

This removes a lot of warnings because the action used an outdated
GitHub API: https://github.com/actions-rs/toolchain/issues/219

* Simplify job name

The job is testing a single translation, so it should be singular.

* Test English source with translations

This simplifies the workflow a little and ensures that we get
artifacts uploaded of the English version for every PR.

* Avoid shell command chain

GitHub actions supports setting the working directory directly.

* Upload only the book artifact

Right now, the artifacts all contain the same two top-level folders:
html/ and exerciser/. The former is what we actually deploy, the
second is a side-effect of the exerciser plugin.

With this change, we only upload the HTML and we ensure the zip file
for the xx language has a top-level comprehensive-rust-xx/ folder.
This makes it much nicer to use the generated artifacts.
2023-05-08 16:32:25 +02:00
Martin Geisler
934f9368c1
Remove unnecessary cache key (#586)
They caches have been refreshed long ago. I'm no longer sure which #1322 I was referring to in the comment — it might have been a weird typo for #552.
2023-04-27 13:25:02 -04:00
Andrew Walbran
86d8c4ae54 Rename exercise template directory and archive. 2023-04-05 16:28:07 +01:00
Andrew Walbran
ed4f5b64c4 Zip exercise templates for translation build artifacts. 2023-04-05 16:28:07 +01:00
Andrew Walbran
6b7c7cbc73 Fix publishing translations. 2023-04-05 16:28:07 +01:00
Andrew Walbran
b6f5ba1af0 Run exerciser as mdbook renderer. 2023-04-05 16:28:07 +01:00
Andrew Walbran
edd9df042c Make exerciser an mdbook renderer. 2023-04-05 16:28:07 +01:00
Andrew Walbran
3f7cc60686 Make zip part as part of script.
This makes running local builds easier.
2023-04-05 16:28:07 +01:00
Andrew Walbran
d0ef072cf2 Publish exercise templates to Pages. 2023-04-05 16:28:07 +01:00
Andrew Walbran
9372d14378 Build exercise templates in CI. 2023-04-05 16:28:07 +01:00
Martin Geisler
49bf110b31
Use mdbook-i18n-helpers crate (#552)
The i18n-helpers are now available as a stand-alone crate:
https://crates.io/crates/mdbook-i18n-helpers.

Because we cache the Rust binaries in our GitHub workflows, I bumped
the cache prefix to ensure we use a clean cache. Otherwise, Cargo
won’t install the new binaries in mdbook-i18n-helpers because it sees
the old ones from this repository.
2023-04-05 16:08:11 +02:00
Andrew Walbran
72ff50e60b Build bare-metal examples in presubmit. 2023-03-23 15:06:23 +00:00
Andrew Walbran
036269ec94 Add workflow to check that Rust code is formatted properly. 2023-03-20 14:26:57 +00:00
Martin Geisler
e366d833d0
Update mdbook to 0.4.28 (#480)
* Update mdbook to 0.4.28

This version contains https://github.com/rust-lang/mdBook/pull/1986 which will allow us to test the code in each translation.

* Fix formatting in Korean translation

The extra code block made `mdbook test` fail.
2023-03-07 10:14:26 +01:00
Martin Geisler
7e47e31408
Group per-translation output in publish step (#467) 2023-03-02 06:38:32 +09:00
Jooyung Han
1821a3fd12
Make i18n-helpers a requirement (#461)
* Make i18n-helpers a requirement

* Skip mdbook-gettext for mdbook-xgettext

* Gettext finds PO file based on `book.language`

* Update workflow

No need to set `preprocessor.gettext.po-file`.

---------

Co-authored-by: Jooyung Han <jooyung@google.com>
2023-02-28 22:05:09 +09:00
Martin Geisler
261bcfce3e
Show Markdown diff as unified diff (#454)
Also add nice colors to make things pretty.
2023-02-24 16:46:08 +01:00
Jiyong Park
eb57ba9e51
Publish Korean translation (#428)
* Publish Korean translation

* 한국어 -> 한국어 (Korean)

* Add translator names for the Korean translation
2023-02-17 17:58:33 +09:00
Martin Geisler
5c03394b31
Lock mdbook and mdbook-svgbob version numbers (#398)
This will help avoid breakage[1] when mdbook and mdbook-svgbob are out
of sync with each other.

[1]: https://github.com/boozook/mdbook-svgbob/issues/25.
2023-02-16 13:39:19 +01:00
Martin Geisler
3b7123d21a
Add language picker menu (#411)
The picker is a drop-down menu using the same design as the theme
picker in the top-left.

There doesn’t seem to be an easy way to pass in a list of languages
and descriptions, so for now we’ll have to expand the menu by hand as
we add new languages. A comment has been added to `publish.yml` to
remind us of this.
2023-02-15 15:10:16 +01:00
Martin Geisler
3a29be8c7d
Publish Brazilian Portuguese translation (#381)
The IETF language tag for “Brazilian Portuguese” is “pt-BR”[1]. This
tag is also used in the HTML lang attribute[2].

We derive the language code directly from the “.po” filename, so I’ve
renamed “pt_BR.po” to “pt-BR.po” make everything use the correct
language code. Nothing in the Gettext pipeline cares about the precise
filename, so it should be fine to rename it like this.

[1]: https://en.wikipedia.org/wiki/Brazilian_Portuguese#Language_codes
[2]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang
2023-02-13 13:45:58 +00:00
Martin Geisler
413098cdac
Upload build output as artifacts (#342)
This makes it super easy for translators to see the results of their
work: every PR will now have a list of artifacts, one per translation.
2023-02-06 17:20:32 +01:00
Andrew Walbran
20f02db5f5
Add a cargo workspace containing both crates (#321)
* Move Cargo.toml for exercises to exercises directory.

* Create a workspace with both exercises and i18n-helpers.

* Build in CI as well as testing.

* Binaries must have a main function.

* No need for workspaces configuration for caching anymore.
2023-02-02 16:14:34 +00:00
Martin Geisler
efa593e020
Automatically build and test all translations (#298)
This changes the build workflow to first list all available `.po`
files, and then use this information to start parallel jobs which test
each translation.
2023-01-30 13:41:19 +01:00
Jiyong Park
1040115d8c
Add Korean translation (#300)
* add ko.po

* translate ko(~23.01.19)

* change speaker-note ko

* change id

* translate ko(~23.01.20)

* ~day3 keynote

* draft done to f3446a91

* add @jiyongp comments of upstream PR #276.

* sync & apply review comments(upstream)

sync 585509bb

* After 10000 line apply review comments(upstream)

* chgange build.yml

* Fix the inconsistent newline character problem for the KO translation

If a msgid does not end with the newline character, so should the
msgstr.

Test: msgfmt --statistics -o /dev/null po/ko.po
No error, but shows `1085 translated messages, 675 untranslated
messages.`

---------

Co-authored-by: Evan kim(cli) <keispace.kyj@gmail.com>
2023-01-30 14:12:33 +09:00
Martin Geisler
bad5cc9f68
Publish translations to /xx subdirectories (#264)
This publishes translations (currently only the Danish translation) to
subdirectories named after the ISO 639-1 language code: “da/” for
Danish, “ko/” for Korean, etc.

The list of translation is an explicit list to make it easy for us to
enable/disable translations without being tied to the files in po/.
This allows us to experiment with a translation without publishing it
immediately.

I propose that we eventually move the English pages to an “en/”
directory for symmetry with the other locales. However, for now, the
pages remain at the room of our site (which works fine since we don’t
have a subdirectory named “en/” in the course).
2023-01-24 12:07:04 +01:00
Martin Geisler
1f37933b8b
Extract common build steps to composite actions (#242)
* 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.
2023-01-23 17:08:29 +01:00
Martin Geisler
f42c76e6a8 Test that a no-op translation does nothing
This ensures that the full mdbook-xgettext and mdbook-gettext workflow
is stable and doesn’t include spurious newlines.
2023-01-18 16:12:53 +01:00
Martin Geisler
c45bb19528 Test i18n-helpers on pull requests
This ensures that our i18n helpers stay working.
2023-01-18 16:12:53 +01:00
Martin Geisler
afa63ad7b5 Test that translations on pull requests
This adds a simple validation step to the PRs: calling ‘msgfmt’ will
check that the ‘.po’ files are well-formed.
2023-01-18 16:12:53 +01:00
Martin Geisler
499657c830 Simplify the publish workflow
This removes a bunch of boiler-plate comments which were left from the
template I used originally.

It also simplifies the name to just “Publish” since I feel this fits
better for what we do here.
2023-01-03 15:49:21 +01:00
Martin Geisler
a0a1398b9b Simplify workflow name
Now that we multiple jobs, this will look better in the GitHut output:
“Build / mdbook (pull_request)” and “Test / mdbook (pull_request)”.
2023-01-03 14:46:25 +01:00
Martin Geisler
1bfe3cf7a2 Run cargo test on pull requests
This uses the `Cargo.toml` file in the repository to test the provided
solutions.
2023-01-03 14:39:24 +01:00
Martin Geisler
a9ca0c860a Install specific mdbook version in build action
Like in #30, we should install a known-good version of `mdbook` and
`mdbook-svgbob` when testing PRs.
2022-12-23 12:42:55 +01:00
Martin Geisler
466b6e9cd9
Merge pull request #30 from google/mdbook-versions
Include version numbers when installing `mdbook`
2022-12-22 19:57:22 +01:00
Martin Geisler
11789caee2 Add a build workflow to test PRs
We will expand this to build/test other things in the future.
2022-12-22 15:22:41 +01:00
Martin Geisler
85c1684fe3 Include version numbers when installing mdbook 2022-12-22 15:01:55 +01:00
Martin Geisler
653a818b8b Cache the artifacts built by the publish workflow
This should speed up the publication: right now we spend around 4
minutes to build `mdbook` and `mdbook-svgbob`.

With this change, we will only pay that cost once a week (caches
created by GitHub Actions last 7 days[1]).

[1]: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
2022-12-21 18:49:41 +01:00
Martin Geisler
0e6c7e30d7
Create publish.yml
This is for publishing the course on GitHub Pages.
2022-12-21 16:50:05 +01:00