Skip to content

Commit

Permalink
Merge pull request #80 from kana-rus/use_taskfile_in_ci
Browse files Browse the repository at this point in the history
FIX: README format, Taskfile, workflows
  • Loading branch information
kanarus authored Feb 7, 2024
2 parents e2ba157 + 9346dec commit 78d810b
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 141 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI
on:
pull_request:
push:
branches:
- main

jobs:
CI:
runs-on: ubuntu-latest

strategy:
matrix:
toolchain: ['stable', 'nightly']

steps:
- uses: actions/checkout@v4

- name: Install task command
run: sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
override: true

- name: Cache cargo tools
id: cache_cargo_tools
uses: actions/cache@v3
with:
key: ${{ runner.os }}-cargo-install
path: ~/.cargo/bin
- name: Install cargo tools
if: ${{ steps.cache_cargo_tools.outputs.cache-hit != 'true' }}
run: cargo install sqlx-cli --no-default-features --features native-tls,postgres

- name: Run tasks
run: task test check ${{ matrix.toolchain == 'nightly' && 'bench' || '' }}
54 changes: 0 additions & 54 deletions .github/workflows/check.yml

This file was deleted.

63 changes: 0 additions & 63 deletions .github/workflows/test.yml

This file was deleted.

5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
- *multi runtime* support:`tokio`, `async-std`

<div align="right">
<img alt="build check status of ohkami" src="https://github.com/kana-rus/ohkami/actions/workflows/check.yml/badge.svg"/>
<img alt="test status of ohkami" src="https://github.com/kana-rus/ohkami/actions/workflows/test.yml/badge.svg"/>
<img alt="build check status of ohkami" src="https://github.com/kana-rus/ohkami/actions/workflows/CI.yml/badge.svg"/>
</div>

