@@ -15,81 +15,76 @@ jobs:
1515 env :
1616 LANGS : " go rust python java typescript"
1717 steps :
18- - name : Setup Go environment
19- uses : actions/setup-go@v5
18+ - uses : actions/checkout@v4
19+ with : { path: 'pr_repo' }
20+ - uses : actions/checkout@v4
21+ with : { path: 'main_repo', ref: 'main' }
22+
23+ - uses : actions/setup-go@v5
2024 with :
2125 go-version : ' 1.22'
22-
23- - name : Setup Rust toolchain
24- uses : dtolnay/rust-toolchain@stable
26+ cache-dependency-path : main_repo/go.sum
27+ - uses : dtolnay/rust-toolchain@stable
2528 with :
2629 toolchain : stable
2730 components : rust-analyzer
28-
29- - name : Setup Python environment
30- uses : actions/setup-python@v5
31+ - uses : actions/setup-python@v5
3132 with :
3233 python-version : ' 3.11'
33-
34- - name : Setup JDK 21
35- uses : actions/setup-java@v4
34+ - uses : actions/setup-java@v4
3635 with :
3736 java-version : ' 21'
3837 distribution : ' temurin'
39-
40- - name : Setup Node.js
41- uses : actions/setup-node@v4
38+ - uses : actions/setup-node@v4
4239 with :
4340 node-version : ' 22'
4441
45- - name : Checkout pull request code
46- uses : actions/checkout@v4
47- with :
48- path : ' pr_repo'
49-
50- - name : Checkout main branch code
51- uses : actions/checkout@v4
52- with :
53- ref : ' main'
54- path : ' main_repo'
55-
5642 - name : Compile both binaries
5743 run : |
58- (cd main_repo && go build -o ../abcoder_old )
59- (cd pr_repo && go build -o ../abcoder_new )
44+ (cd main_repo && go build -o ../abcoder_main )
45+ (cd pr_repo && go build -o ../abcoder_pr )
6046
47+ # Uses the pr evaluation script.
6148 - name : Install evaluation dependencies
62- run : pip install -r ./pr_repo/script/requirements.txt
49+ run : |
50+ pip install -r ./pr_repo/script/requirements.txt
6351
64- - name : Install LSPs
52+ - name : Install dependencies for main branch
6553 run : |
66- OUTDIR=out_new ABCEXE=./abcoder_new ./pr_repo/script/run_testdata.sh first
67- # use the same JDTLS for consistency and to avoid wasting time installing a duplicate JDTLS
54+ OUTDIR=out_main ABCEXE=./abcoder_main ./pr_repo/script/run_testdata.sh first
6855 echo "JDTLS_ROOT_PATH=$(realpath ./pr_repo/lang/java/lsp/jdtls/jdt-language-server-*)" >> $GITHUB_ENV
6956
70- - name : Run OLD abcoder
57+ - name : Run main branch abcoder
7158 run :
72- OUTDIR=out_old ABCEXE=./abcoder_old ./pr_repo/script/run_testdata.sh all
59+ OUTDIR=out_main ABCEXE=./abcoder_main ./pr_repo/script/run_testdata.sh all
60+
61+ # Whether to reset dependencies:
62+ # [n] Go: builtin parser, do not reset
63+ # [n] Rust: assume rls to be same version
64+ # [n] Python: assume pylsp to be same version
65+ # [n] Java: assume jdtls to be same version
66+ # [y] TypeScript: need to reset installed parser
67+ - name : Reset dependencies
68+ run : |
69+ npm uninstall -g abcoder-ts-parser
7370
74- - name : Run NEW abcoder
75- run :
76- OUTDIR=out_new ABCEXE=./abcoder_new ./pr_repo/script/run_testdata.sh all
71+ - name : Install dependencies for PR
72+ run : |
73+ OUTDIR=out_pr ABCEXE=./abcoder_pr ./pr_repo/script/run_testdata.sh first
7774
78- - name : Compare outputs and check for regression
79- id : diff_check
80- run : ./pr_repo/script/diffjson.py out_old out_new || echo "failed=true" >> $GITHUB_OUTPUT
81- continue-on-error : true
75+ - name : Run PR abcoder
76+ run :
77+ OUTDIR=out_pr ABCEXE=./abcoder_pr ./pr_repo/script/run_testdata.sh all
8278
8379 - name : Upload output directories
8480 uses : actions/upload-artifact@v4
8581 if : always()
8682 with :
8783 name : regression-outputs
8884 path : |
89- out_old
90- out_new
85+ out_main
86+ out_pr
9187 retention-days : 3
9288
93- - name : Status check
94- if : steps.diff_check.outputs.failed == 'true'
95- run : exit 1
89+ - name : Compare outputs and check for regression
90+ run : ./pr_repo/script/diffjson.py out_main out_pr
0 commit comments