chore: add ci_checks #25
Workflow file for this run
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 | |
pull_request: | |
branches: | |
- main | |
jobs: | |
formatting: | |
name: Check formatting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly | |
components: rustfmt | |
- name: Check formatting | |
shell: bash | |
run: cargo +nightly fmt --all --check | |
check-msrv: | |
name: Check compilation on MSRV toolchain | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: "Fetch base branch" | |
shell: bash | |
run: git fetch origin $GITHUB_BASE_REF --depth 1 | |
- name: Install mold linker | |
uses: rui314/setup-mold@v1 | |
if: ${{ runner.os == 'Linux' }} | |
with: | |
make-default: true | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.67 | |
- uses: Swatinem/[email protected] | |
with: | |
save-if: ${{ github.event_name == 'push' }} | |
- name: Install cargo-hack | |
uses: baptiste0928/[email protected] | |
with: | |
crate: cargo-hack | |
- name: Check files changed | |
shell: bash | |
run: | | |
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/common_enums/; then | |
echo "common_enums_changes_exist=false" >> $GITHUB_ENV | |
else | |
echo "common_enums_changes_exist=true" >> $GITHUB_ENV | |
fi | |
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/common_utils/; then | |
echo "common_utils_changes_exist=false" >> $GITHUB_ENV | |
else | |
echo "common_utils_changes_exist=true" >> $GITHUB_ENV | |
fi | |
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/router/; then | |
echo "router_changes_exist=false" >> $GITHUB_ENV | |
else | |
echo "router_changes_exist=true" >> $GITHUB_ENV | |
fi | |
- name: Cargo hack common_enums | |
if: env.common_enums_changes_exist == 'true' | |
shell: bash | |
run: cargo hack check --each-feature --no-dev-deps -p common_enums | |
- name: Cargo hack common_utils | |
if: env.common_utils_changes_exist == 'true' | |
shell: bash | |
run: cargo hack check --each-feature --no-dev-deps -p common_utils | |
- name: Cargo hack router | |
if: env.router_changes_exist == 'true' | |
shell: bash | |
run: cargo hack check --each-feature --no-dev-deps -p router | |
test: | |
name: Run tests on stable toolchain | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: "Fetch base branch" | |
shell: bash | |
run: git fetch origin $GITHUB_BASE_REF --depth 1 | |
- name: Install mold linker | |
uses: rui314/setup-mold@v1 | |
if: ${{ runner.os == 'Linux' }} | |
with: | |
make-default: true | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: clippy | |
- name: Install cargo-hack | |
uses: baptiste0928/[email protected] | |
with: | |
crate: cargo-hack | |
- uses: Swatinem/[email protected] | |
with: | |
save-if: ${{ github.event_name == 'push' }} | |
- name: Run clippy | |
shell: bash | |
run: cargo clippy --all-features --all-targets | |
- name: Check files changed | |
shell: bash | |
run: | | |
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/common_enums/; then | |
echo "common_enums_changes_exist=false" >> $GITHUB_ENV | |
else | |
echo "common_enums_changes_exist=true" >> $GITHUB_ENV | |
fi | |
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/common_utils/; then | |
echo "common_utils_changes_exist=false" >> $GITHUB_ENV | |
else | |
echo "common_utils_changes_exist=true" >> $GITHUB_ENV | |
fi | |
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/router/; then | |
echo "router_changes_exist=false" >> $GITHUB_ENV | |
else | |
echo "router_changes_exist=true" >> $GITHUB_ENV | |
fi | |
- name: Cargo hack common_enums | |
if: env.common_enums_changes_exist == 'true' | |
shell: bash | |
run: cargo hack check --each-feature --no-dev-deps -p common_enums | |
- name: Cargo hack common_utils | |
if: env.common_utils_changes_exist == 'true' | |
shell: bash | |
run: cargo hack check --each-feature --no-dev-deps -p common_utils | |
- name: Cargo hack router | |
if: env.router_changes_exist == 'true' | |
shell: bash | |
run: cargo hack check --each-feature --no-dev-deps -p router | |
typos: | |
name: Spell check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
with: | |
submodules: recursive | |
- name: Spell check | |
uses: crate-ci/typos@master | |