From aee2d667f85f287cdc8965d9008c18d9b6429031 Mon Sep 17 00:00:00 2001 From: Philippe Weidmann Date: Mon, 24 Feb 2025 15:20:09 +0100 Subject: [PATCH] ci: Xcode release Signed-off-by: Philippe Weidmann --- .mise.toml | 1 + TestFlight/WhatToTest.en-GB.txt | 0 TestFlight/WhatToTest.fr-FR.txt | 0 ci_scripts/check_preconditions.sh | 42 +++++++++++++++++++++++++++++++ ci_scripts/ci_post_clone.sh | 15 +++++++++++ ci_scripts/ci_post_xcodebuild.sh | 21 ++++++++++++++++ 6 files changed, 79 insertions(+) create mode 100644 TestFlight/WhatToTest.en-GB.txt create mode 100644 TestFlight/WhatToTest.fr-FR.txt create mode 100755 ci_scripts/check_preconditions.sh create mode 100755 ci_scripts/ci_post_clone.sh create mode 100755 ci_scripts/ci_post_xcodebuild.sh diff --git a/.mise.toml b/.mise.toml index 670fa8f30..fc010799b 100644 --- a/.mise.toml +++ b/.mise.toml @@ -3,4 +3,5 @@ tuist = '4.41.0' periphery = '2.21.1' swiftformat = '0.54.5' swiftlint = '0.57.0' +sentry-cli = "latest" diff --git a/TestFlight/WhatToTest.en-GB.txt b/TestFlight/WhatToTest.en-GB.txt new file mode 100644 index 000000000..e69de29bb diff --git a/TestFlight/WhatToTest.fr-FR.txt b/TestFlight/WhatToTest.fr-FR.txt new file mode 100644 index 000000000..e69de29bb diff --git a/ci_scripts/check_preconditions.sh b/ci_scripts/check_preconditions.sh new file mode 100755 index 000000000..6627e9901 --- /dev/null +++ b/ci_scripts/check_preconditions.sh @@ -0,0 +1,42 @@ +#!/bin/sh +set -e + +# CI_COMMIT - The Git commit hash that Xcode Cloud uses for the current build. +# SENTRY_URL - The URL of our self hosted Sentry. +# SENTRY_AUTH_TOKEN - The authentication token for Sentry. +# SENTRY_PROJECT - The project id in our Sentry. + +# Ensure we have a commit hash +if [ -z "$CI_COMMIT" ]; then + echo "Error: CI_COMMIT variable is not set." + exit 1 +fi + +# Ensure SENTRY_URL is set +if [ -z "$SENTRY_URL" ]; then + echo "Error: SENTRY_URL variable is not set." + exit 1 +fi + +# Ensure SENTRY_AUTH_TOKEN is set +if [ -z "$SENTRY_AUTH_TOKEN" ]; then + echo "Error: SENTRY_AUTH_TOKEN variable is not set." + exit 1 +fi + +# Ensure SENTRY_PROJECT is set +if [ -z "$SENTRY_PROJECT" ]; then + echo "Error: SENTRY_PROJECT variable is not set." + exit 1 +fi + +# Retrieve the commit title from the given commit hash +commit_title="$(git log --format=%s -n 1 "$CI_COMMIT")" + +# Check if the commit title begins with the expected string +if [[ "$commit_title" == chore:\ Release\ build* ]]; then + echo "Commit title is valid. Continuing..." +else + echo "Error: The commit title is not 'chore: Release build'." + exit 1 +fi diff --git a/ci_scripts/ci_post_clone.sh b/ci_scripts/ci_post_clone.sh new file mode 100755 index 000000000..108e22fe3 --- /dev/null +++ b/ci_scripts/ci_post_clone.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +./check_preconditions.sh + +cd .. + +curl https://mise.run | sh +export PATH="$HOME/.local/bin:$PATH" + +mise install +eval "$(mise activate bash --shims)" + +tuist install +tuist generate --no-open diff --git a/ci_scripts/ci_post_xcodebuild.sh b/ci_scripts/ci_post_xcodebuild.sh new file mode 100755 index 000000000..bb8ce8566 --- /dev/null +++ b/ci_scripts/ci_post_xcodebuild.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + + ./check_preconditions.sh + +cd .. + +curl https://mise.run | sh +export PATH="$HOME/.local/bin:$PATH" + +mise install +eval "$(mise activate bash --shims)" + + +if [[ -n $CI_ARCHIVE_PATH ]]; +then + # Upload dSYMs + sentry-cli --url $SENTRY_URL --auth-token $SENTRY_AUTH_TOKEN upload-dif --org sentry --project $SENTRY_PROJECT $CI_ARCHIVE_PATH +else + echo "Archive path isn't available. Unable to run dSYMs uploading script." +fi