diff --git a/.deepsource.toml b/.deepsource.toml index f9b3ee0..4c961c7 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -1,7 +1,7 @@ version = 1 test_patterns = [ - "butane/tests/**", - "butane_core/tests/**", + "butane/tests/**", + "butane_core/tests/**", "example/tests/**", ] diff --git a/.editorconfig b/.editorconfig index 1362039..3062345 100644 --- a/.editorconfig +++ b/.editorconfig @@ -37,3 +37,6 @@ indent_size = unset [LICENSE-APACHE.txt] indent_size = unset + +[deepsource.yml] +max_line_length = 140 diff --git a/.github/workflows/deepsource.yml b/.github/workflows/deepsource.yml index e964714..a1b5c90 100644 --- a/.github/workflows/deepsource.yml +++ b/.github/workflows/deepsource.yml @@ -18,60 +18,47 @@ 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 nightly + uses: dtolnay/rust-toolchain@nightly with: toolchain: nightly - components: rustfmt + components: llvm-tools-preview,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 + tool: cargo-llvm-cov - # 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" - - - name: Install grcov - run: | - cargo +stable install grcov || true - - - name: Run coverage - id: coverage - uses: actions-rs/grcov@v0.1 - with: - config: .grcov.yaml + - 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 - # 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 +nightly llvm-cov test --cobertura --output-path coverage.xml --branch --workspace --no-fail-fast --all-features - name: Install deepsource cli run: | diff --git a/.grcov.yaml b/.grcov.yaml deleted file mode 100644 index 5f4c04c..0000000 --- a/.grcov.yaml +++ /dev/null @@ -1,3 +0,0 @@ -branch: true -ignore-not-existing: true -llvm: true