Skip to content

Commit fe827a3

Browse files
authored
Tweak CI and enable for PRs
* Tweak cache strategy for Rust * Tweak cache strategy some more * ci: trigger * Tweak the rest of the CI tasks
1 parent 36d16c5 commit fe827a3

5 files changed

Lines changed: 112 additions & 84 deletions

File tree

.github/workflows/mariadb.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: MariaDB
22

3-
on: [push]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
48

59
jobs:
6-
test:
10+
mariadb:
711

812
runs-on: ubuntu-latest
913

@@ -26,30 +30,34 @@ jobs:
2630
steps:
2731
- uses: actions/checkout@v1
2832

29-
- name: Cache cargo registry
30-
uses: actions/cache@v1
31-
with:
32-
path: ~/.cargo/registry
33-
key: ${{ runner.os }}-mysql-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
34-
35-
- name: Cache cargo index
36-
uses: actions/cache@v1
37-
with:
38-
path: ~/.cargo/git
39-
key: ${{ runner.os }}-mysql-cargo-index-${{ hashFiles('**/Cargo.lock') }}
40-
41-
- name: Cache cargo build
42-
uses: actions/cache@v1
43-
with:
44-
path: target
45-
key: ${{ runner.os }}-mysql-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
33+
# Rust ------------------------------------------------
4634

47-
- name: Setup rust
35+
- name: Install Rust toolchain
4836
uses: actions-rs/toolchain@v1
37+
if: steps.cache_rust.outputs.cache-hit != 'true'
4938
with:
5039
toolchain: stable
40+
profile: minimal
5141
override: true
5242

43+
- name: Cache target/
44+
uses: actions/cache@v1
45+
with:
46+
path: target
47+
key: ${{ runner.os }}-cargo-build-target-mariadb-${{ hashFiles('**/Cargo.lock') }}
48+
49+
# -----------------------------------------------------
50+
5351
- run: cargo test -p sqlx --no-default-features --features 'mysql macros chrono'
5452
env:
5553
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
54+
55+
# Rust ------------------------------------------------
56+
57+
- name: Prepare build directory for cache
58+
run: |
59+
find ./target/debug -maxdepth 1 -type f -delete \
60+
&& rm -fr ./target/debug/{deps,.fingerprint}/*sqlx* \
61+
&& rm -f ./target/.rustc_info.json
62+
63+
# -----------------------------------------------------

.github/workflows/mysql.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: MySQL
22

3-
on: [push]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
48

59
jobs:
6-
test:
10+
mysql:
711

812
runs-on: ubuntu-latest
913

@@ -26,30 +30,34 @@ jobs:
2630
steps:
2731
- uses: actions/checkout@v1
2832

29-
- name: Cache cargo registry
30-
uses: actions/cache@v1
31-
with:
32-
path: ~/.cargo/registry
33-
key: ${{ runner.os }}-mysql-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
34-
35-
- name: Cache cargo index
36-
uses: actions/cache@v1
37-
with:
38-
path: ~/.cargo/git
39-
key: ${{ runner.os }}-mysql-cargo-index-${{ hashFiles('**/Cargo.lock') }}
40-
41-
- name: Cache cargo build
42-
uses: actions/cache@v1
43-
with:
44-
path: target
45-
key: ${{ runner.os }}-mysql-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
33+
# Rust ------------------------------------------------
4634

47-
- name: Setup rust
35+
- name: Install Rust toolchain
4836
uses: actions-rs/toolchain@v1
37+
if: steps.cache_rust.outputs.cache-hit != 'true'
4938
with:
5039
toolchain: stable
40+
profile: minimal
5141
override: true
5242

