forked from DefiLlama/DefiLlama-Adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 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,57 @@ | ||
name: test-volume-adapter | ||
on: [pull_request, issue_comment] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Chack 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 |