Skip to content

Commit

Permalink
(ci) Single macOS package build on GH
Browse files Browse the repository at this point in the history
  • Loading branch information
csparker247 committed Aug 9, 2024
1 parent c4af38d commit bb70a12
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 108 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/build_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ on:
workflow_dispatch:
workflow_call:
outputs:
package_mac_intel:
description: "The file name of the macOS Intel package"
value: ${{ jobs.build_macos_intel.outputs.package_name }}
package_mac:
description: "The file name of the macOS package"
value: ${{ jobs.build_macos.outputs.package_name }}

jobs:
build_macos_intel:
name: Create macOS package (Intel)
build_macos:
name: Create macOS package
runs-on: macos-12
outputs:
package_name: ${{ steps.name_pkg.outputs.package_name }}
timeout-minutes: 240
env:
MACOSX_DEPLOYMENT_TARGET: "12.7"
QT_VERSION: "6.7.2"
EXTRA_CMAKE_FLAGS: "-DCMAKE_BUILD_TYPE=Release -DVC_PREBUILT_LIBS=ON -DVC_BUILD_ACVD=ON"
EXTRA_CMAKE_FLAGS: "-DCMAKE_BUILD_TYPE=Release -DVC_PREBUILT_LIBS=ON -DVC_BUILD_ACVD=ON -DCMAKE_OSX_ARCHITECTURES:STRING='x86_64;arm64'"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Install vc-deps
run: |
git submodule update --init
cmake -S vc-deps/ -B vc-deps/build/ -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_MESSAGE=NEVER -DVCDEPS_BUILD_ACVD=OFF
cmake -S vc-deps/ -B vc-deps/build/ -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_MESSAGE=NEVER -DVCDEPS_BUILD_ACVD=OFF -DBUILD_MACOS_MULTIARCH=ON
cmake --build vc-deps/build/
- name: Build volume-cartographer
Expand All @@ -61,11 +61,10 @@ jobs:
- name: Generate package name
id: name_pkg
run: |
ARCH=$(uname -m)
if [[ ${{ github.ref }} =~ ^refs/tags/v* ]]; then
PKG_NAME="VC-${GITHUB_REF_NAME:1}-Darwin-${ARCH}.zip"
PKG_NAME="VC-${GITHUB_REF_NAME:1}-Darwin.zip"
else
PKG_NAME="VC-${GITHUB_REF_NAME}-Darwin-${ARCH}.zip"
PKG_NAME="VC-${GITHUB_REF_NAME}-Darwin.zip"
fi
echo "package_name=${PKG_NAME}" >> ${GITHUB_ENV}
echo "package_name=${PKG_NAME}" >> ${GITHUB_OUTPUT}
Expand All @@ -80,5 +79,5 @@ jobs:
uses: actions/upload-artifact@v4
if: success()
with:
name: package-macos-intel
name: package-macos
path: ${{ env.package_name }}
8 changes: 4 additions & 4 deletions .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

macos:
name: Create macOS package (Intel)
name: Create macOS package
needs: create_release
uses: ./.github/workflows/build_packages.yml

Expand All @@ -26,14 +26,14 @@ jobs:
runs-on: ubuntu-latest
needs: macos
steps:
- name: Download macOS (Intel) package
- name: Download macOS package
uses: actions/download-artifact@v4
with:
name: package-macos-intel
name: package-macos

- name: Upload packages
if: startsWith(github.ref, 'refs/tags/v')
run: |
gh release upload ${{ github.ref_name }} "${{ needs.macos.outputs.package_mac_intel }}" -R ${{ github.repository }} --clobber
gh release upload ${{ github.ref_name }} "${{ needs.macos.outputs.package_mac }}" -R ${{ github.repository }} --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
186 changes: 93 additions & 93 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,97 +161,97 @@ pages:
- if: '$CI_COMMIT_BRANCH == "develop" && $CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_COMMIT_BRANCH == "develop" && $BUILD_NIGHTLY == "true"'

