Merge pull request #843 from PowerShell/andschwa/travis-osx

Setup OS X on Travis CI
This commit is contained in:
Andy Schwartzmeyer committed 2016-04-13 19:31:05 -07:00
commit 7fa31c444c
10 files changed
+182 -103

No files matched your search

+9 -5
View File
@@ -1,16 +1,20 @@
language: cpp
sudo: required
dist: trusty
matrix:
include:
- os: linux
dist: trusty
sudo: required
# - os: osx
# language: generic
# env: PATH+=/usr/local/share/dotnet
git:
submodules: false
before_install:
- git config --global url.git@github.com:.insteadOf https://github.com/
- git submodule update --init -- src/windows-build src/Modules/Pester src/libpsl-native/test/googletest
- ./bootstrap.sh
- ./download.sh
- sudo dpkg -i ./powershell.deb
script:
- powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBuild; Start-PSPester"
- powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBootstrap; Start-PSBuild; Start-PSPester"
notifications:
slack:
secure: sKYd4n61+ZFzGZuWGUl8V1kN0NM16wRVOFVlNhlFCwnkrEsKROb++EvXf5uwnKuzxkhEjvPWO+UFgeshQDoR93y4s5YLfhC5JupK4nUzjPzWs208KTrh8u/x9MY8X6Ojxi85EEAiku5GzMoMlkucSStZUYwbIfnelzqdw8uoRwmm2MW4XCPwsuEuDUVghyiva0Mdx1G6MopCrK8T96WywJXT3chhfZQgVt+sQCBt9g+2kjDaObKrzG0P07IVK43ZpDgnu6AoxlyBzIx9mJH2Oa/tki3/kTO72Wcp3ps3qvmiStADamzVKR9p1VlWCLWAd6VOehxuByCGEyujpzk135Wud2DZYO+8LD6inZVhFe3Wt5pCU9BDXZppiATfMCqgXEH7nK54pEn79yHcjthRJ2+Z9ot7As2fu3RSBmTAi8nRP0fxRyX/jctR3S6P0qt0y1ynx9nzBfhmhPQW0PMVazWS/nruQIvK/3iiYXjZxM5bBwIvabmwV00EYeTdbL6ufXWNgQcG1ZWkDsi2I3vst/ytUbHwaFYg83bXWpxg9DCzJeWLVUvE5/3NfBxRAuCTot/fgTEA9IYScvrlL7Q/bT0cOt0vEM98MPf1UO+WP85uxhsRgHtwDEo+jMaL6ZFkPhlV6mmmED4NdY2//a571cLNXdnuMAze5O3TWGBG53g=
+63 -1
View File
@@ -23,6 +23,7 @@ try {
function Start-PSBuild {
[CmdletBinding(DefaultParameterSetName='CoreCLR')]
param(
[switch]$NoPath,
[switch]$Restore,
[Parameter(ParameterSetName='CoreCLR')]
@@ -57,6 +58,15 @@ function Start-PSBuild {
$FullCLR = $true
}
if (-not $NoPath) {
Write-Verbose "Appending probable .NET CLI tool path"
if ($IsWindows) {
$env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli"
} elseif ($IsOSX) {
$env:PATH += ":/usr/local/share/dotnet"
}
}
# verify we have all tools in place to do the build
$precheck = precheck 'dotnet' "Build dependency 'dotnet' not found in PATH! See: https://dotnet.github.io/getting-started/"
if ($FullCLR) {
@@ -65,7 +75,8 @@ function Start-PSBuild {
# msbuild is needed to build powershell.exe
# msbuild is part of .NET Framework, we can try to get it from well-known location.
if (-not (Get-Command -Name msbuild -ErrorAction Ignore)) {
if (-nopt $NoPath -and -not (Get-Command -Name msbuild -ErrorAction Ignore)) {
Write-Verbose "Appending probable Visual C++ tools path"
$env:path += ";${env:SystemRoot}\Microsoft.Net\Framework\v4.0.30319"
}
@@ -261,6 +272,57 @@ function Start-PSxUnit {
}
}
function Start-PSBootstrap {
[CmdletBinding()]param()
Write-Host "Installing Open PowerShell build dependencies"
if ($IsLinux) {
precheck 'curl' "Bootstrap dependency 'curl' not found in PATH, please install!" > $null
precheck 'apt-get' "Bootstrap dependency 'apt-get' not found in PATH, this only supports Ubuntu 14.04!" > $null
# Setup LLVM feed
curl -s http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt-get update -qq
# Install ours and .NET's dependencies
sudo apt-get install -y make g++ cmake libc6 libgcc1 libstdc++6 libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5
# Install .NET CLI packages
Remove-Item dotnet*.deb
wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-host-ubuntu-x64.latest.deb
sudo dpkg -i dotnet-host-ubuntu-x64.latest.deb
wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sharedframework-ubuntu-x64.latest.deb
sudo dpkg -i dotnet-sharedframework-ubuntu-x64.latest.deb
wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sdk-ubuntu-x64.latest.deb
sudo dpkg -i dotnet-sdk-ubuntu-x64.latest.deb
} elseif ($IsOSX) {
precheck 'brew' "Bootstrap dependency 'brew' not found, must install Homebrew! See http://brew.sh/"
# Install ours and .NET's dependencies
brew install cmake wget openssl
# Install .NET CLI packages
Remove-Item dotnet*.pkg
wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-osx-x64.latest.pkg
sudo installer -pkg dotnet-dev-osx-x64.latest.pkg -target /
} elseif ($IsWindows -And -Not $IsCore) {
Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1
./install.ps1
} else {
Write-Warning "Start-PSBootstrap cannot be run in Core PowerShell on Windows (need Invoke-WebRequest!)"
}
}
function Start-PSPackage {
[CmdletBinding()]param(
# PowerShell packages use Semantic Versioning http://semver.org/
+1 -4
View File
@@ -18,13 +18,10 @@ install:
- ps: Set-Content c:\users\appveyor\.ssh\id_rsa $fileContent
- git config --global url.git@github.com:.insteadOf https://github.com/
- git submodule update --init -- src/windows-build src/Modules/Pester
- ps: Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1
- ps: ./install.ps1 -version 1.0.0-beta-002198
- ps: Import-Module .\PowerShellGitHubDev.psm1; Start-PSBootstrap
build_script:
- ps: |
$env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli"
dotnet --version
Import-Module .\PowerShellGitHubDev.psm1
Start-PSBuild -Publish
Start-PSBuild -FullCLR
-20
View File
@@ -1,20 +0,0 @@
#!/usr/bin/env bash
echo "Installing build dependencies"
curl http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt-get update -qq
sudo apt-get install -y wget make g++ cmake \
libc6 libgcc1 libstdc++6 \
libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5
wget -P /tmp https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-host-ubuntu-x64.latest.deb
sudo dpkg -i /tmp/dotnet-host-ubuntu-x64.latest.deb
wget -P /tmp https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sharedframework-ubuntu-x64.latest.deb
sudo dpkg -i /tmp/dotnet-sharedframework-ubuntu-x64.latest.deb
wget -P /tmp https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sdk-ubuntu-x64.latest.deb
sudo dpkg -i /tmp/dotnet-sdk-ubuntu-x64.latest.deb
+46 -31
View File
@@ -10,6 +10,16 @@ Environment
These instructions are written assuming the Ubuntu 14.04 LTS, since
that's the distro the team uses.
Git Setup
---------
Using Git requires it to be setup correctly; refer to the
[README](../../README.md) and
[Contributing Guidelines](../../CONTRIBUTING.md).
This guide assumes that you have recursively cloned the PowerShell
repository and `cd`ed into it.
Toolchain Setup
---------------
@@ -26,16 +36,46 @@ Unfortunately, the `apt-get` feed for `dotnet` has been deprecated,
and the latest version is only distributed in the form of three
separate packages, which require manual dependency resolution.
**To ease this process, just run `./bootstrap.sh` and enter password
for `sudo` when prompted.**
Installing the toolchain is as easy as running `Start-PSBootstrap` in
PowerShell. Of course, this requires a self-hosted copy of PowerShell
on Linux.
The [bootstrap script](../../bootstrap.sh) does the following:
Fortunately, this is as easy as downloading and installing the
package. Unfortunately, while the repository is still private, the
package cannot be downloaded as simply as with `wget`. We have a
script that wraps the GitHub API and uses a personal access token to
authorize in order to obtain the package.
The `./download.sh` script will also install the PowerShell package.
> You can alternativelly download via a browser, upload it to your
> box via some other method, and manually install it.
In Bash:
```sh
GITHUB_TOKEN=<replace with your token> ./download.sh
powershell
```
You should now be in a `powershell` console host that is installed
separately from any development copy you're about to build. Just
import our module, bootsrap the dependencies, and build!
In PowerShell:
```powershell
Import-Module ./PowerShellGitHubDev.psm1
Start-PSBootstrap
```
The `Start-PSBootstrap` function does the following:
- Adds the LLVM package feed
- Installs our dependencies combined with the dependencies of the .NET
CLI toolchain via `apt-get`
- Installs the .NET CLI host, shared framework, and SDK by downloading
the three `.deb` packages to `/tmp` and using `dpkg -i`
the three `.deb` packages and using `dpkg -i`
[dotnet-cli]: https://github.com/dotnet/cli#new-to-net-cli
[CMake]: https://cmake.org/cmake/help/v2.8.12/cmake.html
@@ -55,36 +95,13 @@ uninstall prior any prior versions.
[cli-docs]: https://dotnet.github.io/getting-started/
Git Setup
---------
Using Git requires it to be setup correctly; refer to the
[README](../../README.md) and
[Contributing Guidelines](../../CONTRIBUTING.md).
Build using our module
======================
We maintain a [PowerShell module](../../PowerShellGitHubDev.psm1) with
the function `Start-PSBuild` to build PowerShell. Since this is
PowerShell code, it requires self-hosting. Fortunately, this is as
easy as downloading and installing the package. Unfortunately, while
the repository is still private, the package cannot be downloaded as
simply as with `wget`. We have a script that wraps the GitHub API and
uses a personal access token to authorize and obtain the package.
> You can alternativelly download via a browser and upload it to your
> box via some other method.
```sh
GITHUB_TOKEN=<replace with your token> ./download.sh
sudo dpkg -i ./powershell.deb
powershell
```
You should now be in a `powershell` console host that is installed
separately from any development copy you're about to build. Just
import our module and build!
PowerShell code, it requires self-hosting. If you have followed the
toolchain setup section above, you should have `powershell` installed.
> If you cannot or do not want to self-host, `Start-PSBuild` is just a
> convenience; you can execute each step of the build process yourself
@@ -99,8 +116,6 @@ Congratulations! If everything went right, PowerShell is now built.
The `Start-PSBuild` script will output the location of the executable:
`./src/Microsoft.PowerShell.CoreConsoleHost/bin/Linux/netstandardapp1.5/ubuntu.14.04-x64/powershell`.
> Note that the `./build.sh` script is deprecated and will be removed
You can run our cross-platform Pester tests with `Start-PSPester`, and
our xUnit tests with `Start-PSxUnit`.
+10 -13
View File
@@ -11,22 +11,19 @@ Environment
===========
You will want [Homebrew](http://brew.sh/), the missing package manager
for OS X. Once installed, use `brew` to install the following
dependencies.
for OS X. Once installed, follow the same instructions to download and
install a self-hosted copy of PowerShell on your OS X machine, and use
`Start-PSBootstrap` to install the dependencies.
```sh
brew install openssl cmake wget
```
The `Start-PSBootstrap` function does the following:
Instead of using Linux `./bootstrap.sh` to install .NET CLI's Ubuntu
packages, you will want to use the official PKG installer for OS X.
- Uses `brew` to install CMake, OpenSSL, and GNU WGet
- Downloads and installs the latest .NET CLI package
- Adds `/usr/local/share/dotnet` to the process path
```sh
wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-osx-x64.latest.pkg
open ./dotnet-dev-osx-x64.latest.pkg
```
Then follow the wizard's instructions to complete installation.
Please heed that last step. You may want to add the .NET CLI tool
location to your path more permanently by adding it to your shell's
profile.
Build using our module
======================
+20 -11
View File
@@ -11,17 +11,33 @@ Environment
These instructions are tested on Windows 10 and Windows Server 2012
R2, though they should work anywhere the dependencies work.
Git Setup
---------
Using Git requires it to be setup correctly; refer to the
[README](../../README.md) and
[Contributing Guidelines](../../CONTRIBUTING.md).
This guide assumes that you have recursively cloned the PowerShell
repository and `cd`ed into it.
.NET CLI
--------
We use the [.NET Command Line Interface][dotnet-cli] (`dotnet`) to
build PowerShell. The following script will install `dotnet` and add
it to your PowerShell session's path:
build PowerShell. The `Start-PSBootstrap` function will automatically
install it and add it to your path:
```powershell
Import-Module ./PowerShellGitHubDev.psm1
Start-PSBootstrap
```
The `Start-PSBootstrap` function itself does exactly this:
```powershell
Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1
./install.ps1 -version 1.0.0-beta-002198
$env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli"
./install.ps1
```
If you have any problems installing `dotnet`, please see their
@@ -43,13 +59,6 @@ CLI can cause odd failures when running. Please check your version.
[redist-2012]: https://www.microsoft.com/en-us/download/confirmation.aspx?id=30679
[redist-2015]: https://www.microsoft.com/en-us/download/details.aspx?id=48145
Git Setup
---------
Using Git requires it to be setup correctly; refer to the
[README](../../README.md) and
[Contributing Guidelines](../../CONTRIBUTING.md).
Build using our module
======================
+33 -3
View File
@@ -2,13 +2,43 @@
[[ -n $GITHUB_TOKEN ]] || { echo >&2 "GITHUB_TOKEN variable is undefined, please provide token"; exit 1; }
# Set OS specific asset ID and package name
case "$OSTYPE" in
linux*)
asset='1536045'
package='powershell_0.3.0-1_amd64.deb'
# Install curl and wget to download package
sudo apt-get install -y curl wget
;;
darwin*)
asset='1536063'
package='powershell-0.3.0.pkg'
;;
*)
exit 2 >&2 "$OSTYPE not supported!"
;;
esac
# Authorizes with read-only access to GitHub API
# Retrieves URL of v0.3.0 release asset
# Downloads asset to powershell.deb
curl -s -i \
-H "Authorization: token $GITHUB_TOKEN " \
-H 'Accept: application/octet-stream' \
'https://api.github.com/repos/PowerShell/PowerShell/releases/assets/1536045' |
"https://api.github.com/repos/PowerShell/PowerShell/releases/assets/$asset" |
grep location |
sed 's/location: //g' |
wget -i - -O powershell.deb
wget -i - -O $package
# Installs PowerShell package
case "$OSTYPE" in
linux*)
# Install dependencies
sudo apt-get install -y libunwind8 libicu52
sudo dpkg -i ./$package
;;
darwin*)
sudo installer -pkg ./$package -target /
;;
esac
echo "Congratulations! PowerShell is now installed."
-13
View File
@@ -1,13 +0,0 @@
#!/usr/bin/env bash
# Build OMI
pushd src/omi/Unix
./configure --dev
make -j
popd
# Build the OMI Provider
pushd src/omi-provider
cmake -DCMAKE_BUILD_TYPE=Debug .
make -j
popd
-2
View File
@@ -1,2 +0,0 @@
export CORE_ROOT=$(pwd)/bin
sudo -E ./src/omi/Unix/output/bin/omiserver -l --loglevel 2