ci #183
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- v* | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
schedule: | |
- cron: 0 4/12 * * * | |
env: | |
IS_SCHEDULE: ${{ github.event_name == 'schedule' && 'true' || '' }} | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Determine toolchain | |
run: | | |
if [ -z $IS_SCHEDULE ]; then | |
toolchain=$(grep channel rust-toolchain.toml | sed -r 's/channel = "(.*)"/\1/') | |
else | |
toolchain='nightly' | |
fi | |
echo "setting RUSTUP_TOOLCHAIN to $toolchain" | |
echo "RUSTUP_TOOLCHAIN=$toolchain" >> "$GITHUB_ENV" | |
- name: Install Rust toolchain | |
run: | | |
rm /home/runner/.cargo/bin/rustfmt | |
rustup toolchain install --profile minimal $RUSTUP_TOOLCHAIN | |
rustup component add --toolchain $RUSTUP_TOOLCHAIN rustfmt | |
rustup component add --toolchain $RUSTUP_TOOLCHAIN clippy | |
- name: Install just | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: just | |
- name: Install protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build | |
run: just check | |
- name: Check code format | |
run: just fmt-check | |
- name: Run linter | |
run: just lint | |
- name: Run tests | |
run: just test | |
- name: Run doc | |
run: just doc |