feat: updated yaml #98
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: Indexer CI - Testnet | ||
| on: | ||
| push: | ||
| branches: | ||
| - release/testnet | ||
| # on: | ||
| # pull_request: | ||
| # types: | ||
| # - closed | ||
| jobs: | ||
| # if_merged: | ||
| # if: github.event.pull_request.merged == true | ||
| build_and_deploy: | ||
| runs-on: self-hosted | ||
| strategy: | ||
| matrix: | ||
| env: [neuroweb-testnet, base-testnet, gnosis-testnet] | ||
| include: | ||
| - env: neuroweb-testnet | ||
| db_name: NERUOWEB_TESTNET_DB | ||
| indexer_name: NEUROWEB_TESTNET_INDEXER_NAME | ||
| rpc_endpoint: NEUROWEB_TESTNET_RPC_ENDPOINT | ||
| start_block: NEUROWEB_TESTNET_START_BLOCK | ||
| finality_confirmations: NEUROWEB_TESTNET_FINALITY_CONFIRMATIONS | ||
| contracts: NEUROWEB_TESTNET_CONTRACTS | ||
| archive: NEUROWEB_TESTNET_ARCHIVE | ||
| prometheus_port: NEUROWEB_TESTNET_PROMETHEUS_PORT | ||
| rate_limit: NEUROWEB_TESTNET_RATE_LIMIT | ||
| capacity: NEUROWEB_TESTNET_RPC_CAPACITY | ||
| max_batch_size: NEUROWEB_TESTNET_MAX_BATCH_SIZE | ||
| chronos_contract: NEUROWEB_TESTNET_CHRONOS_CONTRACT | ||
| - env: base-testnet | ||
| db_name: BASE_TESTNET_DB | ||
| indexer_name: BASE_TESTNET_INDEXER_NAME | ||
| rpc_endpoint: BASE_TESTNET_RPC_ENDPOINT | ||
| start_block: BASE_TESTNET_START_BLOCK | ||
| finality_confirmations: BASE_TESTNET_FINALITY_CONFIRMATIONS | ||
| contracts: BASE_TESTNET_CONTRACTS | ||
| archive: BASE_TESTNET_ARCHIVE | ||
| prometheus_port: BASE_TESTNET_PROMETHEUS_PORT | ||
| rate_limit: BASE_TESTNET_RATE_LIMIT | ||
| capacity: BASE_TESTNET_RPC_CAPACITY | ||
| max_batch_size: BASE_TESTNET_MAX_BATCH_SIZE | ||
| chronos_contract: BASE_TESTNET_CHRONOS_CONTRACT | ||
| - env: gnosis-testnet | ||
| db_name: GNOSIS_TESTNET_DB | ||
| indexer_name: GNOSIS_TESTNET_INDEXER_NAME | ||
| rpc_endpoint: GNOSIS_TESTNET_RPC_ENDPOINT | ||
| start_block: GNOSIS_TESTNET_START_BLOCK | ||
| finality_confirmations: GNOSIS_TESTNET_FINALITY_CONFIRMATIONS | ||
| contracts: GNOSIS_TESTNET_CONTRACTS | ||
| archive: GNOSIS_TESTNET_ARCHIVE | ||
| prometheus_port: GNOSIS_TESTNET_PROMETHEUS_PORT | ||
| rate_limit: GNOSIS_TESTNET_RATE_LIMIT | ||
| capacity: GNOSIS_TESTNET_RPC_CAPACITY | ||
| max_batch_size: GNOSIS_TESTNET_MAX_BATCH_SIZE | ||
| chronos_contract: GNOSIS_TESTNET_CHRONOS_CONTRACT | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v2 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v1 | ||
| - name: Setting environment variables | ||
| run: | | ||
| echo "Building and deploying indexer for ${{ matrix.env }}" | ||
| echo "DB_USER=${{ secrets.DB_USER }}" >> $GITHUB_ENV | ||
| echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> $GITHUB_ENV | ||
| echo "DB_NAME=${{ secrets[matrix.db_name] }}" >> $GITHUB_ENV | ||
| echo "INDEXER_NAME=${{ secrets[matrix.indexer_name] }}" >> $GITHUB_ENV | ||
| echo "RPC_ENDPOINT=${{ secrets[matrix.rpc_endpoint] }}" >> $GITHUB_ENV | ||
| echo "START_BLOCK=${{ secrets[matrix.start_block] }}" >> $GITHUB_ENV | ||
| echo "FINALITY_CONFIRMATIONS=${{ secrets[matrix.finality_confirmations] }}" >> $GITHUB_ENV | ||
| echo "CONTRACTS=${{ secrets[matrix.contracts] }}" >> $GITHUB_ENV | ||
| echo "ARCHIVE=${{ secrets[matrix.archive] }}" >> $GITHUB_ENV | ||
| echo "PROMETHEUS_PORT=${{ secrets[matrix.prometheus_port] }}" >> $GITHUB_ENV | ||
| echo "RATE_LIMIT=${{ secrets[matrix.rate_limit] }}" >> $GITHUB_ENV | ||
| echo "RPC_CAPACITY=${{ secrets[matrix.capacity] }}" >> $GITHUB_ENV | ||
| echo "MAX_BATCH_SIZE=${{ secrets[matrix.max_batch_size] }}" >> $GITHUB_ENV | ||
| echo "CHRONOS_CONTRACT_ADDRESS=${{ secrets[matrix.chronos_contract] }}" >> $GITHUB_ENV | ||
| - name: Lowercase the repo name | ||
| run: echo "REPO=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} | ||
| - name: Build and deploy | ||
| run: | | ||
| docker compose -f docker-compose.yml -p ${{ matrix.env }}-indexer build indexer | ||
| docker compose -f docker-compose.yml -p ${{ matrix.env }}-indexer up indexer --force-recreate -d | ||
| cleanup: | ||
| runs-on: self-hosted | ||
| needs: build_and_deploy | ||
| if: always() | ||
| steps: | ||
| - name: Remove dangling volumes and images | ||
| run: | | ||
| docker system prune -f --volumes | ||
| docker image prune -f | ||