From 9410b5202fcd7cfda6d5b60e09ea2f4fbeaedcdc Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Thu, 7 Nov 2024 18:24:27 +0100 Subject: [PATCH] Update CI such that it build per architecture --- .github/workflows/ci.yml | 227 ++++++++++++++++++++++----------------- 1 file changed, 127 insertions(+), 100 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cea3574c..181ac4ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,12 +21,12 @@ jobs: with: submodules: 'recursive' path: albert - + - name: Create archives run: | tar --exclude=".*" -czvf ${{ github.ref_name }}.tar.gz albert zip -r ${{ github.ref_name }}.zip albert -x "*/.*" - + - name: Release uses: softprops/action-gh-release@v1 with: @@ -36,122 +36,134 @@ jobs: ${{ github.ref_name }}.zip MacOS: + name: ${{matrix.buildname}} + runs-on: ${{matrix.os}} strategy: - fail-fast: false matrix: - os: [macos-13] # see also upload-artifact step - qt_version: [6.5.3] + include: + - os: macos-13 + buildname: macOS x86_64 + arch: 'x86_64' - runs-on: ${{ matrix.os }} + - os: macos-14 + buildname: macOS arm64 + arch: 'arm64' steps: - + - name: Checkout source code uses: actions/checkout@v3 with: submodules: recursive - + - name: Get latest CMake and ninja uses: lukka/get-cmake@latest - - - name: Install Qt dependencies - uses: jurplel/install-qt-action@v3 - with: - version: ${{ matrix.qt_version }} - cache: true - modules: 'qtscxml qt5compat qtshadertools' - - name: Create writable /opt/local - run: sudo install -d -o $UID -m 755 /opt/local + #- name: Install Qt dependencies + # uses: jurplel/install-qt-action@v3 + # with: + # version: ${{ matrix.qt_version }} + # cache: true + # modules: 'qtscxml qt5compat qtshadertools' + + #- name: Create writable /opt/local + # run: sudo install -d -o $UID -m 755 /opt/local - name: Install dependencies available at homebrew - run: brew install llvm # sparkle # fortunately homebrew ships sparkle as universal binary + env: + #HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 + run: brew install llvm qt python libqalculate # libarchive sparkle + + #- name: Restore macports dependencies + # id: cache-macports # ref'ed below + # uses: actions/cache/restore@v4 + # with: + # path: | + # /opt/local/lib + # /opt/local/include + # key: ${{ matrix.os }}-macports-r2 + + #- name: Install macports (for universal binaries of libqalculate and libarchive) + # if: steps.cache-macports.outputs.cache-hit != 'true' + # run: | + # case ${{ matrix.os }} in + # macos-11) + # wget "https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-11-BigSur.pkg" + # sudo installer -pkg ./MacPorts-2.8.1-11-BigSur.pkg -target / + # ;; + # macos-12) + # wget "https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-12-Monterey.pkg" + # sudo installer -pkg ./MacPorts-2.8.1-12-Monterey.pkg -target / + # ;; + # macos-13) + # wget "https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-13-Ventura.pkg" + # sudo installer -pkg ./MacPorts-2.8.1-13-Ventura.pkg -target / + # ;; + # esac + # sudo sh -c 'echo "\n+universal" >> /opt/local/etc/macports/variants.conf' + + #- name: Install dependencies using macports + # if: steps.cache-macports.outputs.cache-hit != 'true' + # run : sudo /opt/local/bin/port install libqalculate libarchive # increase steps.cache-macports.outputs.cache-primary-key revision on change + + #- name: Save macports dependencies + # uses: actions/cache/save@v4 + # with: + # path: | + # /opt/local/lib + # /opt/local/include + # key: ${{ steps.cache-macports.outputs.cache-primary-key }} - - uses: actions/checkout@v3 - - - name: Restore macports dependencies - id: cache-macports # ref'ed below - uses: actions/cache/restore@v4 - with: - path: | - /opt/local/lib - /opt/local/include - key: ${{ matrix.os }}-macports-r2 - - - name: Install macports (for universal binaries of libqalculate and libarchive) - if: steps.cache-macports.outputs.cache-hit != 'true' - run: | - case ${{ matrix.os }} in - macos-11) - wget "https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-11-BigSur.pkg" - sudo installer -pkg ./MacPorts-2.8.1-11-BigSur.pkg -target / - ;; - macos-12) - wget "https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-12-Monterey.pkg" - sudo installer -pkg ./MacPorts-2.8.1-12-Monterey.pkg -target / - ;; - macos-13) - wget "https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-13-Ventura.pkg" - sudo installer -pkg ./MacPorts-2.8.1-13-Ventura.pkg -target / - ;; - esac - sudo sh -c 'echo "\n+universal" >> /opt/local/etc/macports/variants.conf' - - - name: Install dependencies using macports - if: steps.cache-macports.outputs.cache-hit != 'true' - run : sudo /opt/local/bin/port install libqalculate libarchive # increase steps.cache-macports.outputs.cache-primary-key revision on change - - - name: Save macports dependencies - uses: actions/cache/save@v4 - with: - path: | - /opt/local/lib - /opt/local/include - key: ${{ steps.cache-macports.outputs.cache-primary-key }} - - name: Build and package run: | cmake -S . -B build \ - -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ \ - -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ - -DBUILD_TEMPLATE=OFF \ - -DBUILD_DEBUG=OFF \ + -DCMAKE_CXX_COMPILER=$(brew --prefix)/opt/llvm/bin/clang++ \ + -DBUILD_PLUGIN_DEBUG=OFF \ + -DBUILD_PLUGIN_DOCS=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo + #-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" cmake --build build - cd build && cpack -V - - name: Generate appcast item - env: - EDDSA_PRIVATE_KEY: ${{ secrets.EDDSA_PRIVATE_KEY }} - VERSION: ${{ github.ref_name }} - run: ./dist/macos/generate_appcast_item.sh "build/Albert-${{ github.ref_name }}.dmg" "${VERSION:1}" "$EDDSA_PRIVATE_KEY" appcast_item.txt + - name: Build and package + run: cd build && cpack -V - - uses: actions/upload-artifact@v4 - # if: matrix.os == 'macos-11' # only lowest os + #- name: Generate appcast item + # env: + # EDDSA_PRIVATE_KEY: ${{ secrets.EDDSA_PRIVATE_KEY }} + # VERSION: ${{ github.ref_name }} + # run: ./dist/macos/generate_appcast_item.sh "build/Albert-${{ github.ref_name }}.dmg" "${VERSION:1}" "$EDDSA_PRIVATE_KEY" appcast_item.txt + + - name: Append suffix + run: | + set -x + dmg=$(echo build/Albert-*.dmg) + new_dmg="${dmg::${#dmg} - 4}-${{ matrix.arch }}.dmg" + mv "${dmg}" "${new_dmg}" + mv "${dmg}.sha256" "${new_dmg}.sha256" + + - name: list files + run: find build + + - name: Upload macOS bundle + uses: actions/upload-artifact@v4 with: - name: macos-release-artifacts + name: artifacts-${{ matrix.arch }} path: | - appcast_item.txt - build/Albert-${{ github.ref_name }}.dmg - build/Albert-${{ github.ref_name }}.dmg.sha256 + build/*.dmg + build/*.sha256 + #appcast_item.txt Relase: needs: MacOS if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest - steps: - - name: Checkout website source code - uses: actions/checkout@v3 - with: - repository: albertlauncher/documentation - ref: 'master' - token: ${{ secrets.PAT }} - - - name: Get build artifacts + - name: Get all build artifacts uses: actions/download-artifact@v4 with: - name: macos-release-artifacts + merge-multiple: true - name: list files run: find . @@ -160,18 +172,33 @@ jobs: uses: softprops/action-gh-release@v1 with: files: | - build/Albert-${{ github.ref_name }}.dmg - build/Albert-${{ github.ref_name }}.dmg.sha256 - - - run: sed -i -e '/<\/language>/r appcast_item.txt' src/appcast.xml - - - name: Push appcast - run: | - git config --local user.name "GitHub Action" - git config --local user.email "action@github.com" - git add src/appcast.xml - git commit -m "Update appcast" - git push origin master + build/Albert-*.dmg + build/Albert-*.sha256 + + # Appcast: + # needs: Relase + # if: startsWith(github.ref, 'refs/tags/') + # runs-on: ubuntu-latest + # steps: + # - name: Checkout website source code + # uses: actions/checkout@v3 + # with: + # repository: albertlauncher/documentation + # ref: 'master' + # token: ${{ secrets.PAT }} + + #- name: list files + # run: find . + + #- run: sed -i -e '/<\/language>/r appcast_item.txt' src/appcast.xml + + #- name: Push appcast + # run: | + # git config --local user.name "GitHub Action" + # git config --local user.email "action@github.com" + # git add src/appcast.xml + # git commit -m "Update appcast" + # git push origin master Linux: runs-on: ubuntu-latest @@ -182,11 +209,11 @@ jobs: dockerfile: [arch.Dockerfile, fedora.Dockerfile, ubuntu.Dockerfile] steps: - + - name: Checkout source code uses: actions/checkout@v3 with: submodules: recursive - + - name: Build docker test image run: docker build . --file .docker/${{ matrix.dockerfile }}