mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Replace PostgreSQL service with several docker containers in ci.yml
This commit is contained in:
parent
3565186d61
commit
fa32ff762e
3 changed files with 12 additions and 22 deletions
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
|
@ -74,18 +74,6 @@ jobs:
|
|||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
# Setup Postgres for testing PostgresStorage
|
||||
postgres:
|
||||
image: postgres
|
||||
|
||||
volumes:
|
||||
- init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
|
||||
env:
|
||||
POSTGRES_USER: teloxide
|
||||
POSTGRES_PASSWORD: rewrite_it_in_rust
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
rust:
|
||||
|
@ -131,7 +119,11 @@ jobs:
|
|||
redis-server --port 7777 > /dev/null &
|
||||
redis-server --port 7778 > /dev/null &
|
||||
redis-server --port 7779 > /dev/null &
|
||||
|
||||
- name: Start PostgreSQL servers
|
||||
run: |
|
||||
docker run -d -p 5432:5432 -e POSTGRES_USER=teloxide -e POSTGRES_PASSWORD=rewrite_it_in_rust -e POSTGRES_DB=test_postgres_json postgres
|
||||
docker run -d -p 5433:5432 -e POSTGRES_USER=teloxide -e POSTGRES_PASSWORD=rewrite_it_in_rust -e POSTGRES_DB=test_postgres_bincode postgres
|
||||
docker run -d -p 5434:5432 -e POSTGRES_USER=teloxide -e POSTGRES_PASSWORD=rewrite_it_in_rust -e POSTGRES_DB=test_postgres_cbor postgres
|
||||
- name: Test unit & integration tests
|
||||
run: |
|
||||
cargo +${{ matrix.toolchain }} test --tests --verbose ${{ matrix.features }}
|
||||
|
|
4
.github/workflows/init.sql
vendored
4
.github/workflows/init.sql
vendored
|
@ -1,4 +0,0 @@
|
|||
CREATE ROLE teloxide WITH LOGIN SUPERUSER PASSWORD 'rewrite_it_in_rust'
|
||||
CREATE DATABASE test_postgres_json;
|
||||
CREATE DATABASE test_postgres_bincode;
|
||||
CREATE_DATABASE test_postgres_cbor;
|
|
@ -7,12 +7,14 @@ use teloxide::{
|
|||
types::ChatId,
|
||||
};
|
||||
|
||||
// These examples are meant to run under the CI with the postgres service
|
||||
// Were checked locally
|
||||
#[tokio::test]
|
||||
#[cfg_attr(not(CI_POSTGRES), ignore)]
|
||||
async fn test_postgres_json() {
|
||||
let storage = PostgresStorage::open(
|
||||
"postgres://teloxide:rewrite_it_in_rust@localhost:5432/test_postgres_json",
|
||||
4,
|
||||
1,
|
||||
teloxide::dispatching::dialogue::serializer::Json,
|
||||
)
|
||||
.await
|
||||
|
@ -25,8 +27,8 @@ async fn test_postgres_json() {
|
|||
#[cfg_attr(not(CI_POSTGRES), ignore)]
|
||||
async fn test_postgres_bincode() {
|
||||
let storage = PostgresStorage::open(
|
||||
"postgres://teloxide:rewrite_it_in_rust@localhost:5432/test_postgres_bincode",
|
||||
4,
|
||||
"postgres://teloxide:rewrite_it_in_rust@localhost:5433/test_postgres_bincode",
|
||||
1,
|
||||
teloxide::dispatching::dialogue::serializer::Bincode,
|
||||
)
|
||||
.await
|
||||
|
@ -39,8 +41,8 @@ async fn test_postgres_bincode() {
|
|||
#[cfg_attr(not(CI_POSTGRES), ignore)]
|
||||
async fn test_postgres_cbor() {
|
||||
let storage = PostgresStorage::open(
|
||||
"postgres://teloxide:rewrite_it_in_rust@localhost:5432/test_postgres_cbor",
|
||||
4,
|
||||
"postgres://teloxide:rewrite_it_in_rust@localhost:5434/test_postgres_cbor",
|
||||
1,
|
||||
teloxide::dispatching::dialogue::serializer::Cbor,
|
||||
)
|
||||
.await
|
||||
|
|
Loading…
Reference in a new issue