-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Set up IaC for deployments
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Deploy Web app and Infrastructure | ||
on: workflow_dispatch | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Node v20.10 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.10 | ||
|
||
# We need foundry for contract types | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Setup AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: ap-south-1 | ||
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
role-session-name: FinthetixDeploymentSession | ||
|
||
- name: Install node dependencies | ||
run: | | ||
cd web-app/infra | ||
npm ci | ||
- name: Deploy | ||
env: | ||
WEB_APP_INFRA_ENV: ${{ secrets.WEB_APP_INFRA_ENV }} | ||
run: | | ||
cd web-app/infra | ||
echo "$WEB_APP_INFRA_ENV" > .env | ||
npm run deploy |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Quality Check | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- edited | ||
|
||
jobs: | ||
test-contracts: | ||
name: Test contracts | ||
env: | ||
FOUNDRY_PROFILE: ci | ||
defaults: | ||
run: | ||
working-directory: contracts | ||
strategy: | ||
fail-fast: true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
sparse-checkout: contracts | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Run Forge build | ||
run: | | ||
forge --version | ||
forge build --sizes | ||
id: build | ||
|
||
- name: Run Forge tests | ||
run: | | ||
forge test -vvv | ||
id: test | ||
|
||
build-typecheck-lint: | ||
name: Build, typecheck and lint web app | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
# We need foundry for contract types | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Setup Node v20.10 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.10 | ||
|
||
- name: Install node dependencies | ||
run: | | ||
cd web-app/infra | ||
npm ci | ||
- name: Build infra and src | ||
env: | ||
WEB_APP_INFRA_ENV: ${{ secrets.WEB_APP_INFRA_ENV }} | ||
run: | | ||
cd web-app/infra | ||
echo "$WEB_APP_INFRA_ENV" > .env | ||
npm run build | ||
- name: Lint | ||
run: | | ||
cd web-app/infra | ||
npm run lint | ||
cd ../src | ||
npm run lint | ||
- name: Typecheck | ||
run: | | ||
cd web-app/infra | ||
npm run typecheck | ||
cd ../src | ||
npm run typecheck |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
PRIVATE_KEY="" # deployer private key | ||
# The name of the account from `cast wallet` used for deployment | ||
DEPLOYER_ACC_NAME='' | ||
|
||
# The chain to which you are deploying. Make sure that the etherscan and RPC_URL are looking at the same chain | ||
CHAIN_NAME="sepolia" | ||
|
||
# The API key for verifying contract code on etherscan | ||
ETHER_SCAN_API_KEY="4R9KW77TXKSQ1PV4STEWF1ZHHNZDZ2YAIG" | ||
|
||
# The RPC URL for broadcasting the contract deployment | ||
RPC_URL="https://eth-sepolia.g.alchemy.com/v2/mf16xqfXJrEylHiHuhg4nPfg6H5T9n2l" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
include .env | ||
|
||
DEPLOY_SCRIPT=script/01_Deploy.s.sol | ||
|
||
# These hardcoded private keys are from the anvil local chain | ||
deploy-dev: $(DEPLOY_SCRIPT) | ||
forge script $(DEPLOY_SCRIPT) --rpc-url http://127.0.0.1:8545 --broadcast | ||
forge script $(DEPLOY_SCRIPT) --rpc-url http://127.0.0.1:8545 --broadcast \ | ||
--sender 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \ | ||
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 | ||
|
||
deploy-prod: $(DEPLOY_SCRIPT) | ||
@forge script $(DEPLOY_SCRIPT) --rpc-url ${RPC_URL} --broadcast \ | ||
--account ${DEPLOYER_ACC_NAME} \ | ||
--sender $$(cast wallet address --account ${DEPLOYER_ACC_NAME}) \ | ||
--verify --chain ${CHAIN_NAME} --etherscan-api-key ${ETHER_SCAN_API_KEY} | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.