test #2022
This file contains hidden or 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: test | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: | |
| - 'main' | |
| paths: | |
| - '**/src/**/*' | |
| - '**/tests/**/*' | |
| - 'Cargo.toml' | |
| - '**/Cargo.toml' | |
| - 'Cargo.lock' | |
| - '**/Cargo.lock' | |
| - '.github/workflows/test.yml' | |
| permissions: {} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| DX_VERSION: "0.7.5" | |
| SQLX_VERSION: "0.8.6" | |
| SQLX_FEATURES: "rustls,mysql" | |
| DATABASE_URL: "mysql://root:password@127.0.0.1:3306/avina" | |
| jobs: | |
| build: | |
| name: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Install the Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Rust Cache Action | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: sqlx-${{ env.SQLX_VERSION }} | |
| - name: Install mold | |
| run: sudo apt update && sudo apt install mold -y | |
| - name: Build all crates | |
| run: SQLX_OFFLINE=true cargo build --all | |
| build-ui: | |
| name: build-ui | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Install the Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Rust Cache Action | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: dioxus-cli-${{ env.DX_VERSION }} | |
| - name: Install mold | |
| run: sudo apt update && sudo apt install mold -y | |
| - name: Install Dioxus CLI | |
| run: cargo install dioxus-cli --version="${DX_VERSION}" --locked | |
| - name: Build UI crate with Dioxus | |
| run: dx build --package avina-ui | |
| docs: | |
| name: docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Install the Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Rust Cache Action | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: sqlx-${{ env.SQLX_VERSION }} | |
| - name: Install mold | |
| run: sudo apt update && sudo apt install mold -y | |
| - name: Build docs | |
| run: SQLX_OFFLINE=true cargo doc --no-deps | |
| test: | |
| name: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: getong/mariadb-action@v1.11 | |
| with: | |
| mariadb version: '10.6.21' | |
| mysql database: 'avina' | |
| mysql root password: 'password' | |
| - name: Check out repository code | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Install the Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Rust Cache Action | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: sqlx-${{ env.SQLX_VERSION }} | |
| - name: Install sqlx-cli | |
| run: | | |
| cargo install sqlx-cli \ | |
| --version="${SQLX_VERSION}" \ | |
| --features "${SQLX_FEATURES}" \ | |
| --no-default-features \ | |
| --locked | |
| - name: Install mariadb-client and mold | |
| run: sudo apt update && sudo apt install mariadb-client mold -y | |
| - name: Migrate database | |
| run: SKIP_DOCKER=true ./scripts/init_db.sh | |
| - name: Check sqlx offline data is up to date | |
| run: cargo sqlx prepare --workspace --check | |
| - name: Run tests | |
| run: cargo test | |
| # coverage: | |
| # name: coverage | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: checkout | |
| # uses: actions/checkout@v6 | |
| # with: | |
| # persist-credentials: false | |
| # - name: install rust toolchain | |
| # uses: dtolnay/rust-toolchain@stable | |
| # - name: install rust cache | |
| # uses: Swatinem/rust-cache@v2 | |
| # - name: run coverage check | |
| # uses: actions-rs/tarpaulin@v0.1 | |
| # with: | |
| # version: '0.15.0' | |
| # args: '--workspace --fail-under 5 --exclude-files **/src/cli/* --exclude-files **/tests/*' |