mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Rework github actions, add code coverage (#186)
This reworks our GitHub Actions workflow to include code coverage via tarpaulin. Fixes #164.
This commit is contained in:
parent
6e6fae73a0
commit
af54eb02b2
1 changed files with 58 additions and 23 deletions
81
.github/workflows/rust.yml
vendored
81
.github/workflows/rust.yml
vendored
|
@ -1,30 +1,65 @@
|
|||
name: Rust
|
||||
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
codestyle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Rust
|
||||
uses: hecrj/setup-rust-action@v1
|
||||
with:
|
||||
components: rustfmt
|
||||
# Note that `nightly` is required for `license_template_path`, as
|
||||
# it's an unstable feature.
|
||||
rust-version: nightly
|
||||
- uses: actions/checkout@v2
|
||||
- run: cargo fmt -- --check --config-path <(echo 'license_template_path = "HEADER"')
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Rust
|
||||
uses: hecrj/setup-rust-action@v1
|
||||
with:
|
||||
components: clippy
|
||||
- uses: actions/checkout@v2
|
||||
- run: cargo clippy --all-targets --all-features -- -D warnings
|
||||
|
||||
compile:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Rust
|
||||
uses: hecrj/setup-rust-action@v1
|
||||
- uses: actions/checkout@master
|
||||
- run: cargo check --all-targets --all-features
|
||||
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
rust: [stable, beta, nightly]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Setup Rust
|
||||
run: |
|
||||
rustup toolchain install nightly --profile default
|
||||
rustup toolchain install stable
|
||||
rustup override set stable
|
||||
# Clippy must be run first, as its lints are only triggered during
|
||||
# compilation. Put another way: after a successful `cargo build`, `cargo
|
||||
# clippy` is guaranteed to produce no results. This bug is known upstream:
|
||||
# https://github.com/rust-lang/rust-clippy/issues/2604.
|
||||
# - name: Clippy
|
||||
# run: cargo clippy -- --all-targets --all-features -- -D warnings
|
||||
- name: Check formatting
|
||||
run: |
|
||||
cargo +nightly fmt -- --check --config-path <(echo 'license_template_path = "HEADER"')
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
- name: Run tests
|
||||
run: cargo test --verbose
|
||||
- name: Run tests for all features
|
||||
run: cargo test --verbose -- all-features
|
||||
uses: hecrj/setup-rust-action@v1
|
||||
with:
|
||||
rust-version: ${{ matrix.rust }}
|
||||
- name: Install Tarpaulin
|
||||
uses: actions-rs/install@v0.1
|
||||
with:
|
||||
crate: cargo-tarpaulin
|
||||
version: 0.13.3
|
||||
use-tool-cache: true
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Test
|
||||
run: cargo test --all-features
|
||||
- name: Coverage
|
||||
if: matrix.rust == 'stable'
|
||||
run: cargo tarpaulin -o Lcov --output-dir ./coverage
|
||||
- name: Coveralls
|
||||
if: matrix.rust == 'stable'
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue