diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 668f46f44..24cf4acbc 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -17,7 +17,8 @@ jobs: components: cargo, rustc, rustfmt profile: minimal - - uses: actions-rs/cargo@v1 + - name: cargo fmt + uses: actions-rs/cargo@v1 with: command: fmt args: --all --check @@ -43,19 +44,27 @@ jobs: target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }} - - uses: actions-rs/cargo@v1 + - name: cargo clippy --lib + uses: actions-rs/cargo@v1 with: command: clippy - args: --all --lib --bins --all-features --no-deps --profile=debug-lite + args: --workspace --lib --all-features --no-deps --profile=debug-lite + + - name: cargo clippy --bins + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --workspace --bins --all-features --no-deps --profile=debug-lite - name: check lockfile run: | diff Cargo.lock <(git show HEAD:Cargo.lock) - - uses: actions-rs/cargo@v1 + - name: cargo doc --lib + uses: actions-rs/cargo@v1 with: command: doc - args: --all --lib --all-features --no-deps --profile=debug-lite + args: --workspace --lib --all-features --no-deps --profile=debug-lite release-check: name: cargo check/doc/clippy (release profile) @@ -78,12 +87,20 @@ jobs: target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }} - - uses: actions-rs/cargo@v1 + - name: cargo clippy --lib --release + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --workspace --lib --all-features --profile=release-lite + + - name: cargo clippy --bins --release + uses: actions-rs/cargo@v1 with: command: clippy - args: --all --lib --bins --all-features --profile=release-lite + args: --workspace --bins --all-features --profile=release-lite - - uses: actions-rs/cargo@v1 + - name: cargo doc --lib --release + uses: actions-rs/cargo@v1 with: command: doc - args: --all --lib --all-features --no-deps --profile=release-lite + args: --workspace --lib --all-features --no-deps --profile=release-lite diff --git a/.github/workflows/cargo_test.yml b/.github/workflows/cargo_test.yml index cc5bb8f6a..ac1ea4471 100644 --- a/.github/workflows/cargo_test.yml +++ b/.github/workflows/cargo_test.yml @@ -2,14 +2,28 @@ name: Cargo test on: pull_request: - branches: [master] + branches: [dev, master] push: branches: [dev, master] jobs: - debug-build: + debug-test: name: cargo build/test (debug profile) runs-on: indexer-test-runner + + services: + postgres: + image: postgres:14.1 + + env: + POSTGRES_USER: ci + POSTGRES_PASSWORD: ci + POSTGRES_PORT: 5432 + POSTGRES_DB: ci + + ports: + - 5432:5432 + steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 @@ -28,14 +42,39 @@ jobs: target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }} - - uses: actions-rs/cargo@v1 + - name: cargo test --lib + uses: actions-rs/cargo@v1 + env: + DATABASE_URL: postgres://ci:ci@127.0.0.1:5432/ci + with: + command: test + args: --workspace --lib --all-features --profile=debug-lite + + - name: cargo test --bins + uses: actions-rs/cargo@v1 + env: + DATABASE_URL: postgres://ci:ci@127.0.0.1:5432/ci with: command: test - args: --all --lib --bins --all-features --profile=debug-lite + args: --workspace --bins --all-features --profile=debug-lite - release-build: + release-test: name: cargo build/test (release profile) runs-on: indexer-test-runner + + services: + postgres: + image: postgres:14.1 + + env: + POSTGRES_USER: ci + POSTGRES_PASSWORD: ci + POSTGRES_PORT: 5432 + POSTGRES_DB: ci + + ports: + - 5432:5432 + steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 @@ -44,6 +83,10 @@ jobs: components: cargo, rustc profile: minimal + - name: set up environment + run: | + docker-compose up -d + - uses: actions/cache@v3 with: path: | @@ -54,7 +97,18 @@ jobs: target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }} - - uses: actions-rs/cargo@v1 + - name: cargo test --lib --release + uses: actions-rs/cargo@v1 + env: + DATABASE_URL: postgres://ci:ci@127.0.0.1:5432/ci + with: + command: test + args: --workspace --lib --all-features --profile=release-lite + + - name: cargo test --bins --release + uses: actions-rs/cargo@v1 + env: + DATABASE_URL: postgres://ci:ci@127.0.0.1:5432/ci with: command: test - args: --all --lib --bins --all-features --profile=release-lite + args: --workspace --bins --all-features --profile=release-lite diff --git a/.github/workflows/deploy_to_heroku_production.yml b/.github/workflows/deploy_to_heroku_production.yml deleted file mode 100644 index 5343585cf..000000000 --- a/.github/workflows/deploy_to_heroku_production.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Heroku (production) - -on: - push: - branches: [master] - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - - name: Geyser consumer - uses: gonuit/heroku-docker-deploy@v1.3.3 - with: - email: ${{ secrets.HEROKU_EMAIL }} - heroku_api_key: ${{ secrets.HEROKU_API_KEY }} - heroku_app_name: accounts-db-consumer - dockerfile_name: Dockerfile - docker_options: '--target geyser-consumer' - process_type: worker - - - name: HTTP consumer - uses: gonuit/heroku-docker-deploy@v1.3.3 - with: - email: ${{ secrets.HEROKU_EMAIL }} - heroku_api_key: ${{ secrets.HEROKU_API_KEY }} - heroku_app_name: accountsdbhttpconsumer - dockerfile_name: Dockerfile - docker_options: '--target http-consumer' - process_type: worker - - - name: GraphQL server - uses: gonuit/heroku-docker-deploy@v1.3.3 - with: - email: ${{ secrets.HEROKU_EMAIL }} - heroku_api_key: ${{ secrets.HEROKU_API_KEY }} - heroku_app_name: indexer-graphql - dockerfile_name: Dockerfile - docker_options: '--target graphql' - - - name: Storefronts Indexer - uses: gonuit/heroku-docker-deploy@v1.3.3 - with: - email: ${{ secrets.HEROKU_EMAIL }} - heroku_api_key: ${{ secrets.HEROKU_API_KEY }} - heroku_app_name: legacy-storefronts - dockerfile_name: Dockerfile - docker_options: '--target legacy-storefronts' - process_type: worker diff --git a/.github/workflows/deploy_to_heroku_staging.yml b/.github/workflows/deploy_to_heroku_staging.yml deleted file mode 100644 index 565452a4d..000000000 --- a/.github/workflows/deploy_to_heroku_staging.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Heroku (staging) - -on: - push: - branches: [dev, deploy_config, debug_validator] - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - - name: Geyser consumer - uses: gonuit/heroku-docker-deploy@v1.3.3 - with: - email: ${{ secrets.HEROKU_EMAIL }} - heroku_api_key: ${{ secrets.HEROKU_API_KEY }} - heroku_app_name: accounts-db-consumer-staging - dockerfile_name: Dockerfile - docker_options: '--target geyser-consumer' - process_type: worker - - - name: HTTP consumer - uses: gonuit/heroku-docker-deploy@v1.3.3 - with: - email: ${{ secrets.HEROKU_EMAIL }} - heroku_api_key: ${{ secrets.HEROKU_API_KEY }} - heroku_app_name: accountsdbhttpconsumerstaging - dockerfile_name: Dockerfile - docker_options: '--target http-consumer' - process_type: worker - - - name: GraphQL server - uses: gonuit/heroku-docker-deploy@v1.3.3 - with: - email: ${{ secrets.HEROKU_EMAIL }} - heroku_api_key: ${{ secrets.HEROKU_API_KEY }} - heroku_app_name: indexer-graphql-staging - dockerfile_name: Dockerfile - docker_options: '--target graphql'