Skip to content

Commit

Permalink
Merge branch 'main' into feat/addOpActiveEpochCount
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-aurele-besner authored Aug 7, 2024
2 parents 954b895 + cd70b5e commit d1f418e
Show file tree
Hide file tree
Showing 23 changed files with 4,409 additions and 566 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/gh-deploy-micro-squids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy Docker Compose for Micro Squids on main
on:
push:
branches:
- main
- production
paths:
- "indexers/general-squid/**"
- "indexers/rewards-squid/**"
Expand All @@ -22,6 +22,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Set Hasura secret
id: set_secret
run: echo "hasura_secret=${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}" >> $GITHUB_OUTPUT

- name: Install SSH key
uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
with:
Expand All @@ -38,13 +42,23 @@ jobs:
mkdir -p ~/.ssh
ssh-keyscan -H ${{ secrets.SQUID_HOST }} >> ~/.ssh/known_hosts
ssh ${SSH_USER}@${{ secrets.SQUID_HOST }} "
if [ ! -d ${DEPLOY_PATH} ]; then
git clone https://github.com/autonomys/astral.git ${DEPLOY_PATH}
else
cd ${DEPLOY_PATH}
git pull
fi
git checkout ${BRANCH_NAME}
# Securely update the .env file
if [ ! -f .env ]; then
echo 'HASURA_GRAPHQL_ADMIN_SECRET=${{ steps.set_secret.outputs.hasura_secret }}' > .env
else
sed -i '/^HASURA_GRAPHQL_ADMIN_SECRET=/d' .env
echo 'HASURA_GRAPHQL_ADMIN_SECRET=${{ steps.set_secret.outputs.hasura_secret }}' >> .env
fi
docker-compose -f docker-compose-all-squids.yml pull
docker-compose -f docker-compose-all-squids.yml up -d
"
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/gh-deploy-monolith-squid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Deploy Docker Compose for Micro Squids on main

on:
push:
branches:
- production
paths:
- "indexers/squid-blockexplorer/**"
env:
DOCKER_HOST: ssh://${{ secrets.SSH_USER }}@${{ secrets.SQUID_HOST }}
DEPLOY_PATH: /home/ubuntu/squids/astral
BRANCH_NAME: ${{ github.ref == 'refs/heads/main' && 'main' || github.ref }}

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set Hasura secret
id: set_secret
run: echo "hasura_secret=${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}" >> $GITHUB_OUTPUT

- name: Install SSH key
uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
with:
ssh-private-key: ${{ secrets.SERVER_SSH_PRIVATE_KEY }}

- name: Add SSH host key fingerprint
run: |
ssh-keyscan -H ${{ secrets.SQUID_HOST }} >> ~/.ssh/known_hosts
- name: Deploy with Docker Compose
env:
SSH_USER: ${{ secrets.SSH_USER }}
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
run: |
mkdir -p ~/.ssh
ssh-keyscan -H ${{ secrets.SQUID_HOST }} >> ~/.ssh/known_hosts
ssh ${SSH_USER}@${{ secrets.SQUID_HOST }} "
if [ ! -d ${DEPLOY_PATH} ]; then
git clone https://github.com/autonomys/astral.git ${DEPLOY_PATH}
else
cd ${DEPLOY_PATH}
git pull
fi
git checkout ${BRANCH_NAME}
# Securely update the .env file
if [ ! -f .env ]; then
echo 'HASURA_GRAPHQL_ADMIN_SECRET=${{ steps.set_secret.outputs.hasura_secret }}' > .env
else
sed -i '/^HASURA_GRAPHQL_ADMIN_SECRET=/d' .env
echo 'HASURA_GRAPHQL_ADMIN_SECRET=${{ steps.set_secret.outputs.hasura_secret }}' >> .env
fi
docker-compose -f docker-compose-all-squids.yml pull
docker-compose -f docker-compose-all-squids.yml up -d
"
- name: Notify on failure
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
author_name: Deployment failed
mention: here
if_mention: failure,cancelled
job_name: Deploy Docker Compose for Micro Squids on staging
channel: alerts
icon_emoji: ":github:"
5 changes: 5 additions & 0 deletions explorer/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ dotenv.config()