.collect:package:macos:
extends: .build
variables:
CMAKE_PREFIX_PATH: "/usr/local/Qt/6.7.2/macos/lib/cmake/"
CMAKE_INSTALL_PREFIX: "packaged_install/"
EXTRA_CMAKE_FLAGS: "-DCMAKE_BUILD_TYPE=Release -DVC_PREBUILT_LIBS=ON -DVC_BUILD_ACVD=ON"
MACOSX_DEPLOYMENT_TARGET: "12.7"
before_script:
- git submodule update --init
- cmake -S vc-deps/ -B vc-deps/build/ -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_MESSAGE=NEVER -DVCDEPS_BUILD_ACVD=OFF
- cmake --build vc-deps/build/
script:
- cmake -S . -B build/ -GNinja ${EXTRA_CMAKE_FLAGS}
- cmake --build build/
- cmake --install build/ --prefix ${CMAKE_INSTALL_PREFIX}
- python3 utils/scripts/macos_codesign_release.py -i ${CMAKE_INSTALL_PREFIX}
- *deploy_variables
- PKG_NAME="VC-${VERSHORT}-${ARCH}.zip"
- ditto -c -k ${CMAKE_INSTALL_PREFIX} ${PKG_NAME}
- echo "PACKAGE_NAME=${PKG_NAME}" >> collect.env
artifacts:
name: "${CI_BUILD_STAGE}_${CI_BUILD_REF_NAME}"
paths:
- ./*.zip
reports:
dotenv: collect.env
expire_in: 1 day
tags:
- macos
- deploy

collect:binaries:macos:release:
extends:
- .collect:package:macos
stage: collect
rules:
*rules_release
script:
- cmake -S . -B build/ -GNinja ${EXTRA_CMAKE_FLAGS}
- cmake --build build/
- cmake --install build/ --prefix ${CMAKE_INSTALL_PREFIX}
- python3 utils/scripts/macos_codesign_release.py -i ${CMAKE_INSTALL_PREFIX}
- *deploy_variables
- PKG_NAME="VC-${CI_COMMIT_TAG:1}-Darwin-${ARCH}.zip"
- ditto -c -k ${CMAKE_INSTALL_PREFIX} ${PKG_NAME}
- echo "PACKAGE_NAME=${PKG_NAME}" >> collect.env
#.collect:package:macos:
# extends: .build
# variables:
# CMAKE_PREFIX_PATH: "/usr/local/Qt/6.7.2/macos/lib/cmake/"
# CMAKE_INSTALL_PREFIX: "packaged_install/"
# EXTRA_CMAKE_FLAGS: "-DCMAKE_BUILD_TYPE=Release -DVC_PREBUILT_LIBS=ON -DVC_BUILD_ACVD=ON"
# MACOSX_DEPLOYMENT_TARGET: "12.7"
# before_script:
# - git submodule update --init
# - cmake -S vc-deps/ -B vc-deps/build/ -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_MESSAGE=NEVER -DVCDEPS_BUILD_ACVD=OFF
# - cmake --build vc-deps/build/
# script:
# - cmake -S . -B build/ -GNinja ${EXTRA_CMAKE_FLAGS}
# - cmake --build build/
# - cmake --install build/ --prefix ${CMAKE_INSTALL_PREFIX}
# - python3 utils/scripts/macos_codesign_release.py -i ${CMAKE_INSTALL_PREFIX}
# - *deploy_variables
# - PKG_NAME="VC-${VERSHORT}-${ARCH}.zip"
# - ditto -c -k ${CMAKE_INSTALL_PREFIX} ${PKG_NAME}
# - echo "PACKAGE_NAME=${PKG_NAME}" >> collect.env
# artifacts:
# name: "${CI_BUILD_STAGE}_${CI_BUILD_REF_NAME}"
# paths:
# - ./*.zip
# reports:
# dotenv: collect.env
# expire_in: 1 day
# tags:
# - macos
# - deploy
#
#collect:binaries:macos:release:
# extends:
# - .collect:package:macos
# stage: collect
# rules:
# *rules_release
# script:
# - cmake -S . -B build/ -GNinja ${EXTRA_CMAKE_FLAGS}
# - cmake --build build/
# - cmake --install build/ --prefix ${CMAKE_INSTALL_PREFIX}
# - python3 utils/scripts/macos_codesign_release.py -i ${CMAKE_INSTALL_PREFIX}
# - *deploy_variables
# - PKG_NAME="VC-${CI_COMMIT_TAG:1}-Darwin-${ARCH}.zip"
# - ditto -c -k ${CMAKE_INSTALL_PREFIX} ${PKG_NAME}
# - echo "PACKAGE_NAME=${PKG_NAME}" >> collect.env
#
#collect:binaries:macos:nightly:
# extends:
# - .collect:package:macos
# stage: collect
# rules:
# *rules_nightly_collect
# variables:
# EXTRA_CMAKE_FLAGS: "-DCMAKE_BUILD_TYPE=Release -DVC_VERSION_DATESTAMP=ON -DVC_PREBUILT_LIBS=ON -DVC_BUILD_ACVD=ON"
#
#release:create:gitlab:
# stage: release
# image: registry.gitlab.com/gitlab-org/release-cli:edge
# needs: ["collect:binaries:macos:release"]
# rules:
# *rules_release
# script:
# - >
# release-cli create
# --name "$CI_COMMIT_TAG"
# --description "Auto-created release $CI_COMMIT_TAG"
# --tag-name "$CI_COMMIT_TAG"
# --ref "$CI_COMMIT_TAG"
# tags:
# - docker

collect:binaries:macos:nightly:
extends:
- .collect:package:macos
stage: collect
rules:
*rules_nightly_collect
variables:
EXTRA_CMAKE_FLAGS: "-DCMAKE_BUILD_TYPE=Release -DVC_VERSION_DATESTAMP=ON -DVC_PREBUILT_LIBS=ON -DVC_BUILD_ACVD=ON"

release:create:gitlab:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:edge
needs: ["collect:binaries:macos:release"]
rules:
*rules_release
script:
- >
release-cli create
--name "$CI_COMMIT_TAG"
--description "Auto-created release $CI_COMMIT_TAG"
--tag-name "$CI_COMMIT_TAG"
--ref "$CI_COMMIT_TAG"
tags:
- docker

release:upload:github:
stage: release
image: debian:bullseye
needs: ["collect:binaries:macos:release"]
rules:
*rules_release
before_script:
- type -p curl >/dev/null || (apt update && apt install curl -y)
- curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
- chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
- apt update
- apt install gh -y
script:
- >
gh release upload
"$CI_COMMIT_TAG"
"${PACKAGE_NAME}"
-R educelab/volume-cartographer
--clobber
tags:
- docker
#release:upload:github:
# stage: release
# image: debian:bullseye
# needs: ["collect:binaries:macos:release"]
# rules:
# *rules_release
# before_script:
# - type -p curl >/dev/null || (apt update && apt install curl -y)
# - curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
# - chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
# - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
# - apt update
# - apt install gh -y
# script:
# - >
# gh release upload
# "$CI_COMMIT_TAG"
# "${PACKAGE_NAME}"
# -R educelab/volume-cartographer
# --clobber
# tags:
# - docker

0 comments on commit bb70a12

Please sign in to comment.