43+
- name: Cache target/
44+
uses: actions/cache@v1
45+
with:
46+
path: target
47+
key: ${{ runner.os }}-cargo-build-target-mysql-${{ hashFiles('**/Cargo.lock') }}
48+
49+
# -----------------------------------------------------
50+
5351
- run: cargo test -p sqlx --no-default-features --features 'mysql macros chrono'
5452
env:
5553
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx
54+
55+
# Rust ------------------------------------------------
56+
57+
- name: Prepare build directory for cache
58+
run: |
59+
find ./target/debug -maxdepth 1 -type f -delete \
60+
&& rm -fr ./target/debug/{deps,.fingerprint}/*sqlx* \
61+
&& rm -f ./target/.rustc_info.json
62+
63+
# -----------------------------------------------------

.github/workflows/postgres.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: Postgres
22

3-
on: [push]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
48

59
jobs:
6-
test:
10+
postgres:
711

812
runs-on: ubuntu-latest
913

@@ -27,30 +31,34 @@ jobs:
2731
steps:
2832
- uses: actions/checkout@v1
2933

30-
- name: Setup rust
34+
# Rust ------------------------------------------------
35+
36+
- name: Install Rust toolchain
3137
uses: actions-rs/toolchain@v1
38+
if: steps.cache_rust.outputs.cache-hit != 'true'
3239
with:
3340
toolchain: stable
41+
profile: minimal
3442
override: true
3543

36-
- name: Cache cargo registry
37-
uses: actions/cache@v1
38-
with:
39-
path: ~/.cargo/registry
40-
key: ${{ runner.os }}-postgres-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
41-
42-
- name: Cache cargo index
43-
uses: actions/cache@v1
44-
with:
45-
path: ~/.cargo/git
46-
key: ${{ runner.os }}-postgres-cargo-index-${{ hashFiles('**/Cargo.lock') }}
47-
48-
- name: Cache cargo build
44+
- name: Cache target/
4945
uses: actions/cache@v1
5046
with:
5147
path: target
52-
key: ${{ runner.os }}-postgres-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
48+
key: ${{ runner.os }}-cargo-build-target-postgres-${{ hashFiles('**/Cargo.lock') }}
49+
50+
# -----------------------------------------------------
5351

5452
- run: cargo test -p sqlx --no-default-features --features 'postgres macros uuid chrono'
5553
env:
5654
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
55+
56+
# Rust ------------------------------------------------
57+
58+
- name: Prepare build directory for cache
59+
run: |
60+
find ./target/debug -maxdepth 1 -type f -delete \
61+
&& rm -fr ./target/debug/{deps,.fingerprint}/*sqlx* \
62+
&& rm -f ./target/.rustc_info.json
63+
64+
# -----------------------------------------------------

.github/workflows/rust.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Rust
22

3-
on: [push]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
48

59
jobs:
610
build:
@@ -10,38 +14,34 @@ jobs:
1014
steps:
1115
- uses: actions/checkout@v1
1216

13-
- name: Cache rust
14-
id: cache_rust
15-
uses: actions/cache@v1
16-
with:
17-
path: ~/.rustup/toolchains
18-
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
17+
# Rust ------------------------------------------------
1918

20-
- name: Cache cargo registry
21-
uses: actions/cache@v1
22-
with:
23-
path: ~/.cargo/registry
24-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
25-
26-
- name: Cache cargo index
27-
uses: actions/cache@v1
19+
- name: Install Rust toolchain
20+
uses: actions-rs/toolchain@v1
21+
if: steps.cache_rust.outputs.cache-hit != 'true'
2822
with:
29-
path: ~/.cargo/git
30-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
31-
32-
- name: Cache cargo build
23+
toolchain: stable
24+
profile: minimal
25+
override: true
26+
27+
- name: Cache target/
3328
uses: actions/cache@v1
3429
with:
3530
path: target
3631
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
3732

38-
- name: Setup rust
39-
uses: actions-rs/toolchain@v1
40-
if: steps.cache_rust.outputs.cache-hit != 'true'
41-
with:
42-
toolchain: stable
43-
override: true
33+
# -----------------------------------------------------
4434

4535
- run: cargo check --all-features
4636

4737
- run: cargo test -p sqlx-core --all-features
38+
39+
# Rust ------------------------------------------------
40+
41+
- name: Prepare build directory for cache
42+
run: |
43+
find ./target/debug -maxdepth 1 -type f -delete \
44+
&& rm -fr ./target/debug/{deps,.fingerprint}/*sqlx* \
45+
&& rm -f ./target/.rustc_info.json
46+
47+
# -----------------------------------------------------

.github/workflows/rustfmt.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: Format
22

3-
on: [push]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
48

59
jobs:
6-
check:
10+
format:
711

812
runs-on: ubuntu-latest
913

0 commit comments

Comments
 (0)