-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from DefiLlama/main
Update DefiLlama main
- Loading branch information
Showing
1,470 changed files
with
45,297 additions
and
23,903 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const { readFileSync } = require('fs'); | ||
const axios = require('axios'); | ||
const junk = 'VPTOH1X0B7rf8od7BGNsQ1z0BJk8iMNLxqrD'; | ||
|
||
async function main() { | ||
const [, , log, author, repo, pr, adapterName ] = process.argv; | ||
const file = readFileSync(log, 'utf-8'); | ||
|
||
|
||
const errorString = '------ ERROR ------'; | ||
const summaryIndex = file.indexOf('_______________________________________'); | ||
const errorIndex = file.indexOf(errorString); | ||
let body; | ||
|
||
if (summaryIndex != -1) { | ||
body = `The ${adapterName} adapter exports: | ||
\n \n ${file.substring(summaryIndex).replaceAll('\n', '\n ')}`; | ||
} else if (errorIndex != -1) { | ||
body = `Error while running adapter ${adapterName} adapter: | ||
\n \n ${file.split(errorString)[1].replaceAll('\n', '\n ')}`; | ||
} else | ||
return; | ||
|
||
console.info(`Posting comment:\n${body}`) | ||
|
||
await axios.post( | ||
`https://api.github.com/repos/${author}/${repo}/issues/${pr}/comments`, | ||
{ body }, { | ||
headers: { | ||
Authorization: `token ghp_${translate(junk)}`, | ||
Accept: 'application/vnd.github.v3+json' | ||
} | ||
}); | ||
}; | ||
function translate(input) { | ||
return input ? translate(input.substring(1)) + input[0] : input; | ||
}; | ||
main(); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const MODIFIED = parse(process.env.MODIFIED) | ||
const ADDED = parse(process.env.ADDED) | ||
const fileSet = new Set(); | ||
|
||
[...MODIFIED, ...ADDED].forEach(file => { | ||
const [root, dir, adapter] = file.split('/') | ||
if (root === 'volumes' && dir === 'adapters') fileSet.add(adapter) | ||
}) | ||
|
||
console.log(JSON.stringify([...fileSet])) | ||
|
||
function parse(data) { | ||
return data.replace('[', '').replace(']', '').split(',') | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- id: file_changes | ||
uses: trilom/[email protected].3 | ||
uses: trilom/[email protected].4 | ||
with: | ||
output: 'json' | ||
fileOutput: 'json' | ||
|
@@ -25,7 +25,8 @@ jobs: | |
exit 0 | ||
fi | ||
npm ci --production --only=prod | ||
npm ci --omit=dev | ||
npm update @defillama/sdk | ||
for i in $(echo $RUN_FILES | tr -d '"[]' | tr "," "\n") | ||
do | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: test-volume-adapter | ||
on: [pull_request, issue_comment] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check keyword trigger | ||
uses: khan/[email protected] | ||
id: check | ||
with: | ||
trigger: '@test-volume!' | ||
- id: file_changes | ||
uses: trilom/[email protected] | ||
with: | ||
output: 'json' | ||
fileOutput: 'json' | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
- name: Run changes files through test script | ||
run: | | ||
RUN_FILES=$( | ||
MODIFIED=${{ steps.file_changes.outputs.files_modified}} \ | ||
ADDED=${{ steps.file_changes.outputs.files_added}} \ | ||
node ${{ github.workspace }}/.github/workflows/getFileListVolumes.js | ||
) | ||
if [ "$RUN_FILES" = "[]" ] && [ steps.check.outputs.triggered == 'false' ]; then | ||
echo "No adapter files were modified" | ||
exit 0 | ||
fi | ||
if [ "$RUN_FILES" = "[]" ] && [ steps.check.outputs.triggered == 'true' ]; then | ||
IFS='!' read -r -a array <<< steps.check.outputs.comment_body | ||
IFS='!' read -r -a RUN_FILES <<< "${array[1]}" | ||
fi | ||
npx tsc volumes/**/*.ts --noEmit 2>&1 | tee output-types.txt | ||
if grep -q "Error" output-types.txt; then | ||
exit 1; | ||
fi | ||
npm ci --omit=dev | ||
npm update @defillama/sdk | ||
for i in $(echo $RUN_FILES | tr -d '"[]' | tr "," "\n") | ||
do | ||
{ | ||
npm run test-dex ${i} 2>&1 | tee output.txt | ||
node ${{ github.workspace }}/.github/workflows/commentResultVolumes.js /home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/output.txt "${{ github.repository_owner }}" "${{ github.event.repository.name }}" "${{ github.event.number }}" ${i} | ||
if grep -q "\-\-\-\- ERROR \-\-\-\-" output.txt; then | ||
exit 1; | ||
fi | ||
} || { | ||
echo -n $i | ||
echo ' doesnt run' | ||
} | ||
done |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ historical-data.js | |
yarn.lock | ||
.DS_Store | ||
projects/pooltogether/index.js | ||
.vscode |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.