Skip to content

Commit 88a8af9

Browse files
committed
add a test workflow
1 parent bb2a4d8 commit 88a8af9

File tree

5 files changed

+66
-11
lines changed

5 files changed

+66
-11
lines changed

.clangd

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
InlayHints:
2+
Designators: No
3+
Enabled: Yes
4+
ParameterNames: No
5+
DeducedTypes: No
6+
7+
CompileFlags:
8+
Add: [-std=c++17, -Wall, -Wextra, -Wpedantic, -Werror]
9+
Compiler: clang++

.github/workflows/build.yml

+42-6
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,56 @@ name: ci
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: [ "main", "working-add-ci" ]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: [ "main", "working-add-ci" ]
88

99
jobs:
1010
build:
11-
runs-on: ${{ matrix.os }}
11+
name: ${{matrix.platform.name}}
12+
runs-on: ${{matrix.platform.os}}
1213

1314
strategy:
15+
fail-fast: false
16+
1417
matrix:
15-
os: [ubuntu-latest, windows-latest]
18+
platform:
19+
# - { name: Windows VS2019, ls: dir, os: windows-2019, disp: type, sample: pgn_samples, testpgn: pgn_samples\first.pgn, testuci: pgn_samples\first, analyzedpgn: .\pgn_samples\first.analyzed.pgn, bin: .\apgn.exe }
20+
# - { name: Windows VS2022, ls: dir, os: windows-2022, disp: type, sample: pgn_samples, testpgn: pgn_samples\first.pgn, testuci: pgn_samples\first, analyzedpgn: .\pgn_samples\first.analyzed.pgn, bin: .\apgn.exe }
21+
# - { name: Windows-Clang, ls: dir, os: windows-latest, disp: type, sample: pgn_samples, testpgn: pgn_samples\first.pgn, testuci: pgn_samples\first, analyzedpgn: .\pgn_samples\first.analyzed.pgn, bin: .\apgn.exe, flags: CC=clang CXX=clang++ }
22+
- { name: Windows-GCC, ls: dir, os: windows-latest, disp: type, sample: pgn_samples, testpgn: pgn_samples\first.pgn, testuci: pgn_samples\first, analyzedpgn: .\pgn_samples\first.analyzed.pgn, bin: .\apgn.exe, flags: CC=gcc CXX=g++ }
23+
- { name: Linux-GCC, ls: ls, os: ubuntu-latest, disp: cat, sample: ./pgn_samples, testpgn: ./pgn_samples/first.pgn, testuci: ./pgn_samples/first, analyzedpgn: ./pgn_samples/first.analyzed.pgn, bin: ./apgn }
24+
- { name: Linux-Clang, ls: ls, os: ubuntu-latest, disp: cat, sample: ./pgn_samples, testpgn: ./pgn_samples/first.pgn, testuci: ./pgn_samples/first, analyzedpgn: ./pgn_samples/first.analyzed.pgn, bin: ./apgn, flags: CC=clang CXX=clang++ }
25+
# - { name: MacOS-XCode, ls: ls, os: macos-latest, disp: cat, sample: ./pgn_samples, testpgn: ./pgn_samples/first.pgn, testuci: ./pgn_samples/first, analyzedpgn: ./pgn_samples/first.analyzed.pgn, bin: ./apgn }
1626

1727
steps:
1828
- uses: actions/checkout@v3
1929

20-
- name: compile and build
21-
run: make -j4
30+
- run: echo "this is a test" > test.log
31+
32+
- name: build for -> ${{matrix.platform.os}}
33+
run: make ${{matrix.platform.flags}} -j4
34+
35+
- name: ready executable for execution
36+
run: chmod a+rx ${{matrix.platform.bin}}
37+
38+
- name: ready first.pgn for reading
39+
run: chmod a+r ${{matrix.platform.testpgn}}
40+
41+
- name: run test
42+
run: ${{matrix.platform.bin}} -depth 5 ${{matrix.platform.testpgn}}
43+
44+
- name: show files in current directory
45+
run: ${{matrix.platform.ls}}
46+
47+
- name: show files in sample pgn folder
48+
run: ${{matrix.platform.ls}} ${{matrix.platform.sample}}
49+
50+
# - name: display pgn test subject
51+
# run: ${{matrix.platform.disp}} ${{matrix.platform.testpgn}}
52+
53+
# - name: display uci test subject
54+
# run: ${{matrix.platform.disp}} ${{matrix.platform.testuci}}
55+
56+
- name: display results
57+
run: ${{matrix.platform.disp}} ${{matrix.platform.analyzedpgn}}

convert.hpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,24 @@ namespace apgn_convert
6363
{
6464
std::string PGN_EXTRACT = "pgn-extract", FLG1 = "-WsanPNBRQK", FLG2 = "--output";
6565
char *const args[] = {PGN_EXTRACT.data(),FLG1.data(),FLG2.data(),(char* const)output.c_str(),(char* const)input.c_str(),NULL};
66+
67+
#if defined(_WIN32) || defined(_WIN64)
68+
run_subprog(apgnFileSys::getExecpath()+"\\bin\\pgn-extract",args);
69+
#else
6670
run_subprog(apgnFileSys::getExecpath()+"/bin/pgn-extract",args);
71+
#endif
6772
}
6873

6974
void pgn_to_uci(const std::string& input, const std::string output)
7075
{
7176
std::string PGN_EXTRACT = "pgn-extract", FLG1 = "-Wuci", FLG2 = "--output";
7277
char *const args[] = {PGN_EXTRACT.data(),FLG1.data(),FLG2.data(),(char* const)output.c_str(),(char* const)input.c_str(),NULL};
78+
79+
#if defined(_WIN32) || defined(_WIN64)
80+
run_subprog(apgnFileSys::getExecpath()+"\\bin\\pgn-extract",args);
81+
#else
7382
run_subprog(apgnFileSys::getExecpath()+"/bin/pgn-extract",args);
83+
#endif
7484
}
7585

7686
void analyse_game(
@@ -194,7 +204,7 @@ namespace apgn_convert
194204
wait(NULL);
195205
}
196206
#else
197-
std::string analyse_executable_path = apgnFileSys::getExecpath()+"/bin/analyse";
207+
std::string analyse_executable_path = apgnFileSys::getExecpath()+"\\bin\\analyse";
198208
std::string result_pgn;
199209

200210
switch (apgn_COLOR)

dependencies/uci-analyser/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
OS := $(shell uname)
2424

25-
CC=g++
25+
CXX=g++
2626

2727
ifeq ($(OS), Linux)
2828
# LINUX
@@ -46,10 +46,10 @@ OBJS=analyse.o evaluation.o engine.o utils.o interpret.o
4646
TARGET=analyse
4747

4848
.cpp.o:
49-
$(CC) $(CFLAGS) $< -o $@
49+
$(CXX) $(CFLAGS) $< -o $@
5050

5151
$(TARGET) : $(OBJS)
52-
$(CC) -o $@ $(OBJS)
52+
$(CXX) -o $@ $(OBJS)
5353

5454
clean:
5555
rm -f $(OBJS) $(TARGET)

main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ std::string DEFAULT_ENGINE()
5353
#if defined(__linux__)
5454
return apgnFileSys::getExecpath()+"/bin/engines/stockfish";
5555
#elif (defined(_WIN64) || defined(_WIN32))
56-
return apgnFileSys::getExecpath()+"/bin/engines/stockfish.exe";
56+
return apgnFileSys::getExecpath()+"\\bin\\engines\\stockfish.exe";
5757
#endif
5858
}
5959

0 commit comments

Comments
 (0)