Dev command to run test & clean up (#56) #213
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: CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**/*.md' | |
| pull_request: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**/*.md' | |
| jobs: | |
| tests: | |
| runs-on: '${{ matrix.platform.os }}-latest' | |
| strategy: | |
| matrix: | |
| platform: | |
| [ | |
| { os: 'ubuntu', target: 'x86_64-unknown-linux-gnu' }, | |
| { os: 'ubuntu', target: 'wasm32-unknown-unknown' }, | |
| ] | |
| services: | |
| typesense: | |
| image: typesense/typesense:30.0.rc10 | |
| ports: | |
| - 8108:8108/tcp | |
| volumes: | |
| - /tmp/typesense-server-data:/data | |
| env: | |
| TYPESENSE_DATA_DIR: '/data' | |
| TYPESENSE_API_KEY: 'xyz' | |
| TYPESENSE_ENABLE_CORS: true | |
| TYPESENSE_URL: 'http://localhost:8108' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache .cargo and target | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo | |
| ./target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: ${{ matrix.platform.target }} | |
| profile: minimal | |
| default: true | |
| - name: Install test runner for wasm | |
| if: matrix.platform.target == 'wasm32-unknown-unknown' | |
| run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
| - name: Stable Build | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: build | |
| args: --all-features --target ${{ matrix.platform.target }} --workspace --exclude xtask | |
| - name: Tests | |
| if: matrix.platform.target != 'wasm32-unknown-unknown' | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: test | |
| args: --all-features | |
| - name: Tests in WASM | |
| if: matrix.platform.target == 'wasm32-unknown-unknown' | |
| run: RUST_LOG=wasm_bindgen_test_runner wasm-pack test --headless --chrome | |
| working-directory: ./typesense |