Skip to content

Commit

Permalink
Merge branch 'google:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
javad-jafari authored Jul 29, 2024
2 parents b96853e + 32230f1 commit 3eb595f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -36,7 +37,7 @@ jobs:
uses: actions/checkout@v4

- name: Check for typos
uses: crate-ci/typos@v1.23.2
uses: crate-ci/typos@v1.23.5
with:
config: ./.github/typos.toml

Expand Down Expand Up @@ -120,6 +121,9 @@ jobs:
matrix:
language: ${{ fromJSON(needs.find-languages.outputs.languages) }}
fail-fast: false
env:
# Opt-in for checking links in translations - add the language below.
LINK_CHECKED_LANGUAGES: '["en", ]'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -128,6 +132,8 @@ jobs:

- name: Setup Rust cache
uses: ./.github/workflows/setup-rust-cache
with:
key: ${{ contains(fromJSON(env.LINK_CHECKED_LANGUAGES), matrix.language) }}

- name: Install Gettext
run: |
Expand All @@ -148,8 +154,7 @@ jobs:
msgfmt -o /dev/null --statistics po/messages.pot
- name: Install mdbook-linkcheck
# Opt-in for checking links in translations - add the language below.
if: contains(fromJSON('["en", ]'), matrix.language)
if: contains(fromJSON(env.LINK_CHECKED_LANGUAGES), matrix.language)
run: cargo install mdbook-linkcheck --locked --version 0.7.7

- name: Build ${{ matrix.language }} translation
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/setup-rust-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ name: Setup Rust cache

description: Configure the rust-cache workflow.

inputs:
key:
description: Additional caching key
required: false
default:

runs:
using: composite
steps:
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
# Only save the cache on the main branch to avoid PRs filling
# up the cache. Further, only save it if we are working on the
# English source (or if no language has been set).
save-if: ${{ github.ref == 'refs/heads/main' && (matrix.language == 'en' || matrix.language == '') }}
# up the cache.
save-if: ${{ github.ref == 'refs/heads/main' }}
# Further, save the cache per key - e.g. language grouping.
key: ${{ inputs.key }}
2 changes: 1 addition & 1 deletion src/bare-metal/android/vmbase.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ pub fn main(arg0: u64, arg1: u64, arg2: u64, arg3: u64) {

</details>

[1]: https://android.googlesource.com/platform/packages/modules/Virtualization/+/refs/heads/master/vmbase/
[1]: https://android.googlesource.com/platform/packages/modules/Virtualization/+/refs/heads/main/libs/libvmbase/
2 changes: 2 additions & 0 deletions third_party/rust-on-exercism/health-statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ fn test_visit() {
assert_eq!(report.patient_name, "Bob");
assert_eq!(report.visit_count, 1);
assert_eq!(report.blood_pressure_change, None);
assert!((report.height_change - 0.9).abs() < 0.00001);

let report =
bob.visit_doctor(Measurements { height: 156.1, blood_pressure: (115, 76) });

assert_eq!(report.visit_count, 2);
assert_eq!(report.blood_pressure_change, Some((-5, -4)));
assert_eq!(report.height_change, 0.0);
}
// ANCHOR_END: tests

0 comments on commit 3eb595f

Please sign in to comment.