mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
76 lines
2.7 KiB
YAML
76 lines
2.7 KiB
YAML
name: Test_Change
|
|
on:
|
|
pull_request
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- id: file_changes
|
|
uses: trilom/file-changes-action@ce38c8ce2459ca3c303415eec8cb0409857b4272
|
|
with:
|
|
output: 'json'
|
|
fileOutput: 'json'
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
name: Install pnpm
|
|
with:
|
|
version: 10
|
|
run_install: false
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Run changes files through test script
|
|
env:
|
|
LLAMA_DEBUG_MODE: "true"
|
|
run: |
|
|
RUN_FILES=$(
|
|
MODIFIED=${{ steps.file_changes.outputs.files_modified}} \
|
|
ADDED=${{ steps.file_changes.outputs.files_added}} \
|
|
node ${{ github.workspace }}/.github/workflows/getFileList.js
|
|
)
|
|
|
|
if [ "$RUN_FILES" = "[]" ]; then
|
|
echo "No adapter files were modified"
|
|
exit 0
|
|
fi
|
|
|
|
# pnpm remove typescript @types/async-retry @types/bn.js ts-node @solendprotocol/solend-sdk @hover-labs/kolibri-js
|
|
|
|
# fail if package.json or package-lock.json is changed
|
|
FILES_MODIFIED=${{ steps.file_changes.outputs.files_modified }}
|
|
if [[ $FILES_MODIFIED == *"package.json"* || $FILES_MODIFIED == *"package-lock.json"* ]]; then
|
|
echo "------ ERROR ------ > Please revert changes to package.json / package-lock.json" > /home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/output.txt
|
|
node ${{ github.workspace }}/.github/workflows/commentResult.js /home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/output.txt "${{ github.repository_owner }}" "${{ github.event.repository.name }}" "${{ github.event.number }}"
|
|
exit 1
|
|
fi
|
|
|
|
for i in $(echo $RUN_FILES | tr -d '"[]' | tr "," "\n")
|
|
do
|
|
{
|
|
node ${{ github.workspace }}/test.js ${{ github.workspace }}/${i} 2>&1 | tee output.txt
|
|
node ${{ github.workspace }}/.github/workflows/commentResult.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
|
|
|
|
- name: Run ESLint
|
|
run: |
|
|
npm run lint
|