Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #440

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
28 changes: 27 additions & 1 deletion .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
permissions:
id-token: write
contents: read
packages: read

steps:
- name: 'Checkout'
Expand All @@ -35,6 +36,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://npm.pkg.github.com'
scope: "@rumblefishdev"
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}

- name: 'Cache NPM dependencies'
uses: pat-s/[email protected]
Expand Down Expand Up @@ -96,13 +98,21 @@ jobs:
permissions:
id-token: write
contents: read
packages: read
steps:
- name: 'Checkout'
uses: actions/[email protected]

- name: Extract version from tag
id: extract_version
run: echo "::set-output name=VERSION::${GITHUB_REF#refs/tags/@evm-debuger/transaction-trace@}"

- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://npm.pkg.github.com'
scope: "@rumblefishdev"
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}

- name: 'Cache NPM dependencies'
uses: pat-s/[email protected]
Expand All @@ -118,17 +128,29 @@ jobs:
npm i
npm install jq.node -g
node_modules/.bin/lerna bootstrap
npm --prefix packages/transaction-trace-provider/dependencies/nodejs install
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Build
run: |
npm run types:build
- name: Build Docker Image
run: |
npm run transaction-trace-provider:build
docker build -t 428196107266.dkr.ecr.us-east-1.amazonaws.com/transaction-trace-provider:v${{ steps.extract_version.outputs.VERSION }} ./packages/transaction-trace-provider
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::428196107266:role/evm-debugger-transaction-trace-deploy-stage
aws-region: us-east-1
role-session-name: ${{ github.event.repository.name }}-${{ github.job }}

- name: ECR login
run: |
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 428196107266.dkr.ecr.us-east-1.amazonaws.com
- name: Push image
run: |
docker push 428196107266.dkr.ecr.us-east-1.amazonaws.com/transaction-trace-provider:v${{ steps.extract_version.outputs.VERSION }}
- name: Deploy stack
working-directory: ./packages/infra
run: |
Expand All @@ -151,6 +173,8 @@ jobs:
- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://npm.pkg.github.com'
scope: "@rumblefishdev"

- name: 'Cache NPM dependencies'
uses: pat-s/[email protected]
Expand All @@ -166,6 +190,8 @@ jobs:
npm i
npm install jq.node -g
node_modules/.bin/lerna bootstrap
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Build
run: |
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"transaction-trace-api:lint-fix": "lerna run lint:fix --scope @evm-debuger/transaction-trace-api",
"transaction-trace-provider:lint-check": "lerna run lint:check --scope @evm-debuger/transaction-trace-provider",
"transaction-trace-provider:lint-fix": "lerna run lint:fix --scope @evm-debuger/transaction-trace-provider",
"transaction-trace-provider:build": "lerna run build --scope @evm-debuger/transaction-trace-provider",
"types:build": "lerna run build --scope @evm-debuger/types"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { toBeHex, toNumber } from 'ethers'
import type { TEthersTransactionReposnse } from './transactionInfo.types'

export const formatTransactionReposne = (transactionInfo: TEthersTransactionReposnse): TTransactionInfo => {
console.log(transactionInfo)
const formattedTransactionInfo: TTransactionInfo = {
value: toBeHex(transactionInfo.value),
to: transactionInfo.to,
Expand Down
33 changes: 33 additions & 0 deletions packages/infra/ci-roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,39 @@ Resources:
token.actions.githubusercontent.com:sub: !Sub repo:rumblefishdev/${RepositoryName}:*
Path: "/"
Policies:
- PolicyName: allow-ci-to-use-ecr
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- ecr:*
Resource:
- '*'
- Effect: Allow
Action:
- apigateway:*
- cloudformation:*
- dynamodb:*
- sqs:Get*
- sqs:List*
- sqs:SetQueueAttributes
- iam:GetRole
- iam:PutRolePolicy
- lambda:UpdateFunctionCode
- lambda:TagResource
- lambda:GetLayerVersion
- lambda:UpdateEventSourceMapping
- lambda:GetEventSourceMapping
- lambda:ListTags
- lambda:PublishLayerVersion
- lambda:UpdateFunctionConfiguration
- lambda:CreateFunction
- ssm:GetParameter
- ssm:GetParameters
- iam:PassRole
- ssm:AddTagsToResource
Resource: "*"
- PolicyName: allow-ci-to-update-transactiontrace
PolicyDocument:
Version: "2012-10-17"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"dependencies": {
"hardhat": "npm:@rumblefishdev/[email protected]"
},
"overrides": {
"hardhat@^2.9.5": "hardhat"
},
"scripts": {
}
}
Loading