forked from xamarin/xamarin-macios
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1d9008
commit c3c9405
Showing
4 changed files
with
131 additions
and
77 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
ifdef ENABLE_XAMARIN | ||
NEEDED_MACCORE_VERSION := 1695dfb1dabe8fd27716978edc5aa929a8dbfbff | ||
NEEDED_MACCORE_BRANCH := distribution-certificates | ||
NEEDED_MACCORE_VERSION := bf02d63234c682d428c599e891c3f5475a80369e | ||
NEEDED_MACCORE_BRANCH := master | ||
|
||
MACCORE_DIRECTORY := maccore | ||
MACCORE_MODULE := [email protected]:xamarin/maccore.git | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,30 +83,26 @@ jobs: | |
git config -l | sort | ||
displayName: System Info | ||
# FIXME: this should figure out the exact Xcode version from PROVISION_FROM_COMMIT. | ||
- bash: | | ||
set -x | ||
set -e | ||
rm -f /Applications/Xcode.app | ||
ln -Fhs /Applications/Xcode_10.1.app /Applications/Xcode101.app | ||
ln -Fhs /Applications/Xcode_10.1.app /Applications/Xcode.app | ||
sudo xcode-select -s /Applications/Xcode.app | ||
./system-dependencies.sh --ignore-all --provision-sharpie | ||
displayName: Provision some dependencies | ||
./configure --enable-xamarin | ||
# the github auth we use only works with https, so change maccore's url to be https:// instead of git@ | ||
make reset-maccore MACCORE_MODULE=$(grep ^MACCORE_MODULE mk/xamarin.mk | sed -e 's/.*:= //' -e '[email protected]:_https://github.com/_' -e 's/[.]git//') V=1 | ||
displayName: Fetch maccore | ||
- task: xamops.azdevex.provisionator-task.provisionator@1 | ||
displayName: Provision more dependencies | ||
displayName: Provision XI/XM/Mono/Xcode/Objective-Sharpie | ||
inputs: | ||
provisioning_script: $(System.DefaultWorkingDirectory)/tools/devops/build-samples.csx | ||
|
||
- bash: | | ||
set -x | ||
set -e | ||
./configure --enable-xamarin | ||
# the github auth we use only works with https, so change maccore's url to be https:// instead of git@ | ||
make reset-maccore MACCORE_MODULE=$(grep ^MACCORE_MODULE mk/xamarin.mk | sed -e 's/.*:= //' -e '[email protected]:_https://github.com/_' -e 's/[.]git//') V=1 | ||
../maccore/tools/install-qa-provisioning-profiles.sh | ||
displayName: Provision provisioning profiles | ||
env | sort | ||
ls -lad /Applications/Xcode* | ||
xcode-select -p | ||
displayName: System Info post provisioning | ||
- bash: | | ||
set -x | ||
|
@@ -126,21 +122,47 @@ jobs: | |
publishRunAttachments: true | ||
mergeTestResults: true | ||
|
||
- bash: "echo ##vso[task.setvariable variable=JobStatus;isOutput=true]$(Agent.JobStatus)" | ||
name: ExportedVariables | ||
displayName: Export status | ||
condition: always() | ||
|
||
|
||
- job: AddGitHubComment | ||
dependsOn: macOS | ||
condition: always() | ||
pool: | ||
vmImage: 'macOS-10.13' | ||
variables: | ||
jobResultDebugiPhoneAF: $[dependencies.macOS.outputs['Debug|iPhone|A-F.ExportedVariables.JobStatus']] | ||
jobResultDebugiPhoneGR: $[dependencies.macOS.outputs['Debug|iPhone|G-R.ExportedVariables.JobStatus']] | ||
jobResultDebugiPhoneSZ: $[dependencies.macOS.outputs['Debug|iPhone|S-Z.ExportedVariables.JobStatus']] | ||
jobResultDebugiPhoneSimulator: $[dependencies.macOS.outputs['Debug|iPhoneSimulator.ExportedVariables.JobStatus']] | ||
jobResultReleaseiPhoneAF: $[dependencies.macOS.outputs['Release|iPhone|A-F.ExportedVariables.JobStatus']] | ||
jobResultReleaseiPhoneGR: $[dependencies.macOS.outputs['Release|iPhone|G-R.ExportedVariables.JobStatus']] | ||
jobResultReleaseiPhoneSZ: $[dependencies.macOS.outputs['Release|iPhone|S-Z.ExportedVariables.JobStatus']] | ||
jobResultReleaseiPhoneSimulator: $[dependencies.macOS.outputs['Release|iPhoneSimulator.ExportedVariables.JobStatus']] | ||
jobResultDebugMac: $[dependencies.macOS.outputs['Debug|Mac.ExportedVariables.JobStatus']] | ||
jobResultReleaseMac: $[dependencies.macOS.outputs['Release|Mac.ExportedVariables.JobStatus']] | ||
|
||
steps: | ||
- bash: | | ||
set -x | ||
set -e | ||
EMOJI="❌" | ||
if [[ "$AGENT_JOBSTATUS" == "Succeeded" ]]; then | ||
env | sort | ||
statuses="JOBRESULTDEBUGIPHONEAF JOBRESULTDEBUGIPHONEGR JOBRESULTDEBUGIPHONESZ JOBRESULTDEBUGIPHONESIMULATOR JOBRESULTRELEASEIPHONEAF JOBRESULTRELEASEIPHONEGR JOBRESULTRELEASEIPHONESZ JOBRESULTRELEASEIPHONESIMULATOR JOBRESULTDEBUGMAC JOBRESULTRELEASEMAC" | ||
EMOJI= | ||
for name in $statuses; do | ||
status=${!name} | ||
if ! [[ "$status" ~= Succeeded* | ||
]]; then | ||
EMOJII="❌" | ||
elif [[ "$status" == "SucceededWithIssues" && "$EMOJII" == "" ]]; then | ||
EMOJII="⚠️" | ||
fi | ||
done | ||
if [[ "$EMOJII" == "" ]]; then | ||
EMOJII="✅" | ||
elif [[ "$AGENT_JOBSTATUS" == "SucceededWithIssues" ]]; then | ||
EMOJII="⚠️" | ||
fi | ||
echo "$EMOJII Status for '$BUILD_DEFINITIONNAME': $AGENT_JOBSTATUS. [View results](${SYSTEM_COLLECTIONURI}/${SYSTEM_TEAMPROJECT}/_build/results?buildId=${BUILD_BUILDID})" > commit-comment.md | ||
./jenkins/add-commit-comment.sh "--token=$(github-pat)" "--hash=$(Build.SourceVersion)" "--file=commit-comment.md" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Net; | ||
using System.Linq; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
|
||
using Newtonsoft.Json.Linq; | ||
|
||
string DownloadWithGithubAuth (string uri) | ||
{ | ||
var downloader = new Downloader (); | ||
var path = Path.GetTempFileName (); | ||
var headers = new List<(string, string)> (); | ||
var authToken = AuthToken ("github.com"); | ||
if (!string.IsNullOrEmpty (authToken)) | ||
headers.Add (("Authorization", $"token {authToken}")); | ||
path = downloader | ||
.DownloadItemAsync ( | ||
uri, | ||
headers.ToArray (), | ||
Path.GetDirectoryName (path), | ||
Path.GetFileName (path), | ||
options: Downloader.Options.Default.WithUseCache (false)) | ||
.GetAwaiter () | ||
.GetResult (); | ||
try { | ||
return File.ReadAllText (path); | ||
} finally { | ||
File.Delete (path); | ||
} | ||
} | ||
|
||
string manifest_url = null; | ||
string GetManifestUrl (string org, string repo, string hash) | ||
{ | ||
if (manifest_url == null) { | ||
var url = $"https://api.github.com/repos/{org}/{repo}/statuses/{hash}"; | ||
var json = JToken.Parse (DownloadWithGithubAuth (url)); | ||
var value = (JValue) ((JArray) json).Where ((v) => v ["context"].ToString () == "manifest").Select ((v) => v ["target_url"]).FirstOrDefault (); | ||
manifest_url = (string) value?.Value; | ||
if (manifest_url == null) | ||
throw new Exception ($"Could not find the manifest for {hash}. Is the commit already built by CI?"); | ||
} | ||
return manifest_url; | ||
} | ||
|
||
string[] manifest = null; | ||
string[] GetManifest (string org, string repo, string hash) | ||
{ | ||
if (manifest == null) | ||
manifest = ReadAllText (GetManifestUrl (org, repo, hash)).Split ('\n'); | ||
return manifest; | ||
} | ||
|
||
// Looks for a variable either in the environment, or in current repo's Make.config. | ||
// Returns null if the variable couldn't be found. | ||
IEnumerable<string> make_config = null; | ||
string FindConfigurationVariable (string variable, string hash = "HEAD") | ||
{ | ||
var value = Environment.GetEnvironmentVariable (variable); | ||
if (!string.IsNullOrEmpty (value)) | ||
return value; | ||
|
||
if (make_config == null) | ||
make_config = Exec ("git", "show", $"{hash}:Make.config"); | ||
foreach (var line in make_config) { | ||
if (line.StartsWith (variable + "=", StringComparison.Ordinal)) | ||
return line.Substring (variable.Length + 1); | ||
} | ||
|
||
return null; | ||
} |