Run 'cargo xtask codegen' in CI and check that there are no diffs

This commit is contained in:
Dustin J. Mitchell 2023-05-29 17:33:14 +00:00 committed by Dustin J. Mitchell
parent 75e10676ce
commit a0703af0b9
2 changed files with 38 additions and 2 deletions

View file

@ -56,7 +56,7 @@ jobs:
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
# if this changes, change it in cli/Cargo.toml and .github/workflows/publish-docs.yml as well
# if this changes, change it in .github/workflows/publish-docs.yml as well
mdbook-version: '0.4.10'
- run: mdbook test taskchampion/docs
@ -80,3 +80,39 @@ jobs:
command: fmt
args: --all -- --check
codegen:
runs-on: ubuntu-latest
name: "codegen"
steps:
- uses: actions/checkout@v3
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
# Same as the MSRV in rust-tests.yml
toolchain: "1.64"
override: true
- uses: actions-rs/cargo@v1.0.3
with:
command: run
args: --package xtask -- codegen
- name: check for changes
run: |
if ! git diff; then
echo "Generated code not up-to-date;
run `cargo run --package xtask -- codegen` and commit the result";
exit 1;
fi

View file

@ -18,7 +18,7 @@ jobs:
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
# if this changes, change it in cli/Cargo.toml and .github/workflows/publish-docs.yml as well
# if this changes, change it in .github/workflows/publish-docs.yml as well
mdbook-version: '0.4.10'
- run: mdbook build taskchampion/docs