diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba2eaef..ea48817 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,20 +2,47 @@ name: ci on: push: - branches: [ "main" ] + branches: [ "main", "add-ci-test" ] pull_request: - branches: [ "main" ] + branches: [ "main", "add-ci-test" ] jobs: build: - runs-on: ${{ matrix.os }} + name: ${{matrix.platform.name}} + runs-on: ${{matrix.platform.os}} strategy: + fail-fast: false + matrix: - os: [ubuntu-latest, windows-latest] + platform: + # - { name: Windows VS2019, ls: dir, os: windows-2019, disp: type, sample: 'pgn_samples', testpgn: 'pgn_samples\first.pgn', analyzedpgn: .\\pgn_samples\\first.analyzed.pgn, bin: .\\apgn.exe } + # - { name: Windows VS2022, ls: dir, os: windows-2022, disp: type, sample: 'pgn_samples', testpgn: 'pgn_samples\first.pgn', analyzedpgn: .\\pgn_samples\\first.analyzed.pgn, bin: .\\apgn.exe } + - { name: Windows-Clang, ls: dir, os: windows-latest, disp: type, sample: 'pgn_samples', testpgn: 'pgn_samples\first.pgn', analyzedpgn: .\\pgn_samples\\first.analyzed.pgn, bin: .\\apgn.exe, flags: CC=clang CXX=clang++ } + - { name: Windows-GCC, ls: dir, os: windows-latest, disp: type, sample: 'pgn_samples', testpgn: 'pgn_samples\first.pgn', analyzedpgn: .\\pgn_samples\\first.analyzed.pgn, bin: .\\apgn.exe, flags: CC=gcc CXX=g++ } + - { name: MacOS-XCode, ls: ls, os: macos-latest, disp: cat, sample: ./pgn_samples, testpgn: ./pgn_samples/first.pgn, analyzedpgn: ./pgn_samples/first.analyzed.pgn, bin: ./apgn } + - { name: Linux-GCC, ls: ls, os: ubuntu-latest, disp: cat, sample: ./pgn_samples, testpgn: ./pgn_samples/first.pgn, analyzedpgn: ./pgn_samples/first.analyzed.pgn, bin: ./apgn } + - { name: Linux-Clang, ls: ls, os: ubuntu-latest, disp: cat, sample: ./pgn_samples, testpgn: ./pgn_samples/first.pgn, analyzedpgn: ./pgn_samples/first.analyzed.pgn, bin: ./apgn, flags: CC=clang CXX=clang++ } steps: - uses: actions/checkout@v3 - - name: compile and build - run: make -j4 \ No newline at end of file + - name: build for -> ${{matrix.platform.os}} + run: make ${{matrix.platform.flags}} -j4 + + - name: run test + run: ${{matrix.platform.bin}} -depth 5 ${{matrix.platform.testpgn}} + + - name: show files in current directory + run: ${{matrix.platform.ls}} + + - name: show files in sample pgn folder + run: ${{matrix.platform.ls}} ${{matrix.platform.sample}} + + - name: display results + run: ${{matrix.platform.disp}} ${{matrix.platform.analyzedpgn}} + + - name: Create release test files + run: gh release create ${{github.ref_name}}-${{matrix.platform.name}} ${{matrix.platform.analyzedpgn}} --title "${{github.ref_name}}-${{matrix.platform.name}}" --notes "test files for ${{github.ref_name}}" --draft=true --prerelease=true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Makefile b/Makefile index d907879..54e2807 100644 --- a/Makefile +++ b/Makefile @@ -25,10 +25,10 @@ ifeq ($(OS), Linux) else chmod +x bin/engines/stockfish.exe endif - ${CXX} ${CXX_FLAGS} main.cpp -o ${EXECUTABLE} + $(CXX) $(CXX_FLAGS) main.cpp -o $(EXECUTABLE) test: - ./${EXECUTABLE} ./pgn_samples/first.pgn W + ./$(EXECUTABLE) ./pgn_samples/first.pgn W test_clean: ifeq ($(OS), Linux) @@ -39,7 +39,7 @@ endif install: ifeq ($(OS), Linux) - @ln -s $(dir $(abspath $(lastword $(MAKEFILE_LIST))))${EXECUTABLE} ${INSTALLPATH} + @ln -s $(dir $(abspath $(lastword $(MAKEFILE_LIST))))$(EXECUTABLE) $(INSTALLPATH) else @echo "make install is not supported for windows" # SETX /M PATH "%PATH%;$(dir $(abspath $(lastword $(MAKEFILE_LIST))))" @@ -47,7 +47,7 @@ endif uninstall: ifeq ($(OS), Linux) - @rm ${INSTALLPATH}/${EXECUTABLE} + @rm $(INSTALLPATH)/$(EXECUTABLE) else @echo "make uninstall is not supported for windows" endif @@ -58,4 +58,4 @@ clean: @echo "removing uci-analyse object files" @$(MAKE) -C dependencies/uci-analyser clean @echo "removing analyse-pgn binaries files" - @rm ./bin/analyse${EXTENSION} ./bin/pgn-extract${EXTENSION} ./${EXECUTABLE} \ No newline at end of file + @rm ./bin/analyse$(EXTENSION) ./bin/pgn-extract$(EXTENSION) ./$(EXECUTABLE) \ No newline at end of file diff --git a/dependencies/uci-analyser/Makefile b/dependencies/uci-analyser/Makefile index 6baf296..b5b4296 100755 --- a/dependencies/uci-analyser/Makefile +++ b/dependencies/uci-analyser/Makefile @@ -22,7 +22,7 @@ OS := $(shell uname) -CC=g++ +CXX=g++ ifeq ($(OS), Linux) # LINUX @@ -46,10 +46,10 @@ OBJS=analyse.o evaluation.o engine.o utils.o interpret.o TARGET=analyse .cpp.o: - $(CC) $(CFLAGS) $< -o $@ + $(CXX) $(CFLAGS) $< -o $@ $(TARGET) : $(OBJS) - $(CC) -o $@ $(OBJS) + $(CXX) -o $@ $(OBJS) clean: rm -f $(OBJS) $(TARGET)