mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00

This refactors the CI workflows to group some logic and makes sure that all (pre)release binaries are actually tested. The screenshot below shows the execution logic of the reworked ci, https://github.com/Disservin/Stockfish/actions/runs/7773581379. You can also hover over the cards to see the execution flow. The `matrix.json` and `arm_matrix.json` define the binaries which will be uploaded to GitHub. Afterwards a matrix is created and each job compiles a profile guided build for that arch and uploads that as an artifact to GitHub. The Binaries/ARM_Binaries workflow's are called when the previous step has been completed, and uploads all artifacts to the (pre)release. This also fixes some indentations and renames the workflows, see https://github.com/official-stockfish/Stockfish/actions, where every workflow is called `Stockfish` vs https://github.com/Disservin/Stockfish/actions. It also increases the parallel compilation used for make from `-j2 to -j4`. It now also prevents the prerelease action from running on forks. A test release can be viewed here https://github.com/Disservin/Stockfish/releases. closes https://github.com/official-stockfish/Stockfish/pull/5035 No functional change
105 lines
3.5 KiB
YAML
105 lines
3.5 KiB
YAML
name: Upload Binaries
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
matrix:
|
|
type: string
|
|
required: true
|
|
|
|
jobs:
|
|
Artifacts:
|
|
name: ${{ matrix.config.name }} ${{ matrix.binaries }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
env:
|
|
COMPILER: ${{ matrix.config.compiler }}
|
|
COMP: ${{ matrix.config.comp }}
|
|
EXT: ${{ matrix.config.ext }}
|
|
NAME: ${{ matrix.config.simple_name }}
|
|
BINARY: ${{ matrix.binaries }}
|
|
SDE: ${{ matrix.config.sde }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(inputs.matrix) }}
|
|
defaults:
|
|
run:
|
|
shell: ${{ matrix.config.shell }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download artifact from compilation
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ${{ matrix.config.simple_name }} ${{ matrix.binaries }}
|
|
path: ${{ matrix.config.simple_name }} ${{ matrix.binaries }}
|
|
|
|
- name: Setup msys and install required packages
|
|
if: runner.os == 'Windows'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: ${{ matrix.config.msys_sys }}
|
|
install: mingw-w64-${{ matrix.config.msys_env }} make git zip
|
|
|
|
- name: Create Package
|
|
run: |
|
|
mkdir stockfish
|
|
|
|
- name: Download wiki
|
|
run: |
|
|
git clone https://github.com/official-stockfish/Stockfish.wiki.git wiki
|
|
rm -rf wiki/.git
|
|
mv wiki stockfish/
|
|
|
|
- name: Copy files
|
|
run: |
|
|
mv "${{ matrix.config.simple_name }} ${{ matrix.binaries }}" stockfish-workflow
|
|
cd stockfish-workflow
|
|
cp -r src ../stockfish/
|
|
cp stockfish-$NAME-$BINARY$EXT ../stockfish/
|
|
cp "Top CPU Contributors.txt" ../stockfish/
|
|
cp Copying.txt ../stockfish/
|
|
cp AUTHORS ../stockfish/
|
|
cp CITATION.cff ../stockfish/
|
|
cp README.md ../stockfish/
|
|
cp CONTRIBUTING.md ../stockfish/
|
|
|
|
- name: Create tar
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
tar -cvf stockfish-$NAME-$BINARY.tar stockfish
|
|
|
|
- name: Create zip
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
zip -r stockfish-$NAME-$BINARY.zip stockfish
|
|
|
|
- name: Release
|
|
if: startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag'
|
|
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # @v1
|
|
with:
|
|
files: stockfish-${{ matrix.config.simple_name }}-${{ matrix.binaries }}.${{ matrix.config.archive_ext }}
|
|
|
|
- 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 that 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:
|
|
name: Stockfish dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}
|
|
tag_name: stockfish-dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}
|
|
prerelease: true
|
|
files: stockfish-${{ matrix.config.simple_name }}-${{ matrix.binaries }}.${{ matrix.config.archive_ext }}
|