Skip to content

Commit 8febcfa

Browse files
authored
feat: migrate from deprecated actions-rs to dtolnay/rust-toolchain (#104)
1 parent 6c68d84 commit 8febcfa

File tree

3 files changed

+32
-126
lines changed

3 files changed

+32
-126
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@ jobs:
2020
uses: actions/checkout@master
2121

2222
- name: Install Rust toolchain
23-
uses: actions-rs/toolchain@v1
23+
uses: dtolnay/rust-toolchain@master
2424
with:
25-
profile: minimal
2625
toolchain: ${{ matrix.rust }}
2726
components: rustfmt, clippy
28-
override: true
27+
28+
- name: Cargo Clippy
29+
run: cargo clippy -- -D warnings
30+
31+
- name: Cargo Fmt Check
32+
run: cargo fmt --all -- --check
33+
34+
- name: Cargo Build
35+
run: cargo build
2936

3037
- name: Setup PostgreSQL & MySQL & SQLite (for ubuntu)
3138
if: matrix.os == 'ubuntu-latest'
@@ -48,12 +55,8 @@ jobs:
4855
- name: Setup PostgreSQL & MySQL & SQLite (for macOS)
4956
if: matrix.os == 'macOS-latest'
5057
run: |
51-
# Unlink and re-link to prevent errors when github mac runner images
52-
# https://github.com/actions/setup-python/issues/577
53-
brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done
54-
5558
brew update
56-
brew install postgresql mariadb sqlite
59+
brew install postgresql mariadb
5760
brew services start postgresql
5861
# pg_ctl -D /usr/local/var/postgres start
5962
sleep 3
@@ -137,127 +140,32 @@ jobs:
137140
v3 VARCHAR(128) NOT NULL,
138141
v4 VARCHAR(128) NOT NULL,
139142
v5 VARCHAR(128) NOT NULL,
140-
CONSTRAINT unique_key_diesel_adapter UNIQUE(ptype, v0, v1, v2, v3, v4, v5)
143+
CONSTRAINT unique_key_sqlx_adapter UNIQUE(ptype, v0, v1, v2, v3, v4, v5)
141144
);"
142145
143-
- name: Cargo Build
144-
uses: actions-rs/cargo@v1
145-
with:
146-
command: build
147-
148-
# PostgreSQL tests
149-
# async-std
150-
- name: Cargo Test For PostgreSQL,runtime-async-std-native-tls
151-
uses: actions-rs/cargo@v1
146+
- name: Cargo Test For PostgreSQL
152147
env:
153148
DATABASE_URL: postgres://casbin_rs:casbin_rs@localhost:5432/casbin
154-
with:
155-
command: test
156-
args: --no-default-features --features postgres,runtime-async-std-native-tls
157-
158-
- name: Cargo Test For PostgreSQL,runtime-async-std-rustls
159-
uses: actions-rs/cargo@v1
160-
env:
161-
DATABASE_URL: postgres://casbin_rs:casbin_rs@localhost:5432/casbin
162-
with:
163-
command: test
164-
args: --no-default-features --features postgres,runtime-async-std-rustls
165-
166-
# tokio
167-
- name: Cargo Test For PostgreSQL,runtime-tokio-native-tls
168-
uses: actions-rs/cargo@v1
169-
env:
170-
DATABASE_URL: postgres://casbin_rs:casbin_rs@localhost:5432/casbin
171-
with:
172-
command: test
173-
args: --no-default-features --features postgres,runtime-tokio-native-tls
174-
175-
- name: Cargo Test For PostgreSQL,runtime-tokio-rustls
176-
uses: actions-rs/cargo@v1
177-
env:
178-
DATABASE_URL: postgres://casbin_rs:casbin_rs@localhost:5432/casbin
179-
with:
180-
command: test
181-
args: --no-default-features --features postgres,runtime-tokio-rustls
182-
183-
# MySQL
184-
# async-std
185-
- name: Cargo Test For MySQL,runtime-async-std-native-tls
186-
uses: actions-rs/cargo@v1
187-
env:
188-
DATABASE_URL: mysql://casbin_rs:casbin_rs@localhost:3306/casbin
189-
with:
190-
command: test
191-
args: --no-default-features --features mysql,runtime-async-std-native-tls
192-
193-
- name: Cargo Test For MySQL,runtime-async-std-rustls
194-
uses: actions-rs/cargo@v1
195-
env:
196-
DATABASE_URL: mysql://casbin_rs:casbin_rs@localhost:3306/casbin
197-
with:
198-
command: test
199-
args: --no-default-features --features mysql,runtime-async-std-rustls
200-
201-
# tokio
202-
- name: Cargo Test For MySQL,runtime-tokio-native-tls
203-
uses: actions-rs/cargo@v1
204-
env:
205-
DATABASE_URL: mysql://casbin_rs:casbin_rs@localhost:3306/casbin
206-
with:
207-
command: test
208-
args: --no-default-features --features mysql,runtime-tokio-native-tls
149+
run: |
150+
cargo test --no-default-features --features postgres,runtime-async-std-native-tls
151+
cargo test --no-default-features --features postgres,runtime-async-std-rustls
152+
cargo test --no-default-features --features postgres,runtime-tokio-native-tls
153+
cargo test --no-default-features --features postgres,runtime-tokio-rustls
209154
210-
- name: Cargo Test For MySQL,runtime-tokio-rustls
211-
uses: actions-rs/cargo@v1
155+
- name: Cargo Test For MySQL
212156
env:
213157
DATABASE_URL: mysql://casbin_rs:casbin_rs@localhost:3306/casbin
214-
with:
215-
command: test
216-
args: --no-default-features --features mysql,runtime-tokio-rustls
217-
218-
#SQLite
219-
#async-std
220-
- name: Cargo Test For SQLite,runtime-async-std-native-tls
221-
uses: actions-rs/cargo@v1
222-
env:
223-
DATABASE_URL: sqlite:casbin.db
224-
with:
225-
command: test
226-
args: --no-default-features --features sqlite,runtime-async-std-native-tls
227-
228-
- name: Cargo Test For SQLite,runtime-async-std-rustls
229-
uses: actions-rs/cargo@v1
230-
env:
231-
DATABASE_URL: sqlite:casbin.db
232-
with:
233-
command: test
234-
args: --no-default-features --features sqlite,runtime-async-std-rustls
235-
236-
# tokio
237-
- name: Cargo Test For SQLite,runtime-tokio-native-tls
238-
uses: actions-rs/cargo@v1
239-
env:
240-
DATABASE_URL: sqlite:casbin.db
241-
with:
242-
command: test
243-
args: --no-default-features --features sqlite,runtime-tokio-native-tls
158+
run: |
159+
cargo test --no-default-features --features mysql,runtime-async-std-native-tls
160+
cargo test --no-default-features --features mysql,runtime-async-std-rustls
161+
cargo test --no-default-features --features mysql,runtime-tokio-native-tls
162+
cargo test --no-default-features --features mysql,runtime-tokio-rustls
244163
245-
- name: Cargo Test For SQLite,runtime-tokio-rustls
246-
uses: actions-rs/cargo@v1
164+
- name: Cargo Test For SQLite
247165
env:
248166
DATABASE_URL: sqlite:casbin.db
249-
with:
250-
command: test
251-
args: --no-default-features --features sqlite,runtime-tokio-rustls
252-
253-
- name: Cargo Clippy
254-
uses: actions-rs/cargo@v1
255-
with:
256-
command: clippy
257-
args: -- -D warnings
258-
259-
- name: Cargo Fmt Check
260-
uses: actions-rs/cargo@v1
261-
with:
262-
command: fmt
263-
args: --all -- --check
167+
run: |
168+
cargo test --no-default-features --features sqlite,runtime-async-std-native-tls
169+
cargo test --no-default-features --features sqlite,runtime-async-std-rustls
170+
cargo test --no-default-features --features sqlite,runtime-tokio-native-tls
171+
cargo test --no-default-features --features sqlite,runtime-tokio-rustls

.github/workflows/coverage.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ jobs:
2929
uses: actions/checkout@master
3030

3131
- name: Install Rust toolchain
32-
uses: actions-rs/toolchain@v1
32+
uses: dtolnay/rust-toolchain@master
3333
with:
34-
profile: minimal
3534
toolchain: stable
36-
override: true
3735

3836
- name: Install PostgreSQL Dependencies
3937
run: sudo apt-get install libpq-dev postgresql-client

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ tokio = { version = "1.1.1", features = ["macros"] }
151151
v3 VARCHAR(128) NOT NULL,
152152
v4 VARCHAR(128) NOT NULL,
153153
v5 VARCHAR(128) NOT NULL,
154-
CONSTRAINT unique_key_diesel_adapter UNIQUE(ptype, v0, v1, v2, v3, v4, v5)
154+
CONSTRAINT unique_key_sqlx_adapter UNIQUE(ptype, v0, v1, v2, v3, v4, v5)
155155
);"
156156
```
157157

0 commit comments

Comments
 (0)