fix: wait logs #98
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: Commit Phase | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Build release | |
run: cargo build --release | |
unit: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo test --bins | |
integration: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install sqlx-cli | |
run: cargo install sqlx-cli | |
- name: Create database | |
run: sqlx database create | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Run migrations | |
run: sqlx migrate run | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Run CLI tests | |
run: cargo test --test cli | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Prepare API tests | |
run: cargo run --bin nbd-api > api.log 2>&1 & | |
- name: Wait for API to be ready | |
run: | | |
while ! grep -q "API: listening on" api.log; do | |
sleep 1 | |
done | |
- name: Run API | |
run: cargo test --test api | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
component: | |
name: Component Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install sqlx-cli | |
run: cargo install sqlx-cli | |
- name: Create database | |
run: sqlx database create | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Run migrations | |
run: sqlx migrate run | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Run component tests | |
run: cargo test --test component | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
contract: | |
name: Contract Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install sqlx-cli | |
run: cargo install sqlx-cli | |
- name: Create database | |
run: sqlx database create | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Run migrations | |
run: sqlx migrate run | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Run contract tests | |
run: cargo test --test contract | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
lint: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: Lint check | |
run: cargo clippy -- -D clippy::pedantic -W clippy::nursery | |
final_check: | |
name: Final Check | |
needs: [build, unit, integration, component, contract, lint] | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Success" |