From 4adc097d90c7241d134921913a2aba51529ac5c2 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 15 Dec 2023 09:39:13 +0100 Subject: [PATCH] Refactoring GH runner script Signed-off-by: Martin --- .github/workflows/build_check.yml | 144 +++++++++++++++++++----------- 1 file changed, 90 insertions(+), 54 deletions(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index ab6cf023..ec5acfcc 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -10,32 +10,35 @@ env: BUILD_TYPE: Release -jobs: - build_check: - strategy: - # do not stop on 1st fail - fail-fast: false - matrix: - # GitHub runner macos build is broken: https://github.com/actions/runner-images/issues/577 - # Could not symlink bin/2to3-3.11 Target /usr/local/bin/2to3-3.11 already exists. - # Could not symlink bin/2to3 Target /usr/local/bin/2to3 already exists. - # hack fix: https://github.com/actions/setup-python/issues/577#issuecomment-1365231822 - os: [ubuntu-22.04, macos-11, windows-2022] - - runs-on: ${{ matrix.os }} +#jobs: +# build_check: +# strategy: +# # do not stop on 1st fail +# fail-fast: false +# matrix: +# # GitHub runner macos build is broken: https://github.com/actions/runner-images/issues/577 +# # Could not symlink bin/2to3-3.11 Target /usr/local/bin/2to3-3.11 already exists. +# # Could not symlink bin/2to3 Target /usr/local/bin/2to3 already exists. +# # hack fix: https://github.com/actions/setup-python/issues/577#issuecomment-1365231822 +# os: [ubuntu-22.04, macos-11, windows-2022] +# +# runs-on: ${{ matrix.os }} +# +# +# steps: +jobs: + # --- Linux (Ubuntu) steps --- + linux-x86_64: + runs-on: ubuntu-latest steps: - # --- Clone the latest commit --- - - name: Checkout uses: actions/checkout@v3 - # --- Config git and get the version from "git describe" --- - - name: Config Git id: config_git shell: bash @@ -47,11 +50,7 @@ jobs: echo "git_describe=$(git describe)" echo "git_describe=$(git describe)" >> $GITHUB_OUTPUT - - # --- Linux (Ubuntu) steps --- - - name: Install Ubuntu Build Requirements - if: startsWith(matrix.os, 'ubuntu') run: | mkdir build sudo apt update @@ -59,12 +58,10 @@ jobs: sudo apt install g++ make cmake fakeroot rpm qttools5-dev libfftw3-dev binutils-dev \ libusb-1.0-0-dev libqt5opengl5-dev mesa-common-dev libgl1-mesa-dev libgles2-mesa-dev - - name: Ubuntu Build # GitHub hosts Linux runners on Standard_DS2_v2 virtual machines in Microsoft Azure: # 2-core CPU, 7 GB of RAM memory, 14 GB of SSD disk space working-directory: ${{github.workspace}}/build - if: startsWith(matrix.os, 'ubuntu') run: | cp ../CHANGELOG changelog cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE @@ -72,20 +69,36 @@ jobs: fakeroot make -j8 package ls -l packages - - name: Upload Ubuntu Artifacts # *.deb *.rpm *.tgz - if: startsWith(matrix.os, 'ubuntu') uses: actions/upload-artifact@v3 with: name: openhantek_${{ steps.config_git.outputs.git_describe }}_linux_amd64 path: ${{github.workspace}}/build/packages/* - # --- macOS steps --- + # --- macOS steps --- + macos: + runs-on: macos-11 + steps: + + # --- Clone the latest commit --- + - name: Checkout + uses: actions/checkout@v3 + + # --- Config git and get the version from "git describe" --- + - name: Config Git + id: config_git + shell: bash + run: | + git config user.email "Ho-Ro@users.noreply.github.com" + git config user.name "Ho-Ro" + git fetch --prune --unshallow --tags || true + git submodule update --init --recursive + echo "git_describe=$(git describe)" + echo "git_describe=$(git describe)" >> $GITHUB_OUTPUT - name: Install macOS Build Requirements - if: startsWith(matrix.os, 'macos') run: | mkdir build brew update @@ -95,12 +108,10 @@ jobs: ln -sf /usr/local/opt/gcc/lib/gcc/11/libgcc_s.1.1.dylib \ /usr/local/opt/qt5/lib/libgcc_s.1.1.dylib.framework/libgcc_s.1.1.dylib - - name: macOS Build # GitHub hosts macOS runners in GitHub's own macOS Cloud: # 3-core CPU, 14 GB of RAM memory, 14 GB of SSD disk space working-directory: ${{github.workspace}}/build - if: startsWith(matrix.os, 'macos') run: | cp ../CHANGELOG changelog cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$(brew --prefix qt5) @@ -131,19 +142,35 @@ jobs: true fi - - name: Upload macOS Artifacts - if: startsWith(matrix.os, 'macos') uses: actions/upload-artifact@v3 with: name: openhantek_${{ steps.config_git.outputs.git_describe }}_osx_x86_64 path: ${{github.workspace}}/build/packages/* - # --- Windows MinGW_w64 steps --- +# --- Windows MinGW_w64 steps --- + windows_mingw: + runs-on: windows-2022 + steps: + + # --- Clone the latest commit --- + - name: Checkout + uses: actions/checkout@v3 + + # --- Config git and get the version from "git describe" --- + - name: Config Git + id: config_git + shell: bash + run: | + git config user.email "Ho-Ro@users.noreply.github.com" + git config user.name "Ho-Ro" + git fetch --prune --unshallow --tags || true + git submodule update --init --recursive + echo "git_describe=$(git describe)" + echo "git_describe=$(git describe)" >> $GITHUB_OUTPUT - name: Install MSYS2 Packages - if: startsWith(matrix.os, 'windows') uses: msys2/setup-msys2@v2 with: update: true @@ -155,7 +182,6 @@ jobs: mingw-w64-x86_64-libusb - name: Start Windows MinGW_w64 Build - if: startsWith(matrix.os, 'windows') shell: msys2 {0} run: | cmake -D CMAKE_PREFIX_PATH=/mingw64/qt5-static -D CMAKE_BUILD_TYPE=$BUILD_TYPE -B build @@ -165,7 +191,6 @@ jobs: # GitHub hosts Windows runners on Standard_DS2_v2 virtual machines in Microsoft Azure: # 2-core CPU, 7 GB of RAM memory, 14 GB of SSD disk space working-directory: ${{github.workspace}}/build - if: startsWith(matrix.os, 'windows') shell: bash run: | # this ZIP package contains only OpenHantek.exe, just get the name @@ -176,33 +201,46 @@ jobs: ls -l ../packages - name: Upload Windows MinGW_w64 Artifacts - if: startsWith(matrix.os, 'windows') uses: actions/upload-artifact@v3 with: name: openhantek_${{ steps.config_git.outputs.git_describe }}_win_mingw_w64 path: ./build/packages/*.zip - # --- Windows MSVC steps --- +# --- Windows MSVC steps --- + windows_msvc: + runs-on: windows-2022 + steps: + + # --- Clone the latest commit --- + - name: Checkout + uses: actions/checkout@v3 + + # --- Config git and get the version from "git describe" --- + - name: Config Git + id: config_git + shell: bash + run: | + git config user.email "Ho-Ro@users.noreply.github.com" + git config user.name "Ho-Ro" + git fetch --prune --unshallow --tags || true + git submodule update --init --recursive + echo "git_describe=$(git describe)" + echo "git_describe=$(git describe)" >> $GITHUB_OUTPUT - name: Install Qt for Windows - if: startsWith(matrix.os, 'windows') uses: jurplel/install-qt-action@v3 - - name: Setup Windows MSVC Build - if: startsWith(matrix.os, 'windows') run: md build & call "%VCINSTALLDIR%/Auxiliary/Build/vcvars64.bat" & cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_PREFIX_PATH=%Qt5_DIR% -DCMAKE_BUILD_TYPE=Release -Bbuild - - name: Windows MSVC Build # GitHub hosts Windows runners on Standard_DS2_v2 virtual machines in Microsoft Azure: # 2-core CPU, 7 GB of RAM memory, 14 GB of SSD disk space working-directory: ${{github.workspace}}/build - if: startsWith(matrix.os, 'windows') shell: bash run: | cmake --build . --parallel 8 --config Release --target package @@ -213,23 +251,21 @@ jobs: cd ../.. ls -l packages - - name: Upload Windows MSVC Artifacts - if: startsWith(matrix.os, 'windows') uses: actions/upload-artifact@v3 with: - name: openhantek_${{ steps.config_git.outputs.git_describe }}_win_x64 + name: openhantek_${{ steps.config_git.outputs.git_describe }}_msvc_x64 path: ./build/packages/*.zip - # --- Tagged Commit -> Upload Release --- +# --- Tagged Commit -> Upload Release --- - - name: Upload Linux / macOS / Windows Release Assets - if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 - with: - prerelease: true - files: ./build/packages/* - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Upload Linux / macOS / Windows Release Assets + # if: startsWith(github.ref, 'refs/tags/') + # uses: softprops/action-gh-release@v1 + # with: + # prerelease: true + # files: ./build/packages/* + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}