Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: split lints + tests into seperate workflows #1357

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,10 @@ jobs:
key: ubuntu-20.04-packages
- name: Install ubuntu packages
run: shotover-proxy/build/install_ubuntu_packages.sh
- name: Install cargo-hack and nextest
- name: Install nextest
uses: taiki-e/install-action@v2
with:
tool: [email protected],[email protected]
- name: Check `cargo fmt` was run
run: cargo fmt --all -- --check
- name: Ensure that all crates compile and have no warnings under every possible combination of features
# some things to explicitly point out:
# * clippy also reports rustc warnings and errors
# * clippy --all-targets causes clippy to run against tests and examples which it doesnt do by default.
run: cargo hack --feature-powerset clippy --all-targets --locked ${{ matrix.cargo_flags }} -- -D warnings
tool: [email protected]
- name: Build tests
run: |
cargo test --doc ${{ matrix.cargo_flags }} --all-features -- --show-output --nocapture
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Formatting and lints

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Cancel already running jobs
concurrency:
group: lints
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
job:
name: Formatting and lints
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
# this line means that only the main branch writes to the cache
# benefits:
# * prevents main branch caches from being evicted in favor of a PR cache
# * saves about 1min per workflow by skipping the actual cache write
# downsides:
# * PRs that update rust version or changes deps will be slow to iterate on due to changes not being cached.
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: cache custom ubuntu packages
uses: actions/cache@v3
with:
path: shotover-proxy/build/packages
key: ubuntu-20.04-packages
- name: Install ubuntu packages
run: shotover-proxy/build/install_ubuntu_packages.sh
- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: Ensure `cargo fmt --all` was run
run: cargo fmt --all -- --check
- name: Ensure that all crates compile and have no warnings under every possible combination of features
# some things to explicitly point out:
# * clippy also reports rustc warnings and errors
# * clippy --all-targets causes clippy to run against tests and examples which it doesnt do by default.
run: cargo hack --feature-powerset clippy --all-targets --locked -- -D warnings
- name: Report disk usage
run: |
df -h

echo -e "\ntarget dir usage:"
du -h $PWD/target

echo -e "\n.cargo dir usage:"
du -h ~/.cargo
- name: Ensure that tests did not create or modify any files that arent .gitignore'd
run: |
if [ -n "$(git status --porcelain)" ]; then
git status
exit 1
fi
Loading