mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-13 12:40:36 +02:00
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.
This commit is contained in:
parent
543cad59e4
commit
1f37933b8b
29
.github/workflows/build.yml
vendored
29
.github/workflows/build.yml
vendored
@ -17,13 +17,10 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
uses: ./.github/workflows/setup-rust-cache
|
||||
|
||||
- name: Install mdbook
|
||||
run: cargo install mdbook --version 0.4.25
|
||||
|
||||
- name: Install mdbook-svgbob
|
||||
run: cargo install mdbook-svgbob --version 0.2.1
|
||||
uses: ./.github/workflows/install-mdbook
|
||||
|
||||
- name: Test code snippets
|
||||
run: mdbook test
|
||||
@ -35,7 +32,7 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
uses: ./.github/workflows/setup-rust-cache
|
||||
|
||||
- name: Test Rust code
|
||||
run: cargo test
|
||||
@ -51,19 +48,13 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
uses: ./.github/workflows/setup-rust-cache
|
||||
|
||||
- name: Install Gettext
|
||||
run: sudo apt install gettext
|
||||
|
||||
- name: Install mdbook
|
||||
run: cargo install mdbook --version 0.4.25
|
||||
|
||||
- name: Install mdbook-svgbob
|
||||
run: cargo install mdbook-svgbob --version 0.2.1
|
||||
|
||||
- name: Install i18n-helpers
|
||||
run: cargo install --path i18n-helpers --locked
|
||||
uses: ./.github/workflows/install-mdbook
|
||||
|
||||
- name: Generate po/messages.pot
|
||||
run: mdbook build -d po
|
||||
@ -101,19 +92,13 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
uses: ./.github/workflows/setup-rust-cache
|
||||
|
||||
- name: Install Gettext
|
||||
run: sudo apt install gettext
|
||||
|
||||
- name: Install mdbook
|
||||
run: cargo install mdbook --version 0.4.25
|
||||
|
||||
- name: Install mdbook-svgbob
|
||||
run: cargo install mdbook-svgbob --version 0.2.1
|
||||
|
||||
- name: Install i18n-helpers
|
||||
run: cargo install --path i18n-helpers --locked
|
||||
uses: ./.github/workflows/install-mdbook
|
||||
|
||||
- name: Test ${{ matrix.language }} translation
|
||||
run: msgfmt --statistics -o /dev/null po/${{ matrix.language }}.po
|
||||
|
18
.github/workflows/install-mdbook/action.yml
vendored
Normal file
18
.github/workflows/install-mdbook/action.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
name: Install mdbook and dependencies
|
||||
|
||||
description: Install the mdbook with the dependencies we need.
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install mdbook
|
||||
run: cargo install mdbook --version 0.4.25
|
||||
shell: bash
|
||||
|
||||
- name: Install mdbook-svgbob
|
||||
run: cargo install mdbook-svgbob --version 0.2.1
|
||||
shell: bash
|
||||
|
||||
- name: Install i18n-helpers
|
||||
run: cargo install --path i18n-helpers --locked
|
||||
shell: bash
|
7
.github/workflows/publish.yml
vendored
7
.github/workflows/publish.yml
vendored
@ -30,13 +30,10 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
uses: ./.github/workflows/setup-rust-cache
|
||||
|
||||
- name: Install mdbook
|
||||
run: cargo install mdbook --version 0.4.25
|
||||
|
||||
- name: Install mdbook-svgbob
|
||||
run: cargo install mdbook-svgbob --version 0.2.1
|
||||
uses: ./.github/workflows/install-mdbook
|
||||
|
||||
- name: Build book
|
||||
run: mdbook build
|
||||
|
13
.github/workflows/setup-rust-cache/action.yml
vendored
Normal file
13
.github/workflows/setup-rust-cache/action.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
name: Setup Rust cache
|
||||
|
||||
description: Configure the rust-cache workflow.
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: |
|
||||
. -> target
|
||||
i18n-helpers -> target
|
Loading…
x
Reference in New Issue
Block a user