Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
noisekit committed Sep 9, 2024
1 parent 0948808 commit c748578
Show file tree
Hide file tree
Showing 13 changed files with 2,823 additions and 22,922 deletions.
330 changes: 0 additions & 330 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ parameters:
type: string
default: '20.17.0'

cypress-version:
type: string
default: '13.11.0'

commands:
yarn-install:
steps:
Expand All @@ -33,93 +29,6 @@ commands:
paths:
- '~/.yarn/berry'

install-foundry:
steps:
- restore_cache:
keys:
- foundry-{{ .Environment.FOUNDRY_CACHE_VERSION }}

- run:
name: 'Add .foundry/bin to PATH'
command: |-
export PATH="$PATH:$HOME/.foundry/bin"
echo 'export PATH=$PATH:$HOME/.foundry/bin' >> $BASH_ENV
- run:
name: 'forge --version'
command: |-
if command -v curl; then
curl --version
else
apt update && apt install --yes curl
fi
if command -v forge; then
forge --version
else
echo "Forge needs to be installed"
curl -L https://foundry.paradigm.xyz | bash
foundryup
forge --version
fi
- save_cache:
key: foundry-{{ .Environment.FOUNDRY_CACHE_VERSION }}
paths:
- '~/.foundry/bin'

ipfs-deploy:
parameters:
source-dir:
type: string
ipfs-api:
type: string
ipns-key:
type: string
ipfs-cluster-api:
type: string
steps:
- run:
name: 'Install IPFS'
command: |
LATEST_VERSION=$(curl -sSL https://dist.ipfs.tech/go-ipfs/versions | tail -n 1)
LATEST_VERSION_NUMBER=${LATEST_VERSION#*v}
DOWNLOAD_URL="https://dist.ipfs.tech/go-ipfs/${LATEST_VERSION}/go-ipfs_${LATEST_VERSION}_linux-amd64.tar.gz"
echo "DOWNLOAD_URL=$DOWNLOAD_URL"
curl -sSL -o ipfs.tar.gz $DOWNLOAD_URL
tar -xzf ipfs.tar.gz
sudo cp -f ./go-ipfs/ipfs /usr/local/bin/
ipfs init
- run:
command: ipfs daemon
background: true
- run:
name: 'Wait for IPFS daemon to start'
command: wget --retry-connrefused --waitretry=20 --read-timeout=20 --timeout=15 -t 10 --post-data '' "http://localhost:5001/api/v0/version"

- run: ipfs add --progress=true --pin=true --recursive "<< parameters.source-dir >>"
- run:
name: 'Save IPFS_CID'
command: |
export IPFS_CID=$(ipfs add --progress=false --pin=true --recursive --quieter "<< parameters.source-dir >>")
echo $IPFS_CID
echo "export IPFS_CID=$IPFS_CID" >> $BASH_ENV
- run:
name: 'Pin to the remote IPFS node'
command: curl --silent --request POST --user "$IPFS_USER:$IPFS_PASS" "<< parameters.ipfs-api >>/pin/add?recursive=true&progress=true&arg=$IPFS_CID"
- run:
name: 'Publish IPFS_CID to IPNS key << parameters.ipns-key >>'
command: |
curl --silent --request POST --user "$IPFS_USER:$IPFS_PASS" "<< parameters.ipfs-api >>/name/publish?key=<< parameters.ipns-key >>&arg=$IPFS_CID" | tee /tmp/name-publish-$IPFS_CID.log
cat /tmp/name-publish-$IPFS_CID.log | jq
- run:
name: 'Pin to Synthetix IPFS cluster'
command: |
curl --silent --request POST --user "$IPFS_USER:$IPFS_PASS" "<< parameters.ipfs-cluster-api >>/pin/add?arg=$IPFS_CID" | tee /tmp/pin-add-$IPFS_CID.log
cat /tmp/pin-add-$IPFS_CID.log | jq
jobs:
checks:
working_directory: /tmp/app
Expand All @@ -137,207 +46,6 @@ jobs:
- run: yarn lint
- run: yarn svg:check

tests:
working_directory: /tmp/app
docker:
- image: cimg/node:<< pipeline.parameters.node-version >>
steps:
- checkout
- yarn-install
- run: NODE_ENV=test yarn test --coverage --coverageReporters=json --reporters=jest-junit --runInBand
- store_test_results:
path: './junit.xml'
- store_artifacts:
path: 'coverage'

typecheck:
working_directory: /tmp/app
docker:
- image: cimg/node:<< pipeline.parameters.node-version >>
steps:
- checkout
- yarn-install
- run: yarn codegen
- run: yarn build:ts
- run: git diff --name-only --exit-code
- run: yarn typecheck

governance-e2e:
working_directory: /tmp/app
docker:
- image: cypress/included:<< pipeline.parameters.cypress-version >>
resource_class: large
environment:
NODE_ENV: test
TESTNET: 1
steps:
- checkout
- install-foundry
- yarn-install

- run:
name: Run server localhost:3000
working_directory: /tmp/app/governance/ui
command: CI=true yarn start
background: true

- run:
name: Run anvil localhost:8545
command: 'anvil --fork-url https://testnet.snaxchain.io --fork-block-number 296528'
background: true

- run:
name: Wait for server localhost:3000
command: wget --retry-connrefused --waitretry=20 --read-timeout=20 --timeout=15 -t 10 http://localhost:3000

- run:
name: Wait for anvil localhost:8545
command: wget -q -O - --retry-connrefused --waitretry=20 --read-timeout=20 --timeout=15 -t 10 --post-data='{"method":"eth_chainId","params":[],"id":1,"jsonrpc":"2.0"}' --header='Content-Type:application/json' http://localhost:8545

- run:
working_directory: /tmp/app/governance/cypress
command: cypress run --e2e --browser chrome

- store_test_results:
path: 'governance/cypress/cypress/reports'

- store_artifacts:
path: 'governance/cypress/.nyc_output'
destination: 'coverage'

- store_artifacts:
path: 'governance/cypress/cypress/screenshots'
destination: 'screenshots'

- store_artifacts:
path: 'governance/cypress/cypress/videos'
destination: 'videos'

liquidity-e2e:
parameters:
chainId:
type: integer
preset:
type: string
provider-url:
type: string
working_directory: /tmp/app
docker:
- image: cypress/included:<< pipeline.parameters.cypress-version >>
resource_class: large
environment:
NODE_ENV: test
CYPRESS_CHAIN_ID: << parameters.chainId >>
CYPRESS_PRESET: << parameters.preset >>
steps:
- checkout
- install-foundry
- yarn-install

- run:
name: Run server localhost:3000
working_directory: /tmp/app/liquidity/ui
command: yarn start
background: true

- run:
name: Run anvil localhost:8545
command: anvil --fork-url "<< parameters.provider-url >>"
background: true

- run:
name: Wait for server localhost:3000
command: wget --retry-connrefused --waitretry=20 --read-timeout=20 --timeout=15 -t 10 http://localhost:3000

- run:
name: Wait for anvil localhost:8545
command: wget -q -O - --retry-connrefused --waitretry=20 --read-timeout=20 --timeout=15 -t 10 --post-data='{"method":"eth_chainId","params":[],"id":1,"jsonrpc":"2.0"}' --header='Content-Type:application/json' http://localhost:8545

- run:
working_directory: /tmp/app/liquidity/cypress
command: cypress run --e2e --browser chrome

- store_test_results:
path: 'liquidity/cypress/cypress/reports'

- store_artifacts:
path: 'liquidity/cypress/.nyc_output'
destination: 'coverage'

- store_artifacts:
path: 'liquidity/cypress/cypress/screenshots'
destination: 'screenshots'

- store_artifacts:
path: 'liquidity/cypress/cypress/videos'
destination: 'videos'

liquidity-cy:
working_directory: /tmp/app
docker:
- image: cypress/included:<< pipeline.parameters.cypress-version >>
environment:
NODE_ENV: test
steps:
- checkout
- yarn-install

- run:
working_directory: /tmp/app/liquidity/cypress
command: cypress run --component

- store_test_results:
path: 'liquidity/cypress/cypress/reports'

- store_artifacts:
path: 'liquidity/cypress/.nyc_output'
destination: 'coverage'

- store_artifacts:
path: 'liquidity/cypress/cypress/screenshots'
destination: 'screenshots'

- store_artifacts:
path: 'liquidity/cypress/cypress/videos'
destination: 'videos'

combine-coverage:
working_directory: /tmp/app
docker:
- image: cimg/node:<< pipeline.parameters.node-version >>
steps:
- checkout
- yarn-install
- run: rm -rf /tmp/cov
- run: yarn download-cci-coverage tests /tmp/cov || true
- run: yarn download-cci-coverage liquidity-cy /tmp/cov || true
# - run: yarn download-cci-coveragegovernance-cy /tmp/cov || true
- run: yarn download-cci-coverage liquidity-e2e-base-mainnet /tmp/cov || true
- run: yarn download-cci-coverage liquidity-e2e-optimism-mainnet /tmp/cov || true
- run: mkdir -p /tmp/cov
- run: ls -alR /tmp/cov
- run: mkdir -p /tmp/cov/combined
- run: yarn nyc merge /tmp/cov /tmp/cov/combined/coverage.json || true
- run: |-
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${CODECOV_TOKEN} --file /tmp/cov/combined/coverage.json
liquidity-ipfs:
working_directory: /tmp/app
docker:
- image: cimg/node:<< pipeline.parameters.node-version >>
resource_class: large
steps:
- checkout
- yarn-install
- run: yarn workspace @snx-v3/liquidity build
- ipfs-deploy:
source-dir: './liquidity/ui/dist'
ipfs-api: 'https://ipfs.synthetix.io:5001/api/v0'
ipfs-cluster-api: 'https://ipfs.synthetix.io/api/v0'
ipns-key: 'v3.synthetix.eth'

workflows:
ui:
unless:
Expand All @@ -346,41 +54,3 @@ workflows:

jobs:
- checks
- typecheck
- tests
- liquidity-cy
- governance-e2e:
name: governance-e2e-snax-testnet
- liquidity-e2e:
name: liquidity-e2e-base-mainnet
chainId: 8453
preset: andromeda
provider-url: https://base-mainnet.infura.io/v3/$INFURA_KEY
#- liquidity-e2e:
# name: liquidity-e2e-sepolia
# chainId: 11155111
# preset: main
# provider-url: https://sepolia.infura.io/v3/$INFURA_KEY
- combine-coverage:
requires: [
tests,
liquidity-cy,
governance-e2e-snax-testnet,
liquidity-e2e-base-mainnet,
#liquidity-e2e-sepolia,
]

- liquidity-ipfs:
requires:
- checks
- typecheck
- tests
- liquidity-cy
- liquidity-e2e-base-mainnet
#- liquidity-e2e-sepolia
filters:
branches:
only:
- release
- master
- ipfs-deploy
8 changes: 0 additions & 8 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
*.json
build
coverage
node_modules
dist
.vscode
.yarn
**/tmp/
**/.next/
**/out/
**/.nyc_output
**/junit.xml
**/generated
governance/subgraph/tests/*
Loading

0 comments on commit c748578

Please sign in to comment.