Skip to content

Uses C-string literals #343

Uses C-string literals

Uses C-string literals #343

Workflow file for this run

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@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formating
run: cargo fmt -- --check
lint_clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Run clippy
run: cargo clippy --all-features -- --deny warnings
tests:
name: Tests
strategy:
matrix:
rust: ["stable", "beta", "nightly"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
pg: ["10", "11", "12", "13", "14", "15", "16"]
mode: ["debug", "release"]
exclude:
- os: "macos-latest"
pg: "10"
- os: "macos-latest"
pg: "11"
- os: "macos-latest"
pg: "12"
- os: "macos-latest"
pg: "13"
- os: "macos-latest"
pg: "15"
- os: "macos-latest"
pg: "16"
- os: "windows-latest"
pg: "11"
- os: "windows-latest"
pg: "12"
- os: "windows-latest"
pg: "13"
- os: "windows-latest"
pg: "14"
- os: "windows-latest"
pg: "15"
- os: "windows-latest"
pg: "16"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
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 jammy-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: |
PG_SERVICE=$(brew services list | grep -oe "postgresql\S*")
brew services start $PG_SERVICE
sleep 3
BINDIR=$(pg_config --bindir)
$BINDIR/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${{ matrix.pg }} --force --params '/Password:root'
echo "PQ_LIB_DIR=C:\Program Files\PostgreSQL\${{ matrix.pg }}\lib" >> $GITHUB_ENV
- name: Sets feature variable
shell: bash
run: |
if [[ ${{ matrix.pg }} -ge 14 ]]
then
echo "feature=v14" >> $GITHUB_ENV
elif [[ ${{ matrix.pg }} -ge 11 ]]
then
echo "feature=v$(echo ${{ matrix.pg }} | sed 's/\./_/')" >> $GITHUB_ENV
else
echo "feature=default" >> $GITHUB_ENV
fi
- name: Rustup update
run: rustup update
- 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@v3
- uses: dtolnay/rust-toolchain@stable
- name: Install postgreSQL (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 v14
- name: valgrind
run: valgrind --leak-check=full --error-exitcode=1 $(find target/debug/deps -executable -type f -name 'libpq-*')
jemallocator:
name: Allocation check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Install postgreSQL (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: Adds jemallocator
run: |
cargo add tikv-jemallocator
echo '#[global_allocator] static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;' > src/lib.rs
- name: build
run: cargo test --no-run --features v14
- name: valgrind
run: valgrind --leak-check=full --error-exitcode=1 $(find target/debug/deps -executable -type f -name 'libpq-*')
arm:
name: Compilation on ARM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
targets: arm-unknown-linux-gnueabihf
- name: install
run: |
sudo apt-get update
sudo apt-get install -y curl git build-essential
sudo apt-get install -y libc6-armhf-cross libc6-dev-armhf-cross gcc-arm-linux-gnueabihf clang
- name: build
run: cargo build --all-features --target arm-unknown-linux-gnueabihf