diff --git a/.github/ci/macos_matrix.json b/.github/ci/macos_matrix.json new file mode 100644 index 000000000..ba4453c11 --- /dev/null +++ b/.github/ci/macos_matrix.json @@ -0,0 +1,64 @@ +{ + "include": [ + { + "config": { + "name": "macOS 15 Apple Clang", + "os": "macos-15-intel", + "simple_name": "macos", + "compiler": "clang++", + "comp": "clang", + "shell": "bash", + "archive_ext": "tar" + }, + "binaries": "x86-64" + }, + { + "config": { + "name": "macOS 15 Apple Clang", + "os": "macos-15-intel", + "simple_name": "macos", + "compiler": "clang++", + "comp": "clang", + "shell": "bash", + "archive_ext": "tar" + }, + "binaries": "x86-64-sse41-popcnt" + }, + { + "config": { + "name": "macOS 15 Apple Clang", + "os": "macos-15-intel", + "simple_name": "macos", + "compiler": "clang++", + "comp": "clang", + "shell": "bash", + "archive_ext": "tar" + }, + "binaries": "x86-64-avx2" + }, + { + "config": { + "name": "macOS 15 Apple Clang", + "os": "macos-15-intel", + "simple_name": "macos", + "compiler": "clang++", + "comp": "clang", + "shell": "bash", + "archive_ext": "tar" + }, + "binaries": "x86-64-bmi2" + }, + { + "config": { + "name": "macOS 15 Apple Clang M1", + "os": "macos-15", + "simple_name": "macos-m1", + "compiler": "clang++", + "comp": "clang", + "shell": "bash", + "archive_ext": "tar" + }, + "binaries": "apple-silicon" + } + ] +} \ No newline at end of file diff --git a/.github/ci/matrix.json b/.github/ci/matrix.json deleted file mode 100644 index e9215269b..000000000 --- a/.github/ci/matrix.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "config": [ - { - "name": "Ubuntu 22.04 GCC", - "os": "ubuntu-22.04", - "simple_name": "ubuntu", - "compiler": "g++", - "comp": "gcc", - "shell": "bash", - "archive_ext": "tar", - "sde": "/home/runner/work/Stockfish/Stockfish/.output/sde-temp-files/sde-external-9.33.0-2024-01-07-lin/sde -future --" - }, - { - "name": "macOS 15 Apple Clang", - "os": "macos-15-intel", - "simple_name": "macos", - "compiler": "clang++", - "comp": "clang", - "shell": "bash", - "archive_ext": "tar" - }, - { - "name": "macOS 15 Apple Clang M1", - "os": "macos-15", - "simple_name": "macos-m1", - "compiler": "clang++", - "comp": "clang", - "shell": "bash", - "archive_ext": "tar" - }, - { - "name": "Windows 2022 Mingw-w64 GCC x86_64", - "os": "windows-2022", - "simple_name": "windows", - "compiler": "g++", - "comp": "mingw", - "msys_sys": "mingw64", - "msys_env": "x86_64-gcc", - "shell": "msys2 {0}", - "ext": ".exe", - "sde": "/d/a/Stockfish/Stockfish/.output/sde-temp-files/sde-external-9.33.0-2024-01-07-win/sde.exe -future --", - "archive_ext": "zip" - }, - { - "name": "Windows 11 Mingw-w64 Clang arm64", - "os": "windows-11-arm", - "simple_name": "windows", - "compiler": "clang++", - "comp": "clang", - "msys_sys": "clangarm64", - "msys_env": "clang-aarch64-clang", - "shell": "msys2 {0}", - "ext": ".exe", - "archive_ext": "zip" - } - ], - "binaries": [ - "x86-64", - "x86-64-sse41-popcnt", - "x86-64-avx2", - "x86-64-bmi2", - "x86-64-avxvnni", - "x86-64-avx512", - "x86-64-vnni512", - "x86-64-avx512icl", - "apple-silicon", - "armv8", - "armv8-dotprod" - ], - "exclude": [ - { - "binaries": "x86-64", - "config": { - "os": "macos-15" - } - }, - { - "binaries": "x86-64-sse41-popcnt", - "config": { - "os": "macos-15" - } - }, - { - "binaries": "x86-64-avx2", - "config": { - "os": "macos-15" - } - }, - { - "binaries": "x86-64-bmi2", - "config": { - "os": "macos-15" - } - }, - { - "binaries": "x86-64-avxvnni", - "config": { - "os": "macos-15" - } - }, - { - "binaries": "x86-64-avx512", - "config": { - "os": "macos-15" - } - }, - { - "binaries": "x86-64-vnni512", - "config": { - "os": "macos-15" - } - }, - { - "binaries": "x86-64-avx512icl", - "config": { - "os": "macos-15" - } - }, - { - "binaries": "x86-64-avxvnni", - "config": { - "os": "macos-15-intel" - } - }, - { - "binaries": "x86-64-avx512", - "config": { - "os": "macos-15-intel" - } - }, - { - "binaries": "x86-64-vnni512", - "config": { - "os": "macos-15-intel" - } - }, - { - "binaries": "x86-64-avx512icl", - "config": { - "os": "macos-15-intel" - } - }, - { - "binaries": "x86-64", - "config": { - "os": "windows-11-arm" - } - }, - { - "binaries": "x86-64-sse41-popcnt", - "config": { - "os": "windows-11-arm" - } - }, - { - "binaries": "x86-64-avx2", - "config": { - "os": "windows-11-arm" - } - }, - { - "binaries": "x86-64-bmi2", - "config": { - "os": "windows-11-arm" - } - }, - { - "binaries": "x86-64-avxvnni", - "config": { - "os": "windows-11-arm" - } - }, - { - "binaries": "x86-64-avx512", - "config": { - "os": "windows-11-arm" - } - }, - { - "binaries": "x86-64-vnni512", - "config": { - "os": "windows-11-arm" - } - }, - { - "binaries": "x86-64-avx512icl", - "config": { - "os": "windows-11-arm" - } - }, - { - "binaries": "apple-silicon", - "config": { - "os": "windows-2022" - } - }, - { - "binaries": "apple-silicon", - "config": { - "os": "windows-11-arm" - } - }, - { - "binaries": "apple-silicon", - "config": { - "os": "ubuntu-20.04" - } - }, - { - "binaries": "apple-silicon", - "config": { - "os": "ubuntu-22.04" - } - }, - { - "binaries": "apple-silicon", - "config": { - "os": "macos-15-intel" - } - }, - { - "binaries": "armv8", - "config": { - "os": "windows-2022" - } - }, - { - "binaries": "armv8", - "config": { - "os": "ubuntu-20.04" - } - }, - { - "binaries": "armv8", - "config": { - "os": "ubuntu-22.04" - } - }, - { - "binaries": "armv8", - "config": { - "os": "macos-15-intel" - } - }, - { - "binaries": "armv8", - "config": { - "os": "macos-15" - } - }, - { - "binaries": "armv8-dotprod", - "config": { - "os": "windows-2022" - } - }, - { - "binaries": "armv8-dotprod", - "config": { - "os": "ubuntu-20.04" - } - }, - { - "binaries": "armv8-dotprod", - "config": { - "os": "ubuntu-22.04" - } - }, - { - "binaries": "armv8-dotprod", - "config": { - "os": "macos-15-intel" - } - }, - { - "binaries": "armv8-dotprod", - "config": { - "os": "macos-15" - } - } - ] -} diff --git a/.github/ci/windows_arm_matrix.json b/.github/ci/windows_arm_matrix.json new file mode 100644 index 000000000..42f9baefa --- /dev/null +++ b/.github/ci/windows_arm_matrix.json @@ -0,0 +1,34 @@ +{ + "include": [ + { + "config": { + "name": "Windows 11 Mingw-w64 Clang arm64", + "os": "windows-11-arm", + "simple_name": "windows", + "compiler": "clang++", + "comp": "clang", + "msys_sys": "clangarm64", + "msys_env": "clang-aarch64-clang", + "shell": "msys2 {0}", + "ext": ".exe", + "archive_ext": "zip" + }, + "binaries": "armv8" + }, + { + "config": { + "name": "Windows 11 Mingw-w64 Clang arm64", + "os": "windows-11-arm", + "simple_name": "windows", + "compiler": "clang++", + "comp": "clang", + "msys_sys": "clangarm64", + "msys_env": "clang-aarch64-clang", + "shell": "msys2 {0}", + "ext": ".exe", + "archive_ext": "zip" + }, + "binaries": "armv8-dotprod" + } + ] +} diff --git a/.github/workflows/arm_compilation.yml b/.github/workflows/arm_compilation.yml index ce85871e5..0baf739db 100644 --- a/.github/workflows/arm_compilation.yml +++ b/.github/workflows/arm_compilation.yml @@ -1,4 +1,4 @@ -name: Compilation +name: Android Compilation on: workflow_call: inputs: @@ -7,7 +7,7 @@ on: required: true jobs: Compilation: - name: ${{ matrix.config.name }} ${{ matrix.binaries }} + name: "Android build: ${{ matrix.config.name }} ${{ matrix.binaries }}" runs-on: ${{ matrix.config.os }} env: COMPCXX: ${{ matrix.config.compiler }} diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index cc613ee15..84c412c00 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -42,7 +42,7 @@ jobs: install: mingw-w64-${{ matrix.config.msys_env }} make git zip - name: Download SDE package - if: runner.os == 'Linux' || runner.os == 'Windows' + if: ${{ matrix.config.sde }} uses: petarpetrovt/setup-sde@2a27a21f27212e473f3cc59a6dac97d8dffe8970 # v3.0 with: environmentVariableName: SDE_DIR @@ -71,7 +71,7 @@ jobs: $COMPCXX -Q -march=native --help=target fi - # x86-64 with newer extensions tests + # Compile the configured release binary. - name: Compile ${{ matrix.config.binaries }} build run: | @@ -92,118 +92,3 @@ jobs: . !.git !.output - - UniversalLinux: - name: Ubuntu x86-64 Universal - runs-on: ubuntu-22.04 - defaults: - run: - shell: bash - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - fetch-depth: 0 - - - name: Install GCC 15 - uses: egor-tensin/setup-gcc@a2861a8b8538f49cf2850980acccf6b05a1b2ae4 # v2.0 - with: - version: 15 - - - name: Download SDE package - uses: petarpetrovt/setup-sde@2a27a21f27212e473f3cc59a6dac97d8dffe8970 # v3.0 - with: - environmentVariableName: SDE_DIR - sdeVersion: 9.33.0 - - - name: Build universal binary - run: make -j4 -C src ARCH=x86-64-universal profile-build RUN_PREFIX="$SDE_DIR/sde -future --" - - - name: Strip binary - run: strip src/stockfish - - - name: Rename binary - run: mv src/stockfish stockfish-linux-x86-64-universal - - - name: Extract the bench number from the commit history - run: | - for hash in $(git rev-list -100 HEAD); do - benchref=$(git show -s $hash | tac | grep -m 1 -o -x '[[:space:]]*\b[Bb]ench[ :]\+[1-9][0-9]\{5,7\}\b[[:space:]]*' | sed 's/[^0-9]//g') && break || true - done - [[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found" - - - name: Check arch selection under SDE - run: ./scripts/check_universal.sh ./stockfish-linux-x86-64-universal "$SDE_DIR/sde" "$benchref" - - - name: Remove non src files - run: | - rm -fR src/temp_builds - git -C src clean -fx - - - name: Upload artifact for (pre)-release - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: linux x86-64-universal - path: | - . - !.git - !.output - - UniversalWindows: - name: Windows x86-64 Universal - runs-on: windows-2022 - defaults: - run: - shell: msys2 {0} - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - fetch-depth: 0 - - - name: Setup msys and install required packages - uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c # v2.31.1 - with: - msystem: mingw64 - install: mingw-w64-x86_64-gcc make git zip - - - name: Download SDE package - uses: petarpetrovt/setup-sde@2a27a21f27212e473f3cc59a6dac97d8dffe8970 # v3.0 - with: - environmentVariableName: SDE_DIR - sdeVersion: 9.33.0 - - - name: Build universal binary - run: | - SDE_PATH=$(cygpath "$SDE_DIR") - make -j4 -C src ARCH=x86-64-universal profile-build RUN_PREFIX="$SDE_PATH/sde.exe -future --" - - - name: Strip binary - run: strip src/stockfish.exe - - - name: Rename binary - run: mv src/stockfish.exe stockfish-windows-x86-64-universal.exe - - - name: Extract the bench number from the commit history - run: | - for hash in $(git rev-list -100 HEAD); do - benchref=$(git show -s $hash | tac | grep -m 1 -o -x '[[:space:]]*\b[Bb]ench[ :]\+[1-9][0-9]\{5,7\}\b[[:space:]]*' | sed 's/[^0-9]//g') && break || true - done - [[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found" - - - name: Check arch selection under SDE - run: ./scripts/check_universal.sh ./stockfish-windows-x86-64-universal.exe "$SDE_DIR/sde" "$benchref" - - - name: Remove non src files - run: | - rm -fR src/temp_builds - git -C src clean -fx - - - name: Upload artifact for (pre)-release - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: windows x86-64-universal - path: | - . - !.git - !.output diff --git a/.github/workflows/stockfish.yml b/.github/workflows/stockfish.yml index 0d5bceebf..a7ecb8acb 100644 --- a/.github/workflows/stockfish.yml +++ b/.github/workflows/stockfish.yml @@ -18,6 +18,7 @@ concurrency: jobs: Prerelease: + name: Prerelease if: github.repository == 'official-stockfish/Stockfish' && (github.ref == 'refs/heads/master' || (startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag')) runs-on: ubuntu-latest needs: [Matrix] @@ -79,68 +80,105 @@ jobs: tag_name: stockfish-dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }} prerelease: true Matrix: + name: Prepare matrices runs-on: ubuntu-latest outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} + macos_matrix: ${{ steps.set-macos-matrix.outputs.macos_matrix }} + windows_arm_matrix: ${{ steps.set-windows-arm-matrix.outputs.windows_arm_matrix }} arm_matrix: ${{ steps.set-arm-matrix.outputs.arm_matrix }} universal_matrix: ${{ steps.set-universal-matrix.outputs.universal_matrix }} steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - id: set-matrix + - id: set-macos-matrix run: | - TASKS=$(echo $(cat .github/ci/matrix.json) ) - echo "MATRIX=$TASKS" >> $GITHUB_OUTPUT + MACOS_MATRIX=$(jq -c '.' .github/ci/macos_matrix.json) + echo "MACOS_MATRIX=$MACOS_MATRIX" >> $GITHUB_OUTPUT + - id: set-windows-arm-matrix + run: | + WINDOWS_ARM_MATRIX=$(jq -c '.' .github/ci/windows_arm_matrix.json) + echo "WINDOWS_ARM_MATRIX=$WINDOWS_ARM_MATRIX" >> $GITHUB_OUTPUT - id: set-arm-matrix run: | - TASKS_ARM=$(echo $(cat .github/ci/arm_matrix.json) ) - echo "ARM_MATRIX=$TASKS_ARM" >> $GITHUB_OUTPUT + ARM_MATRIX=$(jq -c '.' .github/ci/arm_matrix.json) + echo "ARM_MATRIX=$ARM_MATRIX" >> $GITHUB_OUTPUT - id: set-universal-matrix run: | - TASKS_UNIVERSAL=$(echo $(cat .github/ci/universal_matrix.json) ) - echo "UNIVERSAL_MATRIX=$TASKS_UNIVERSAL" >> $GITHUB_OUTPUT + UNIVERSAL_MATRIX=$(jq -c '.' .github/ci/universal_matrix.json) + echo "UNIVERSAL_MATRIX=$UNIVERSAL_MATRIX" >> $GITHUB_OUTPUT # Testing Jobs IWYU: + name: IWYU uses: ./.github/workflows/iwyu.yml Sanitizers: + name: Sanitizers if: ${{ always() }} uses: ./.github/workflows/sanitizers.yml Tests: + name: Tests if: ${{ always() }} uses: ./.github/workflows/tests.yml Matetrack: + name: Matetrack if: ${{ always() }} uses: ./.github/workflows/matetrack.yml Games: + name: Games if: ${{ always() }} uses: ./.github/workflows/games.yml CompilerCheck: + name: Compiler check if: ${{ always() }} uses: ./.github/workflows/avx2_compilers.yml # Release Jobs Compilation: + name: macOS builds needs: [Matrix, Sanitizers, Tests, Matetrack, Games, CompilerCheck] uses: ./.github/workflows/compilation.yml with: - matrix: ${{ needs.Matrix.outputs.matrix }} + matrix: ${{ needs.Matrix.outputs.macos_matrix }} + WindowsARMCompilation: + name: Windows ARM builds + needs: [Matrix, Sanitizers, Tests, Matetrack, Games, CompilerCheck] + uses: ./.github/workflows/compilation.yml + with: + matrix: ${{ needs.Matrix.outputs.windows_arm_matrix }} ARMCompilation: + name: Android builds needs: [Matrix, Sanitizers, Tests, Matetrack, Games, CompilerCheck] uses: ./.github/workflows/arm_compilation.yml with: matrix: ${{ needs.Matrix.outputs.arm_matrix }} + UniversalCompilation: + name: "Universal builds" + needs: [Matrix, Sanitizers, Tests, Matetrack, Games, CompilerCheck] + uses: ./.github/workflows/universal_compilation.yml Binaries: if: github.repository == 'official-stockfish/Stockfish' + name: macOS uploads needs: [Prerelease, Matrix, Compilation] uses: ./.github/workflows/upload_binaries.yml with: - matrix: ${{ needs.Matrix.outputs.matrix }} + matrix: ${{ needs.Matrix.outputs.macos_matrix }} + permissions: + contents: write # For deleting/creating a (pre)release + secrets: + token: ${{ secrets.GITHUB_TOKEN }} + WindowsARM_Binaries: + if: github.repository == 'official-stockfish/Stockfish' + name: Windows ARM uploads + needs: [Prerelease, Matrix, WindowsARMCompilation] + uses: ./.github/workflows/upload_binaries.yml + with: + matrix: ${{ needs.Matrix.outputs.windows_arm_matrix }} permissions: contents: write # For deleting/creating a (pre)release secrets: token: ${{ secrets.GITHUB_TOKEN }} ARM_Binaries: if: github.repository == 'official-stockfish/Stockfish' + name: Android uploads needs: [Prerelease, Matrix, ARMCompilation] uses: ./.github/workflows/upload_binaries.yml with: @@ -151,7 +189,8 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} Universal_Binaries: if: github.repository == 'official-stockfish/Stockfish' - needs: [Prerelease, Matrix, Compilation] + name: Universal binaries + needs: [Prerelease, Matrix, UniversalCompilation] uses: ./.github/workflows/upload_binaries.yml with: matrix: ${{ needs.Matrix.outputs.universal_matrix }} diff --git a/.github/workflows/universal_compilation.yml b/.github/workflows/universal_compilation.yml new file mode 100644 index 000000000..5aada6985 --- /dev/null +++ b/.github/workflows/universal_compilation.yml @@ -0,0 +1,118 @@ +name: Universal Compilation +on: + workflow_call: +jobs: + UniversalLinux: + name: Linux + runs-on: ubuntu-22.04 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + fetch-depth: 0 + + - name: Install GCC 15 + uses: egor-tensin/setup-gcc@a2861a8b8538f49cf2850980acccf6b05a1b2ae4 # v2.0 + with: + version: 15 + + - name: Download SDE package + uses: petarpetrovt/setup-sde@2a27a21f27212e473f3cc59a6dac97d8dffe8970 # v3.0 + with: + environmentVariableName: SDE_DIR + sdeVersion: 9.33.0 + + - name: Build universal binary + run: make -j4 -C src ARCH=x86-64-universal profile-build RUN_PREFIX="$SDE_DIR/sde -future --" + + - name: Strip binary + run: strip src/stockfish + + - name: Rename binary + run: mv src/stockfish stockfish-linux-x86-64-universal + + - name: Extract the bench number from the commit history + run: | + for hash in $(git rev-list -100 HEAD); do + benchref=$(git show -s $hash | tac | grep -m 1 -o -x '[[:space:]]*\b[Bb]ench[ :]\+[1-9][0-9]\{5,7\}\b[[:space:]]*' | sed 's/[^0-9]//g') && break || true + done + [[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found" + + - name: Check arch selection under SDE + run: ./scripts/check_universal.sh ./stockfish-linux-x86-64-universal "$SDE_DIR/sde" "$benchref" + + - name: Remove non src files + run: | + rm -fR src/temp_builds + git -C src clean -fx + + - name: Upload artifact for (pre)-release + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: linux x86-64-universal + path: | + . + !.git + !.output + + UniversalWindows: + name: Windows + runs-on: windows-2022 + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + fetch-depth: 0 + + - name: Setup msys and install required packages + uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c # v2.31.1 + with: + msystem: mingw64 + install: mingw-w64-x86_64-gcc make git zip + + - name: Download SDE package + uses: petarpetrovt/setup-sde@2a27a21f27212e473f3cc59a6dac97d8dffe8970 # v3.0 + with: + environmentVariableName: SDE_DIR + sdeVersion: 9.33.0 + + - name: Build universal binary + run: | + SDE_PATH=$(cygpath "$SDE_DIR") + make -j4 -C src ARCH=x86-64-universal profile-build RUN_PREFIX="$SDE_PATH/sde.exe -future --" + + - name: Strip binary + run: strip src/stockfish.exe + + - name: Rename binary + run: mv src/stockfish.exe stockfish-windows-x86-64-universal.exe + + - name: Extract the bench number from the commit history + run: | + for hash in $(git rev-list -100 HEAD); do + benchref=$(git show -s $hash | tac | grep -m 1 -o -x '[[:space:]]*\b[Bb]ench[ :]\+[1-9][0-9]\{5,7\}\b[[:space:]]*' | sed 's/[^0-9]//g') && break || true + done + [[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found" + + - name: Check arch selection under SDE + run: ./scripts/check_universal.sh ./stockfish-windows-x86-64-universal.exe "$SDE_DIR/sde" "$benchref" + + - name: Remove non src files + run: | + rm -fR src/temp_builds + git -C src clean -fx + + - name: Upload artifact for (pre)-release + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: windows x86-64-universal + path: | + . + !.git + !.output