Skip to content

Commit 794e694

Browse files
author
Julius de Bruijn
authored
Run tests on GitHub actions (prisma#277)
* Run tests on GitHub actions * Warnings as errors * Add mysql8 test image * Generate rustdoc * Sleep before starting the tests * Delete buildkite files
1 parent 4d70fce commit 794e694

File tree

5 files changed

+192
-131
lines changed

5 files changed

+192
-131
lines changed

.buildkite/docker.sh

-55
This file was deleted.

.buildkite/pipeline.sh

-41
This file was deleted.

.buildkite/publish_rustdoc.sh

-35
This file was deleted.

.github/workflows/test.yml

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Cargo tests
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
clippy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- uses: actions-rs/toolchain@v1
13+
with:
14+
toolchain: nightly
15+
components: clippy
16+
override: true
17+
- name: Install dependencies
18+
run: sudo apt install -y openssl libkrb5-dev
19+
- uses: actions-rs/clippy-check@v1
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
args: --features=all
23+
24+
format:
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
- uses: actions-rs/toolchain@v1
30+
with:
31+
toolchain: stable
32+
components: rustfmt
33+
override: true
34+
- uses: mbrobbel/rustfmt-check@master
35+
with:
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
38+
cargo-test:
39+
runs-on: ubuntu-latest
40+
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
features:
45+
- "--lib --features=all"
46+
- "--lib --no-default-features --features=sqlite"
47+
- "--lib --no-default-features --features=sqlite --features=chrono --features=json --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
48+
- "--lib --no-default-features --features=postgresql"
49+
- "--lib --no-default-features --features=postgresql --features=chrono --features=json --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
50+
- "--lib --no-default-features --features=mysql"
51+
- "--lib --no-default-features --features=mysql --features=chrono --features=json --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
52+
- "--lib --no-default-features --features=mssql"
53+
- "--lib --no-default-features --features=mssql --features=chrono --features=json --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
54+
- "--doc --features=all"
55+
env:
56+
TEST_MYSQL: "mysql://root:prisma@localhost:3306/prisma"
57+
TEST_MYSQL8: "mysql://root:prisma@localhost:3307/prisma"
58+
TEST_PSQL: "postgres://postgres:prisma@localhost:5432/postgres"
59+
TEST_MSSQL: "jdbc:sqlserver://localhost:1433;database=master;user=SA;password=<YourStrong@Passw0rd>;trustServerCertificate=true"
60+
RUSTFLAGS: "-Dwarnings"
61+
62+
steps:
63+
- uses: actions/checkout@v2
64+
65+
- uses: actions-rs/toolchain@v1
66+
with:
67+
toolchain: stable
68+
69+
- uses: actions/cache@v2
70+
with:
71+
path: |
72+
~/.cargo/registry
73+
~/.cargo/git
74+
target
75+
key: ${{ runner.os }}-cargo-${{ matrix.features }}
76+
77+
- name: Start Databases
78+
run: docker-compose -f docker-compose.yml up -d
79+
80+
- name: Sleep for 20s
81+
uses: juliangruber/sleep-action@v1
82+
with:
83+
time: 20s
84+
85+
- name: Run tests
86+
run: cargo test ${{ matrix.features }}
87+
88+
rustdoc:
89+
needs: [clippy, format, cargo-test]
90+
runs-on: ubuntu-latest
91+
if: github.ref == 'refs/heads/master'
92+
93+
steps:
94+
- uses: actions/checkout@v2
95+
96+
- uses: actions-rs/toolchain@v1
97+
with:
98+
toolchain: nightly
99+
100+
- uses: actions/cache@v2
101+
with:
102+
path: |
103+
~/.cargo/registry
104+
~/.cargo/git
105+
target
106+
key: linux-cargo-rustdoc
107+
108+
- name: Generate documentation
109+
run: |
110+
cargo rustdoc --all-features
111+
- name: Commit changes
112+
run: |
113+
git config user.name "GitHub agent"
114+
git config user.email "[email protected]"
115+
116+
rm -rf deploy_docs
117+
git clone --branch gh-pages "[email protected]:prisma/quaint.git" deploy_docs > /dev/null 2>&1
118+
rm -rf deploy_docs/*
119+
mv target/doc/* deploy_docs/
120+
echo "<meta http-equiv=refresh content=0;url=quaint/index.html>" > deploy_docs/index.html
121+
122+
DIFF=$(git status -s)
123+
printf "$DIFF\n"
124+
125+
if [ -z "$DIFF" ]
126+
then
127+
echo "Nothing to do"
128+
else
129+
git -C deploy_docs add -A .
130+
git -C deploy_docs commit -m "Add changes"
131+
fi
132+
- name: Push changes
133+
uses: ad-m/github-push-action@master
134+
with:
135+
github_token: ${{ secrets.GITHUB_TOKEN }}
136+
branch: gh-pages
137+
directory: deploy_docs

docker-compose.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
version: "3"
2+
services:
3+
postgres13:
4+
image: postgres:13
5+
restart: always
6+
command: postgres -c 'max_connections=1000'
7+
environment:
8+
POSTGRES_PASSWORD: "prisma"
9+
PGDATA: "/pgtmpfs13"
10+
ports:
11+
- "5432:5432"
12+
networks:
13+
- databases
14+
tmpfs: /pgtmpfs12
15+
16+
mysql57:
17+
image: mysql:5.7
18+
command: mysqld
19+
restart: always
20+
environment:
21+
MYSQL_ROOT_PASSWORD: prisma
22+
MYSQL_DATABASE: prisma
23+
ports:
24+
- "3306:3306"
25+
networks:
26+
- databases
27+
tmpfs: /var/lib/mysql5.7
28+
29+
mysql8:
30+
image: mysql:8.0.22
31+
command: mysqld
32+
restart: always
33+
environment:
34+
MYSQL_USER: root
35+
MYSQL_ROOT_PASSWORD: prisma
36+
MYSQL_DATABASE: prisma
37+
ports:
38+
- "3307:3306"
39+
networks:
40+
- databases
41+
tmpfs: /var/lib/mysql8
42+
43+
mssql:
44+
image: mcr.microsoft.com/mssql/server:2019-latest
45+
restart: always
46+
environment:
47+
ACCEPT_EULA: "Y"
48+
SA_PASSWORD: "<YourStrong@Passw0rd>"
49+
ports:
50+
- "1433:1433"
51+
networks:
52+
- databases
53+
54+
networks:
55+
databases:

0 commit comments

Comments
 (0)