const config: CodegenConfig = {
generates: {
'./gql/types/staking.ts': {
schema: defaultIndexer.squids.staking,
documents: ['./src/**/staking.query.ts'],
plugins: ['typescript', 'typescript-operations'],
},
'./gql/rewardTypes.ts': {
schema: defaultIndexer.squids.rewards,
documents: ['./src/**/rewardsQuery.ts'],
Expand Down
47 changes: 0 additions & 47 deletions explorer/gql/oldSquidTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2737,53 +2737,6 @@ export type LogByIdQueryVariables = Exact<{

export type LogByIdQuery = { __typename?: 'Query', logById?: { __typename?: 'Log', id: string, kind: string, value?: any | null, block: { __typename?: 'Block', id: string, height: any, timestamp: any, events: Array<{ __typename?: 'Event', id: string, args?: any | null, name: string, phase: string, indexInBlock: number, timestamp: any, block?: { __typename?: 'Block', height: any, hash: string } | null }> } } | null };

export type StakingHeaderQueryVariables = Exact<{
opOrderBy: Array<OperatorOrderByInput> | OperatorOrderByInput;
noOrderBy: Array<NominatorOrderByInput> | NominatorOrderByInput;
opWhere?: InputMaybe<OperatorWhereInput>;
noWhere?: InputMaybe<NominatorWhereInput>;
}>;


export type StakingHeaderQuery = { __typename?: 'Query', operatorsConnection: { __typename?: 'OperatorsConnection', totalCount: number }, nominatorsConnection: { __typename?: 'NominatorsConnection', totalCount: number } };

export type OperatorsConnectionQueryVariables = Exact<{
first: Scalars['Int']['input'];
after?: InputMaybe<Scalars['String']['input']>;
orderBy: Array<OperatorOrderByInput> | OperatorOrderByInput;
where?: InputMaybe<OperatorWhereInput>;
}>;


export type OperatorsConnectionQuery = { __typename?: 'Query', lastBlock: Array<{ __typename?: 'Block', height: any }>, operatorsConnection: { __typename?: 'OperatorsConnection', totalCount: number, edges: Array<{ __typename?: 'OperatorEdge', node: { __typename?: 'Operator', id: string, operatorOwner?: string | null, currentDomainId?: number | null, currentEpochRewards?: any | null, currentTotalStake?: any | null, minimumNominatorStake?: any | null, nextDomainId?: number | null, nominationTax?: number | null, signingKey: string, status?: string | null, totalShares?: any | null, updatedAt?: any | null, nominators: Array<{ __typename?: 'Nominator', id: string, shares?: any | null }> } }>, pageInfo: { __typename?: 'PageInfo', endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string } } };

export type OperatorByIdQueryVariables = Exact<{
operatorId: Scalars['String']['input'];
}>;


export type OperatorByIdQuery = { __typename?: 'Query', operatorById?: { __typename?: 'Operator', id: string, operatorOwner?: string | null, currentDomainId?: number | null, currentEpochRewards?: any | null, currentTotalStake?: any | null, minimumNominatorStake?: any | null, nextDomainId?: number | null, nominationTax?: number | null, signingKey: string, status?: string | null, totalShares?: any | null, updatedAt?: any | null } | null };

export type OperatorNominatorsByIdQueryVariables = Exact<{
first: Scalars['Int']['input'];
after?: InputMaybe<Scalars['String']['input']>;
orderBy: Array<NominatorOrderByInput> | NominatorOrderByInput;
where?: InputMaybe<NominatorWhereInput>;
}>;


export type OperatorNominatorsByIdQuery = { __typename?: 'Query', nominatorsConnection: { __typename?: 'NominatorsConnection', totalCount: number, edges: Array<{ __typename?: 'NominatorEdge', node: { __typename?: 'Nominator', id: string, shares?: any | null, account: { __typename?: 'Account', id: string } } }>, pageInfo: { __typename?: 'PageInfo', endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string } } };

export type NominatorsConnectionQueryVariables = Exact<{
first: Scalars['Int']['input'];
after?: InputMaybe<Scalars['String']['input']>;
orderBy: Array<NominatorOrderByInput> | NominatorOrderByInput;
where?: InputMaybe<NominatorWhereInput>;
}>;


export type NominatorsConnectionQuery = { __typename?: 'Query', nominatorsConnection: { __typename?: 'NominatorsConnection', totalCount: number, edges: Array<{ __typename?: 'NominatorEdge', node: { __typename?: 'Nominator', id: string, shares?: any | null, updatedAt?: any | null, account: { __typename?: 'Account', id: string }, operator: { __typename?: 'Operator', id: string, operatorOwner?: string | null, currentDomainId?: number | null, currentEpochRewards?: any | null, currentTotalStake?: any | null, minimumNominatorStake?: any | null, nextDomainId?: number | null, nominationTax?: number | null, signingKey: string, status?: string | null, totalShares?: any | null, updatedAt?: any | null } } }>, pageInfo: { __typename?: 'PageInfo', endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string } } };

export type AccountsTopLeaderboardQueryVariables = Exact<{
first: Scalars['Int']['input'];
}>;
Expand Down
Loading

0 comments on commit d1f418e

Please sign in to comment.