Skip to content

Commit bc8e919

Browse files
committed
Use cargo-llvm-cov --branch and install postgres
1 parent 93a147c commit bc8e919

File tree

4 files changed

+28
-41
lines changed

4 files changed

+28
-41
lines changed

.deepsource.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version = 1
22
test_patterns = [
3-
"butane/tests/**",
4-
"butane_core/tests/**",
3+
"butane/tests/**",
4+
"butane_core/tests/**",
55
"example/tests/**",
66
]
77

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ indent_size = unset
3737

3838
[LICENSE-APACHE.txt]
3939
indent_size = unset
40+
41+
[deepsource.yml]
42+
max_line_length = 140

.github/workflows/deepsource.yml

+23-36
Original file line numberDiff line numberDiff line change
@@ -18,60 +18,47 @@ jobs:
1818
deepsource:
1919
name: Test and submit
2020
runs-on: ubuntu-22.04
21+
defaults:
22+
run:
23+
shell: bash
2124
steps:
2225
# The checkout must be the PR 'head' sha for deepsource to work
2326
- name: Checkout PR
2427
if: ${{ github.event_name == 'pull_request' }}
25-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2629
with:
2730
ref: ${{ github.event.pull_request.head.sha }}
2831

2932
- name: Checkout PUSH
3033
if: ${{ github.event_name == 'push' }}
31-
uses: actions/checkout@v3
34+
uses: actions/checkout@v4
3235

33-
- uses: actions-rs/toolchain@v1
36+
- name: Install Rust nightly
37+
uses: dtolnay/rust-toolchain@nightly
3438
with:
3539
toolchain: nightly
36-
components: rustfmt
40+
components: llvm-tools-preview,rustfmt
3741

38-
- uses: actions/cache@v3
42+
- name: Install cargo-llvm-cov
43+
uses: taiki-e/install-action@v2
3944
with:
40-
path: |
41-
~/.cargo/bin/
42-
~/.cargo/registry/index/
43-
~/.cargo/registry/cache/
44-
~/.cargo/git/db/
45-
~/.cargo/advisory-dbs/
46-
key: ${{ runner.os }}-coverage-${{ hashFiles('**/Cargo.lock') }}
47-
restore-keys: |
48-
${{ runner.os }}-coverage
45+
tool: cargo-llvm-cov
4946

50-
# coverage needs a nightly toolchain
51-
- name: Run test suite
52-
run: |
53-
rustup toolchain install nightly --allow-downgrade
54-
cargo +nightly test --all-features --no-fail-fast ||:
55-
env:
56-
CARGO_INCREMENTAL: "0"
57-
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=unwind"
58-
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=unwind"
59-
60-
- name: Install grcov
47+
- name: Setup postgres on Linux
48+
# Postgresql setup adapted from Diesel CI
49+
# Disable ssl as server doesn't have a trusted cert
50+
if: runner.os == 'Linux'
6151
run: |
62-
cargo +stable install grcov || true
52+
sudo apt-get update
53+
sudo apt-get install -y postgresql
54+
sudo sed -i "s/scram-sha-256/trust/" /etc/postgresql/14/main/pg_hba.conf
55+
sudo cat /etc/postgresql/14/main/pg_hba.conf
56+
sudo service postgresql restart && sleep 3
57+
echo BUTANE_PG_CONNSTR="host=localhost user=postgres sslmode=disable port=5432" >> $GITHUB_ENV
6358
64-
- name: Run coverage
65-
id: coverage
66-
uses: actions-rs/[email protected]
67-
with:
68-
config: .grcov.yaml
69-
70-
# DeepSource limits the size of the coverage data file to 50 MB
71-
- name: Move coverage file
59+
- name: Run test suite
7260
run: |
73-
mv ${{ steps.coverage.outputs.report }} ./coverage.xml
74-
ls -al ./coverage.xml
61+
cargo +nightly llvm-cov test --cobertura --output-path coverage.xml --branch --workspace --no-fail-fast --all-features
7562
7663
- name: Install deepsource cli
7764
run: |

.grcov.yaml

-3
This file was deleted.

0 commit comments

Comments
 (0)