<br>
Expand Down Expand Up @@ -243,7 +242,5 @@ async fn test_my_ohkami() {
## MSRV (Minimum Supported Rust Version)
Latest stable.

<br>

## License
`ohkami` is licensed under MIT LICENSE ([LICENSE-MIT](https://github.com/kana-rus/ohkami/blob/main/LICENSE-MIT) or [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT)).
104 changes: 87 additions & 17 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,93 @@
version: '3'

tasks:
test_rt_async-std:
test:
deps:
- test_doc
- test_rt_tokio
- test_rt_tokio_with_custom-header
- test_rt_async-std
- test_rt_async-std_with_custom-header
- test_examples

check:
deps:
- check_rt_tokio
- check_rt_async-std

bench:
dir: benches
cmds:
- cargo bench

#### tests ####
test_doc:
dir: ohkami
cmds:
- cargo test --no-default-features --features rt_tokio
- cargo test --no-default-features --features rt_tokio,utils
- cargo test --no-default-features --features rt_tokio,testing
- cargo test --no-default-features --features rt_tokio,utils,testing
- cargo test --no-default-features --features custom-header,rt_tokio
- cargo test --no-default-features --features custom-header,rt_tokio,utils
- cargo test --no-default-features --features custom-header,rt_tokio,testing
- cargo test --no-default-features --features custom-header,rt_tokio,utils,testing
- cargo test --doc --features DEBUG,rt_tokio
- cargo test --doc --features DEBUG,rt_tokio,custom-header

test_rt_tokio:
dir: ohkami
cmds:
- cargo test --lib --no-default-features --features DEBUG,rt_tokio
- cargo test --lib --no-default-features --features DEBUG,rt_tokio,utils
- cargo test --lib --no-default-features --features DEBUG,rt_tokio,testing
- cargo test --lib --no-default-features --features DEBUG,rt_tokio,utils,testing
test_rt_tokio_with_custom-header:
dir: ohkami
cmds:
- cargo test --lib --no-default-features --features DEBUG,custom-header,rt_tokio
- cargo test --lib --no-default-features --features DEBUG,custom-header,rt_tokio,utils
- cargo test --lib --no-default-features --features DEBUG,custom-header,rt_tokio,testing
- cargo test --lib --no-default-features --features DEBUG,custom-header,rt_tokio,utils,testing

test_rt_async-std:
dir: ohkami
cmds:
- cargo test --lib --no-default-features --features DEBUG,rt_async-std
- cargo test --lib --no-default-features --features DEBUG,rt_async-std,utils
- cargo test --lib --no-default-features --features DEBUG,rt_async-std,testing
- cargo test --lib --no-default-features --features DEBUG,rt_async-std,utils,testing
test_rt_async-std_with_custom-header:
dir: ohkami
cmds:
- cargo test --lib --no-default-features --features DEBUG,custom-header,rt_async-std
- cargo test --lib --no-default-features --features DEBUG,custom-header,rt_async-std,utils
- cargo test --lib --no-default-features --features DEBUG,custom-header,rt_async-std,testing
- cargo test --lib --no-default-features --features DEBUG,custom-header,rt_async-std,utils,testing

test_examples:
dir: examples
cmds:
- docker compose -f ./realworld/docker-compose.yml up -d
- cd ./realworld && sleep 5 && sqlx migrate run
- cargo test
- docker compose -f ./realworld/docker-compose.yml down

#### checks ####
# Assure buildability without "DEBUG" feature

check_rt_tokio:
dir: ohkami
cmds:
- cargo check --lib --no-default-features --features rt_tokio
- cargo check --lib --no-default-features --features rt_tokio,utils
- cargo check --lib --no-default-features --features rt_tokio,testing
- cargo check --lib --no-default-features --features rt_tokio,utils,testing
- cargo check --lib --no-default-features --features custom-header,rt_tokio
- cargo check --lib --no-default-features --features custom-header,rt_tokio,utils
- cargo check --lib --no-default-features --features custom-header,rt_tokio,testing
- cargo check --lib --no-default-features --features custom-header,rt_tokio,utils,testing

check_rt_async-std:
dir: ohkami
cmds:
- cargo test --no-default-features --features rt_async-std
- cargo test --no-default-features --features rt_async-std,utils
- cargo test --no-default-features --features rt_async-std,testing
- cargo test --no-default-features --features rt_async-std,utils,testing
- cargo test --no-default-features --features custom-header,rt_async-std
- cargo test --no-default-features --features custom-header,rt_async-std,utils
- cargo test --no-default-features --features custom-header,rt_async-std,testing
- cargo test --no-default-features --features custom-header,rt_async-std,utils,testing
- cargo check --lib --no-default-features --features rt_async-std
- cargo check --lib --no-default-features --features rt_async-std,utils
- cargo check --lib --no-default-features --features rt_async-std,testing
- cargo check --lib --no-default-features --features rt_async-std,utils,testing
- cargo check --lib --no-default-features --features custom-header,rt_async-std
- cargo check --lib --no-default-features --features custom-header,rt_async-std,utils
- cargo check --lib --no-default-features --features custom-header,rt_async-std,testing
- cargo check --lib --no-default-features --features custom-header,rt_async-std,utils,testing
3 changes: 1 addition & 2 deletions ohkami/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ohkami_macros = { version = "=0.5.1", path = "../ohkami_macros" }
tokio = { version = "1", optional = true, features = ["net", "rt", "io-util", "sync"] }
async-std = { version = "1", optional = true }
byte_reader = { version = "2.0.0", features = ["text"] }
serde = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha1 = { version = "=0.11.0-pre.0", optional = true, default-features = false }
sha2 = { version = "=0.11.0-pre.0", default-features = false }
Expand All @@ -40,7 +40,6 @@ custom-header = ["dep:rustc-hash"]

##### DEBUG #####
DEBUG = [
"serde/derive",
"tokio?/macros",
"tokio?/rt-multi-thread",
"async-std?/attributes",
Expand Down
4 changes: 3 additions & 1 deletion ohkami/src/response/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ mod status;
pub use status::Status;

mod headers;
pub use headers::{Headers as ResponseHeaders, Header as ResponseHeader};
pub use headers::{Headers as ResponseHeaders};
#[cfg(any(feature="testing", feature="DEBUG"))]
pub use headers::Header as ResponseHeader;

mod into_response;
pub use into_response::IntoResponse;
Expand Down

0 comments on commit 78d810b

Please sign in to comment.