Skip to content

Commit

Permalink
Improve workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jan 2, 2025
1 parent aa27eab commit aed62fe
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 9 deletions.
34 changes: 34 additions & 0 deletions .github/actions/get-workflow-artifact-ids/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Get Workflow Artifact IDs'
description: 'Generates consistent artifact IDs and names based on workflow trigger'

outputs:
filename:
description: 'Filename to use for artifacts (e.g. pr123)'
value: ${{ steps.generate-ids.outputs.filename }}
display-name:
description: 'Human readable name (e.g. PR123)'
value: ${{ steps.generate-ids.outputs.display_name }}

runs:
using: "composite"
steps:
- id: generate-ids
shell: bash
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
ID="pr${{ github.event.pull_request.number }}"
DISPLAY_ID="PR${{ github.event.pull_request.number }}"
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
ID="$TAG"
DISPLAY_ID="$TAG"
else
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
BRANCH_NAME=${GITHUB_REF#refs/heads/}
ID="$BRANCH_NAME-$SHORT_SHA"
DISPLAY_ID="$BRANCH_NAME build $SHORT_SHA"
fi
# Set outputs
echo "filename=$ID" >> $GITHUB_OUTPUT
echo "display_name=$DISPLAY_ID" >> $GITHUB_OUTPUT
50 changes: 41 additions & 9 deletions .github/workflows/build-macos-qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: 🍎 Build - MacOS Qt6
on:
push:
branches:
- main
- master
- release-*
pull_request:
release:
Expand All @@ -16,6 +16,9 @@ concurrency:

jobs:
build:
outputs:
artifact-x64-url: ${{ steps.artifact-x64-qt6.outputs.artifact-url }}
artifact-arm64-url: ${{ steps.artifact-arm64-qt6.outputs.artifact-url }}
strategy:
matrix:
include:
Expand Down Expand Up @@ -43,6 +46,10 @@ jobs:
id: setup-vcpkg
uses: ./.github/actions/setup-vcpkg

- name: 🎲 Get artifact ids
id: workflow-artifact-ids
uses: ./.github/actions/get-workflow-artifact-ids

- name: 🔨 Prepare build env
run: |
brew install automake bison flex gnu-sed create-dmg autoconf-archive nasm libtool fdupes
Expand Down Expand Up @@ -81,11 +88,11 @@ jobs:
cmake -S . \
-G Ninja \
-B build \
-D QGIS_APP_NAME="QGIS-${{steps.workflow-artifact-ids.outputs.display-name}}" \
-D WITH_VCPKG=ON \
-D BUILD_WITH_QT6=ON \
-D WITH_QTWEBKIT=OFF \
-D WITH_BINDINGS=ON \
-D QGIS_MACAPP_FRAMEWORK=OFF \
-D VCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" \
-D VCPKG_HOST_TRIPLET="${{ matrix.triplet }}" \
-D VCPKG_INSTALL_OPTIONS="--only-binarycaching" \
Expand Down Expand Up @@ -115,7 +122,7 @@ jobs:
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: kadas-albireo2-sdk-${{ matrix.triplet }}
name: qgis-sdk-${{ matrix.triplet }}
path: |
sdk/vcpkg-export-*.zip
Expand All @@ -127,12 +134,37 @@ jobs:
cmake --build build --target bundle
- name: 📤 Upload dmg
# if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
uses: actions/upload-artifact@v4
id: artifact-${{ matrix.triplet }}-qt6
with:
name: qgis-dmg-${{ matrix.triplet }}
name: qgis-dmg-${{steps.workflow-artifact-ids.outputs.display-name}}-${{ matrix.triplet }}
path: |
build/QGIS-Installer.dmg
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# if: always()
build/*.dmg
- name: Upload release assets
uses: AButler/[email protected]
if: ${{ github.event_name == 'release' }}
with:
files: build/*.dmg
repo-token: ${{ secrets.GITHUB_TOKEN }}

schedule_download_comment:
name: Comment pull request
runs-on: ubuntu-24.04
needs: build
steps:
- name: 🐣 Checkout
uses: actions/checkout@v4

- name: Schedule download comment
uses: ./.github/actions/post_sticky_comment
if: github.event_name == 'pull_request'
with:
marker: macos-qt6
body: |
### 🍎 MacOS Qt6 builds
Download testable builds for this pull request
- Download [MacOS Qt6 arm64 (M series)](${{ needs.build.outputs.artifact-arm64-url }})
- Download [MacOS Qt6 x64 (Intel)](${{ needs.build.outputs.artifact-arm64-url }})
*(Built from commit ${{ github.event.pull_request.head.sha }})*
pr: ${{ github.event.number }}

0 comments on commit aed62fe

Please sign in to comment.