diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8f4a7c0..7c94fc4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,9 @@ +# copy of https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md on: push: - branches: - - '**' - pull_request: - branches: - - '**' + branches: [main] + pull_request_review: + types: [submitted] name: CI @@ -22,38 +21,30 @@ jobs: check: name: Check - env: - SQLX_OFFLINE: true - runs-on: ubuntu-latest + if: github.event.review.state == 'approved' + strategy: + matrix: + include: + - os: ubuntu-latest + toolchain: stable-x86_64-unknown-linux-gnu + - os: macos-latest + toolchain: stable-x86_64-apple-darwin + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 with: submodules: true - - name: Check .sqlx directory presence - run: | - if [ ! -d ".sqlx" ]; then - echo ".sqlx directory is missing. Failing the workflow." - exit 1 - else - echo ".sqlx directory is present. Continuing..." - ls -la .sqlx - fi - name: Checkout submodules run: git submodule update --init --recursive - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v4 # we need go to build go-waku with: go-version: '1.19' - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable-x86_64-unknown-linux-gnu + toolchain: ${{ matrix.toolchain }} default: true override: true - - name: List project directory contents after checkout - run: | - ls -la - echo "Contents of .sqlx directory (if present):" - ls -la .sqlx || echo ".sqlx directory not found." - uses: actions-rs/cargo@v1 continue-on-error: false with: @@ -65,20 +56,28 @@ jobs: test: name: Test Suite - runs-on: ubuntu-latest + if: github.event.review.state == 'approved' + strategy: + matrix: + include: + - os: ubuntu-latest + toolchain: stable-x86_64-unknown-linux-gnu + - os: macos-latest + toolchain: stable-x86_64-apple-darwin + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 with: submodules: true - name: Checkout submodules run: git submodule update --init --recursive - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v4 # we need go to build go-waku with: go-version: '1.19' - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable-x86_64-unknown-linux-gnu + toolchain: ${{ matrix.toolchain }} default: true override: true - uses: actions-rs/cargo@v1 diff --git a/src/db/resolver.rs b/src/db/resolver.rs index 1ca502d..5264942 100644 --- a/src/db/resolver.rs +++ b/src/db/resolver.rs @@ -257,31 +257,26 @@ pub async fn list_active_indexers( #[cfg(test)] mod tests { use crate::message_types::PublicPoiMessage; - use super::*; - - use sqlx::PgPool; - - - async fn insert_test_data(pool: &PgPool, entries: Vec<(i64, &str)>) { for (nonce, graph_account) in entries { let message = PublicPoiMessage { - identifier: "Qm123".to_string(), - content: "text".to_string(), + identifier: "QmTamam".to_string(), + content: "0xText".to_string(), nonce: nonce.try_into().unwrap(), - network: "text".to_string(), + network: "testnet".to_string(), block_number: 1, block_hash: "hash".to_string(), graph_account: graph_account.to_string(), }; - - add_message(pool, message).await.expect("Failed to insert test data"); + + add_message(pool, message) + .await + .expect("Failed to insert test data"); } } - #[sqlx::test(migrations = "./migrations")] async fn test_list_active_indexers_without_indexers(pool: PgPool) {