mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-22 15:04:04 +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
|
name: Rust
|
||||||
|
|
||||||
on: [push]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
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:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Setup Rust
|
- name: Setup Rust
|
||||||
run: |
|
uses: hecrj/setup-rust-action@v1
|
||||||
rustup toolchain install nightly --profile default
|
with:
|
||||||
rustup toolchain install stable
|
rust-version: ${{ matrix.rust }}
|
||||||
rustup override set stable
|
- name: Install Tarpaulin
|
||||||
# Clippy must be run first, as its lints are only triggered during
|
uses: actions-rs/install@v0.1
|
||||||
# compilation. Put another way: after a successful `cargo build`, `cargo
|
with:
|
||||||
# clippy` is guaranteed to produce no results. This bug is known upstream:
|
crate: cargo-tarpaulin
|
||||||
# https://github.com/rust-lang/rust-clippy/issues/2604.
|
version: 0.13.3
|
||||||
# - name: Clippy
|
use-tool-cache: true
|
||||||
# run: cargo clippy -- --all-targets --all-features -- -D warnings
|
- name: Checkout
|
||||||
- name: Check formatting
|
uses: actions/checkout@v2
|
||||||
run: |
|
- name: Test
|
||||||
cargo +nightly fmt -- --check --config-path <(echo 'license_template_path = "HEADER"')
|
run: cargo test --all-features
|
||||||
- name: Build
|
- name: Coverage
|
||||||
run: cargo build --verbose
|
if: matrix.rust == 'stable'
|
||||||
- name: Run tests
|
run: cargo tarpaulin -o Lcov --output-dir ./coverage
|
||||||
run: cargo test --verbose
|
- name: Coveralls
|
||||||
- name: Run tests for all features
|
if: matrix.rust == 'stable'
|
||||||
run: cargo test --verbose -- all-features
|
uses: coverallsapp/github-action@master
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue