Fixes clippy warnings #385
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
on: [push, pull_request] | |
env: | |
CARGO_TERM_COLOR: always | |
PQ_DSN: postgres://postgres:root@localhost/ | |
jobs: | |
lint_fmt: | |
name: cargo fmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Check formating | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
lint_clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: clippy | |
- name: Run clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --features v13 | |
tests: | |
name: Tests | |
strategy: | |
matrix: | |
rust: ["stable", "beta", "nightly"] | |
os: ["ubuntu-latest", "macos-latest"] | |
pg: ["11", "12", "13"] | |
mode: ["debug", "release"] | |
exclude: | |
- os: "macos-latest" | |
pg: "10" | |
- os: "macos-latest" | |
pg: "11" | |
- os: "macos-latest" | |
pg: "12" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Install postgreSQL (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt install bc sudo postgresql-${{ matrix.pg }} postgresql-server-dev-${{ matrix.pg }} clang valgrind -y | |
sudo service postgresql start && sleep 3 | |
sudo -u postgres psql --command "ALTER USER postgres PASSWORD 'root';" | |
- name: Install postgreSQL (MacOS) | |
if: matrix.os == 'macos-latest' | |
run: | | |
/usr/local/opt/postgres/bin/pg_ctl -D /usr/local/var/postgres start | |
sleep 3 | |
/usr/local/opt/postgres/bin/createuser --superuser postgres | |
psql --username postgres --command "ALTER USER postgres PASSWORD 'root';" | |
- name: Install postgres (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
choco install postgresql --force --params '/Password:root' | |
- name: Sets feature variable | |
shell: bash | |
run: | | |
if (( $(echo "${{ matrix.pg }} >= 11" | bc -l) )) | |
then | |
echo "feature=v$(echo ${{ matrix.pg }} | sed 's/\./_/')" >> $GITHUB_ENV | |
fi | |
- name: Run tests (debug) | |
if: matrix.mode == 'debug' | |
run: cargo test --workspace --features "${{ env.feature }}" | |
- name: Run tests (release) | |
if: matrix.mode == 'release' | |
run: cargo test --workspace --features "${{ env.feature }}" --release | |
valgrind: | |
name: Memory check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install postgreSQL (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libpq-dev postgresql valgrind | |
sudo service postgresql start && sleep 3 | |
sudo -u postgres psql --command "ALTER USER postgres PASSWORD 'root';" | |
- name: build | |
run: cargo test --no-run --features v13 | |
- name: valgrind | |
run: valgrind --leak-check=full --error-exitcode=1 $(find target/debug/deps -executable -type f) |