CI_MacOS #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI_MacOS | |
on: | |
pull_request: | |
paths: ["au4/**"] | |
branches: | |
- master | |
schedule: | |
- cron: '0 3 */1 */1 *' # At 03:00 on every day-of-month for master | |
# - cron: '0 5 */1 */1 *' # At 05:00 on every day-of-month for current release branch | |
workflow_dispatch: | |
inputs: | |
build_mode: | |
description: 'Build mode: devel_build, nightly_build, testing_build, stable_build' | |
required: true | |
default: 'devel_build' | |
sentry_project: | |
description: 'Upload symbols and dumps to Sentry (choose a project): audacity-4(default for stable build), audacity-4-sandbox' | |
required: false | |
default: '' | |
env: | |
CI_DIR: au4/buildscripts/ci | |
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer | |
jobs: | |
build_au4: | |
runs-on: macos-13 | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: "Configure workflow" | |
env: | |
pull_request_title: ${{ github.event.pull_request.title }} | |
SENTRY_SERVER_AU4_KEY: ${{ secrets.SENTRY_SERVER_AU4_KEY }} | |
SENTRY_SERVER_SANDBOX_KEY: ${{ secrets.SENTRY_SERVER_SANDBOX_KEY }} | |
SENTRY_PROJECT: ${{ github.event.inputs.sentry_project }} | |
run: | | |
ADD_INFO="_${GITHUB_REF#refs/heads/}" | |
if [ "${{ github.event_name }}" == "schedule" ] && [ "${{ github.event.schedule }}" == "0 5 */1 */1 *" ]; then ADD_INFO="_${{ env.CURRENT_RELEASE_BRANCH }}"; fi | |
if [ "${{ github.event_name }}" == "pull_request" ]; then ADD_INFO="_${{ github.event.pull_request.number }}_${pull_request_title}"; fi | |
BUILD_MODE=${{ github.event.inputs.build_mode }} | |
cmake -DEVENT=${{ github.event_name }} \ | |
-DBUILD_MODE=${BUILD_MODE} \ | |
-DARTIFACT_INFO="Mac_${ADD_INFO}" \ | |
-P ${CI_DIR}/common/ci_configure.cmake | |
DO_BUILD='true' | |
UPLOAD_ARTIFACT_NAME=$(cat ./build.artifacts/env/artifact_name.env) | |
DO_UPLOAD_SYMBOLS='false' | |
SENTRY_URL="" | |
if [ "$SENTRY_SERVER_AU4_KEY" != "" ]; then | |
if [ -z "$SENTRY_PROJECT" ] && [ "$BUILD_MODE" == "stable_build" ]; then | |
SENTRY_PROJECT="audacity-4" | |
fi | |
if [ "$SENTRY_PROJECT" == "audacity-4" ]; then | |
DO_UPLOAD_SYMBOLS='true' | |
SENTRY_URL=https://sentry.audacityteam.org/api/5/minidump/?sentry_key=$SENTRY_SERVER_AU4_KEY | |
fi | |
fi | |
if [ -z "$SENTRY_PROJECT" ] && [ "$BUILD_MODE" == "nightly_build" ]; then | |
SENTRY_PROJECT="audacity-4-sandbox" | |
fi | |
if [ "$SENTRY_PROJECT" == "audacity-4-sandbox" ] && [ "$SENTRY_SERVER_SANDBOX_KEY" != "" ]; then | |
DO_UPLOAD_SYMBOLS='true' | |
SENTRY_URL=https://sentry.audacityteam.org/api/5/minidump/?sentry_key=$SENTRY_SERVER_SANDBOX_KEY | |
fi | |
echo "DO_BUILD=$DO_BUILD" >> $GITHUB_ENV | |
echo "DO_BUILD: $DO_BUILD" | |
echo "UPLOAD_ARTIFACT_NAME=$UPLOAD_ARTIFACT_NAME" >> $GITHUB_ENV | |
echo "UPLOAD_ARTIFACT_NAME: $UPLOAD_ARTIFACT_NAME" | |
echo "DO_UPLOAD_SYMBOLS=$DO_UPLOAD_SYMBOLS" >> $GITHUB_ENV | |
echo "DO_UPLOAD_SYMBOLS: $DO_UPLOAD_SYMBOLS" | |
echo "SENTRY_PROJECT=$SENTRY_PROJECT" >> $GITHUB_ENV | |
echo "SENTRY_PROJECT: $SENTRY_PROJECT" | |
echo "SENTRY_URL=$SENTRY_URL" >> $GITHUB_ENV | |
echo "SENTRY_URL: $SENTRY_URL" | |
- name: Setup environment | |
if: env.DO_BUILD == 'true' | |
run: | | |
bash ${CI_DIR}/macos/setup.sh | |
- name: Build | |
if: env.DO_BUILD == 'true' | |
run: | | |
source $HOME/build_tools/environment.sh | |
cmake -P ${CI_DIR}/macos/ci_build.cmake | |
- name: Package | |
if: env.DO_BUILD == 'true' | |
run: | | |
source $HOME/build_tools/environment.sh | |
cmake -P ${CI_DIR}/macos/package.cmake | |
- name: Generate and upload dump symbols | |
if: env.DO_UPLOAD_SYMBOLS == 'true' | |
shell: bash | |
run: | | |
APP_BIN=$(pwd)/applebuild/audacity.app/Contents/MacOS/audacity | |
GENERATE_ARCHS=("x86_64 arm64") | |
BUILD_DIR=$(pwd)/applebuild | |
cmake -DAPP_BIN=${APP_BIN} \ | |
-DGENERATE_ARCHS="${GENERATE_ARCHS}" \ | |
-DBUILD_DIR=${BUILD_DIR} \ | |
-DSENTRY_URL=https://sentry.audacityteam.org \ | |
-DSENTRY_ORG=sentry \ | |
-DSENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} \ | |
-DSENTRY_PROJECT=${SENTRY_PROJECT} \ | |
-P ${CI_DIR}/crashdumps/ci_generate_and_upload.cmake | |
- name: Upload artifacts on GitHub | |
if: env.DO_BUILD == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.UPLOAD_ARTIFACT_NAME }} | |
path: ./build.artifacts |