Add prefork #43
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
toolchain: [stable, beta] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: rustfmt, clippy, llvm-tools-preview | |
- uses: Swatinem/rust-cache@v2 | |
- run: echo "{NO_DEFAULT_FEATURES}={--no-default-features}" >> "$GITHUB_ENV" | |
if: matrix.os == 'windows-latest' | |
# cargo build before check to speed up check | |
- run: cargo build $NO_DEFAULT_FEATURES | |
- run: cargo check $NO_DEFAULT_FEATURES && cargo fmt && cargo clippy | |
- run: cargo test $NO_DEFAULT_FEATURES | |
- name: Run server | |
shell: bash # for windows | |
run: | | |
cp .env.example .env | |
./target/debug/clean-axum & | |
while ! curl --output /dev/null --silent --head --fail http://localhost:3000; do sleep 0.5; done; echo ok; | |
- name: Check server | |
run: | | |
curl -sX POST http://localhost:3000/users -H "Content-Type: application/json" -d '{"username":"abc"}' | |
curl -s http://localhost:3000/users?username= |