]> git.sesse.net Git - stockfish/blobdiff - .github/workflows/stockfish_arm_binaries.yml
Update GitHub workflows
[stockfish] / .github / workflows / stockfish_arm_binaries.yml
index 9a4734eeec64e3760431c4f8b82d78747cf836c4..203c00f2ce26d581aa29f7d5c60faf86b529f090 100644 (file)
@@ -20,18 +20,21 @@ jobs:
             compiler: aarch64-linux-android21-clang++
             emu: qemu-aarch64
             comp: ndk
-            shell: bash {0}
+            shell: bash
           - name: Android NDK arm
             os: ubuntu-22.04
             compiler: armv7a-linux-androideabi21-clang++
             emu: qemu-arm
             comp: ndk
-            shell: bash {0}
+            shell: bash
         binaries:
+          - armv8-dotprod
           - armv8
           - armv7
           - armv7-neon
         exclude:
+          - binaries: armv8-dotprod
+            config: {compiler: armv7a-linux-androideabi21-clang++}
           - binaries: armv8
             config: {compiler: armv7a-linux-androideabi21-clang++}
           - binaries: armv7
@@ -43,7 +46,7 @@ jobs:
         working-directory: src
         shell: ${{ matrix.config.shell }}
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
         with:
           fetch-depth: 0
 
@@ -67,6 +70,13 @@ jobs:
             echo "ANDROID_NDK_BIN=$ANDROID_NDK_BIN" >> $GITHUB_ENV
           fi
 
+      - 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: Download the used network from the fishtest framework
         run: make net
 
@@ -94,6 +104,7 @@ jobs:
           make clean
           make -j2 profile-build ARCH=$BINARY COMP=$COMP WINE_PATH=$EMU
           make strip ARCH=$BINARY COMP=$COMP
+          WINE_PATH=$EMU ../tests/signature.sh $benchref
           mv ./stockfish$EXT ../stockfish-android-$BINARY$EXT
 
       - name: Remove non src files
@@ -117,6 +128,7 @@ jobs:
           cp AUTHORS stockfish/
           cp CITATION.cff stockfish/
           cp README.md stockfish/
+          cp CONTRIBUTING.md stockfish/
           tar -cvf stockfish-android-$BINARY.tar stockfish
 
       - name: Upload binaries
@@ -127,6 +139,32 @@ jobs:
 
       - name: Release
         if: startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag'
-        uses: softprops/action-gh-release@v1
+        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844  # @v1
+        with:
+          files: stockfish-android-${{ matrix.binaries }}.tar
+
+      - name: Get last commit sha
+        id: last_commit
+        run: echo "COMMIT_SHA=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
+
+      - name: Get commit date
+        id: commit_date
+        run: echo "COMMIT_DATE=$(git show -s --date=format:'%Y%m%d' --format=%cd HEAD)" >> $GITHUB_ENV
+
+      # Make sure that an old ci which still runs on master doesn't recreate a prerelease
+      - name: Check Pullable Commits
+        id: check_commits
+        run: |
+          git fetch
+          CHANGES=$(git rev-list HEAD..origin/master --count)
+          echo "CHANGES=$CHANGES" >> $GITHUB_ENV
+
+      - name: Prerelease
+        if: github.ref_name == 'master' && env.CHANGES == '0'
+        continue-on-error: true
+        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844  # @v1
         with:
-          files: stockfish-android-${{ matrix.binaries }}.tar
\ No newline at end of file
+          name: Stockfish dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}
+          tag_name: stockfish-dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}
+          prerelease: true
+          files: stockfish-android-${{ matrix.binaries }}.tar