-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use cargo-llvm-cov and install postgres
- Loading branch information
Showing
4 changed files
with
33 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,6 @@ indent_size = unset | |
|
||
[LICENSE-APACHE.txt] | ||
indent_size = unset | ||
|
||
[deepsource.yml] | ||
max_line_length = 140 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,60 +18,52 @@ jobs: | |
deepsource: | ||
name: Test and submit | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
# The checkout must be the PR 'head' sha for deepsource to work | ||
- name: Checkout PR | ||
if: ${{ github.event_name == 'pull_request' }} | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Checkout PUSH | ||
if: ${{ github.event_name == 'push' }} | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
- name: Install Rust stable with llvm-tools-preview | ||
uses: actions-rust-lang/[email protected] | ||
with: | ||
components: llvm-tools-preview | ||
|
||
- name: Install Rust nightly with rustfmt | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
components: rustfmt | ||
|
||
- uses: actions/cache@v3 | ||
- name: Install cargo-llvm-cov | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
~/.cargo/advisory-dbs/ | ||
key: ${{ runner.os }}-coverage-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-coverage | ||
# coverage needs a nightly toolchain | ||
- name: Run test suite | ||
run: | | ||
rustup toolchain install nightly --allow-downgrade | ||
cargo +nightly test --all-features --no-fail-fast ||: | ||
env: | ||
CARGO_INCREMENTAL: "0" | ||
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=unwind" | ||
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=unwind" | ||
tool: cargo-llvm-cov | ||
|
||
- name: Install grcov | ||
run: | | ||
cargo +stable install grcov || true | ||
- name: Setup postgres on Linux | ||
# Postgresql setup adapted from Diesel CI | ||
# Disable ssl as server doesn't have a trusted cert | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y postgresql | ||
sudo sed -i "s/scram-sha-256/trust/" /etc/postgresql/14/main/pg_hba.conf | ||
sudo cat /etc/postgresql/14/main/pg_hba.conf | ||
sudo service postgresql restart && sleep 3 | ||
echo BUTANE_PG_CONNSTR="host=localhost user=postgres sslmode=disable port=5432" >> $GITHUB_ENV | ||
- name: Run coverage | ||
id: coverage | ||
uses: actions-rs/[email protected] | ||
with: | ||
config: .grcov.yaml | ||
|
||
# DeepSource limits the size of the coverage data file to 50 MB | ||
- name: Move coverage file | ||
- name: Run test suite | ||
run: | | ||
mv ${{ steps.coverage.outputs.report }} ./coverage.xml | ||
ls -al ./coverage.xml | ||
cargo llvm-cov test --cobertura --output-path coverage.xml --workspace --no-fail-fast --all-features | ||
- name: Install deepsource cli | ||
run: | | ||
|
This file was deleted.
Oops, something went wrong.