Skip to content

Commit

Permalink
Merge pull request #103 from kitsuyui/update-ci
Browse files Browse the repository at this point in the history
Update CI
  • Loading branch information
kitsuyui authored Jan 14, 2023
2 parents a3daaa5 + acdc985 commit de1fa77
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,17 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview

- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: Swatinem/rust-cache@v2
- run: cargo build --release --all-features

- name: publish (dry-run)
if: github.event_name == 'release' && github.event.release.prerelease
run: cargo publish --dry-run
run: cargo publish --dry-run --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

- name: publish
if: github.event_name == 'release' && !github.event.release.prerelease
run: cargo publish
run: cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
79 changes: 54 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,71 @@
name: tests
on: [push]

jobs:
tests:
name: tests
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview

- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- run: cargo fmt --all -- --check

- run: cargo clippy --all-targets --all-features -- -D warnings
- uses: Swatinem/rust-cache@v2
- run: cargo check

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test
env:
# using in tests for gh
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: cargo build --release --all-features
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check

- name: coverage
run: |
cargo install cargo-llvm-cov || true # when already cached
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy -- -D warnings

build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build

coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- run: |
cargo install cargo-llvm-cov || true
cargo llvm-cov --lcov --output-path coverage.lcov
env:
# using in tests for gh
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage report to Codecov
Expand All @@ -46,5 +75,5 @@ jobs:
files: ./coverage.lcov
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
fail_ci_if_error: false
verbose: true

0 comments on commit de1fa77

Please sign in to comment.