forked from DefiLlama/yield-server
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 1.86 KB
/
test.yml
File metadata and controls
59 lines (53 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Test_Change
on: pull_request
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- id: file_changes
uses: tj-actions/changed-files@v44
- name: Record PR number
run: |
mkdir -p pr-comments
echo "${{ github.event.number }}" > pr-comments/pr-number.txt
- name: Run changes files through test script
env:
ALCHEMY_CONNECTION_ARBITRUM: ${{ secrets.ALCHEMY_CONNECTION_ARBITRUM }}
ALCHEMY_CONNECTION_ETHEREUM: ${{ secrets.ALCHEMY_CONNECTION_ETHEREUM }}
ALCHEMY_CONNECTION_POLYGON: ${{ secrets.ALCHEMY_CONNECTION_POLYGON }}
run: |
RUN_FILES=$(
MODIFIED="${{ steps.file_changes.outputs.modified_files }}" \
ADDED="${{ steps.file_changes.outputs.added_files }}" \
node ${{ github.workspace }}/.github/workflows/getFileList.js
)
if [ "$RUN_FILES" = "[]" ]; then
echo "No adapter files were modified"
exit 0
fi
npm ci
for i in $(echo $RUN_FILES | tr -d '"[]' | tr "," "\n")
do
{
npm run test --adapter=${i} 2>&1 | tee output.txt
node ${{ github.workspace }}/.github/workflows/commentResult.js ${{ github.workspace }}/output.txt ${{ github.workspace }}/pr-comments ${i}
if grep -qE "PASS\s+.*test\.js" output.txt; then
exit 0;
else
exit 1;
fi
} || {
echo -n $i
echo ' doesnt run'
}
done
- name: Upload PR comments artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: pr-comments
path: pr-comments/
if-no-files-found: ignore
retention-days: 1