diff options
author | Aaron Bockover <abock@microsoft.com> | 2019-09-04 17:07:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-04 17:07:56 +0300 |
commit | 428e1a806aa16b62c66b2c7f4e14ca25293157fd (patch) | |
tree | 76c6145772a14ece35500b97e8cdcdbf76e8282e | |
parent | 93e3c4b719d9dd2abda1117da7c8658b83543f25 (diff) | |
parent | d7fd7fd7c3384efcebc8e2e2fffe89bf16a5b312 (diff) |
Merge pull request #19 from microsoft/pr-abock-ci
Add initial CI workflow
-rw-r--r-- | .github/workflows/main.yml | 37 | ||||
-rw-r--r-- | tools/.gitignore | 1 | ||||
-rwxr-xr-x | tools/provision-macos.sh | 40 | ||||
-rwxr-xr-x | tools/select-mono.sh | 62 |
4 files changed, 140 insertions, 0 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ae9e4a0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + name: Build on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macOS-latest, windows-latest] + include: + - os: macOS-latest + msbuild: msbuild + - os: windows-latest + msbuild: '"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe"' + + steps: + - uses: actions/checkout@v1 + + - name: Dump Environment + run: | + set + + - name: Provision Machine + run: | + tools/provision-macos.sh + if: startsWith(matrix.os, 'macOS-') + + - name: Restore NuGet Packages + run: | + ${{ matrix.msbuild }} VSEditorCore.proj /noautoresponse /t:Restore /p:BuildTests=false + + - name: Build + run: | + ${{ matrix.msbuild }} VSEditorCore.proj /noautoresponse /t:Build /p:BuildTests=false diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 0000000..9685c3d --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1 @@ +_artifacts/ diff --git a/tools/provision-macos.sh b/tools/provision-macos.sh new file mode 100755 index 0000000..18dd101 --- /dev/null +++ b/tools/provision-macos.sh @@ -0,0 +1,40 @@ +#!/bin/bash -e +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +MONO_SELECT_VERSION=6.4.0 +INSTALLER_URIS=( + https://download.visualstudio.microsoft.com/download/pr/df65956a-5d32-4cc6-a05c-f4e42f6727b2/a2d824bd4d9d276e7ee4067eca4035ce/monoframework-mdk-6.4.0.165.macos10.xamarin.universal.pkg + https://download.visualstudio.microsoft.com/download/pr/300000f9-c488-42be-a244-9cb0b95769d8/3b0bb55bd8b027ebd1c3baaf43f8b800/xamarin.mac-5.16.1.9.pkg +) + +function status { + local green + local reset + if command -v tput &>/dev/null; then + green=$(tput setaf 2 2>/dev/null || exit 0) + reset=$(tput sgr0 2>/dev/null || exit 0) + fi + echo "${green}$*${reset}" +} + +pushd "$(dirname "$0")" &>/dev/null + +mkdir -p _artifacts +pushd _artifacts &>/dev/null +for installer_uri in "${INSTALLER_URIS[@]}"; do + installer_file=$(basename "${installer_uri}") + if [ ! -f "${installer_file}" ]; then + status "Downloading ${installer_file}..." + curl -LO "${installer_uri}" + fi + + status "Installing ${installer_file}..." + sudo installer -pkg "${installer_file}" -target / -verboseR +done +popd &>/dev/null + +status "Selecting Mono ${MONO_SELECT_VERSION}..." +sudo ./select-mono.sh "${MONO_SELECT_VERSION}" + +status Done.
\ No newline at end of file diff --git a/tools/select-mono.sh b/tools/select-mono.sh new file mode 100755 index 0000000..44dc07b --- /dev/null +++ b/tools/select-mono.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +set -e + +MONO_FX_DIR="/Library/Frameworks/Mono.framework/" +MONO_VERSIONS_DIR="${MONO_FX_DIR}Versions/" +MONO_CURRENT_SYMLINK="${MONO_VERSIONS_DIR}Current" +MONO_VERSIONS_AVAILABLE=($( + find "$MONO_VERSIONS_DIR" -maxdepth 1 -mindepth 1 -type d -exec basename {} \; 2>/dev/null | sort -Vr +)) +LATEST_MONO_TARGET_VERSION="${MONO_VERSIONS_AVAILABLE[0]}" +MONO_TARGET_VERSION="$1" + +if [ -z "$LATEST_MONO_TARGET_VERSION" ]; then + echo "No Mono installations found in ${MONO_VERSIONS_DIR}" + exit 1 +fi + +function showAvailableVersions() { + echo "Available Mono Versions:" + echo " latest ($LATEST_MONO_TARGET_VERSION)" + for version in "${MONO_VERSIONS_AVAILABLE[@]}"; do + echo " ${version}" + done +} + +case "$MONO_TARGET_VERSION" in +''|[/-]h|[/-]?|[/-]help|--help|help) + echo "usage: $0 INSTALLED_MONO_VERSION" + echo + showAvailableVersions + exit 2 + ;; +latest) + MONO_TARGET_VERSION="$LATEST_MONO_TARGET_VERSION" + ;; +esac + +showAvailableVersions + +MONO_TARGET_VERSION_DIR="${MONO_VERSIONS_DIR}${MONO_TARGET_VERSION}" + +if [ ! -d "$MONO_TARGET_VERSION_DIR" ]; then + echo "Mono ${MONO_TARGET_VERSION} is not installed in ${MONO_VERSIONS_DIR}" + exit 3 +fi + +echo "Selecting Mono ${MONO_TARGET_VERSION}" + +rm -f "$MONO_CURRENT_SYMLINK" +ln -s "$MONO_TARGET_VERSION_DIR" "$MONO_CURRENT_SYMLINK" +mkdir -p /etc/paths.d +echo "$MONO_CURRENT_SYMLINK/Commands" > /etc/paths.d/mono-commands + +if [ "$(readlink "$MONO_CURRENT_SYMLINK")" != "$MONO_TARGET_VERSION_DIR" ]; then + echo "Failed to update ${MONO_CURRENT_SYMLINK} to point to ${MONO_TARGET_VERSION_DIR}" + exit 4 +fi + +mono --version | head -n1
\ No newline at end of file |