Skip to content

Commit ce13123

Browse files
PowerSchilldaviwil
authored andcommitted
Enable Travis CI with Ubuntu and MacOS builds
- Set to Trusty Tahr (Ubuntu 14.04) - Set to xcode 8.3 (OS X 10.12) - Downloads and installs PowerShell v6.0.0-beta.1
1 parent a27705e commit ce13123

File tree

4 files changed

+196
-1
lines changed

4 files changed

+196
-1
lines changed

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
language: cpp
2+
3+
git:
4+
depth: 1000
5+
6+
os:
7+
- linux
8+
- osx
9+
sudo: required
10+
dist: trusty
11+
osx_image: xcode8.3
12+
13+
before_install:
14+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
15+
brew update;
16+
brew install openssl;
17+
mkdir -p /usr/local/lib;
18+
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/;
19+
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/;
20+
fi
21+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
22+
nvm install v6.0.0;
23+
fi
24+
install:
25+
- git clone https://github.com/PowerShell/PowerShellEditorServices.git ../PowerShellEditorServices
26+
- pushd build
27+
- ./download.sh
28+
- popd
29+
30+
script:
31+
- ulimit -n 4096
32+
- powershell -File build/travis.ps1

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# PowerShell Language Support for Visual Studio Code
22

3-
[![Version](https://vsmarketplacebadge.apphb.com/version/ms-vscode.PowerShell.svg)](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/ms-vscode.PowerShell.svg)](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell) [![Build status](https://ci.appveyor.com/api/projects/status/x2g1u375ih4w1xcc/branch/develop?svg=true)](https://ci.appveyor.com/project/PowerShell/vscode-powershell/branch/develop) [![Join the chat at https://gitter.im/PowerShell/vscode-powershell](https://badges.gitter.im/PowerShell/vscode-powershell.svg)](https://gitter.im/PowerShell/vscode-powershell?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3+
[![Version](https://vsmarketplacebadge.apphb.com/version/ms-vscode.PowerShell.svg)](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/ms-vscode.PowerShell.svg)](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell) [![Join the chat at https://gitter.im/PowerShell/vscode-powershell](https://badges.gitter.im/PowerShell/vscode-powershell.svg)](https://gitter.im/PowerShell/vscode-powershell?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4+
5+
| AppVeyor (Windows) | Travis CI (Linux / macOS) |
6+
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
7+
| [![Build status](https://ci.appveyor.com/api/projects/status/x2g1u375ih4w1xcc/branch/develop?svg=true)](https://ci.appveyor.com/project/PowerShell/vscode-powershell/branch/develop) | [![Build Status](https://travis-ci.org/PowerShell/vscode-powershell.svg?branch=master)](https://travis-ci.org/PowerShell/vscode-powershell) |
48

59
This extension provides rich PowerShell language support for [Visual Studio Code](https://github.com/Microsoft/vscode).
610
Now you can write and debug PowerShell scripts using the excellent IDE-like interface

build/download.sh

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
#!/usr/bin/env bash
2+
3+
# Let's quit on interrupt of subcommands
4+
trap '
5+
trap - INT # restore default INT handler
6+
echo "Interrupted"
7+
kill -s INT "$$"
8+
' INT
9+
10+
get_url() {
11+
fork=$2
12+
release=v6.0.0-beta.1
13+
echo "https://github.com/$fork/PowerShell/releases/download/$release/$1"
14+
}
15+
16+
fork="PowerShell"
17+
# Get OS specific asset ID and package name
18+
case "$OSTYPE" in
19+
linux*)
20+
source /etc/os-release
21+
# Install curl and wget to download package
22+
case "$ID" in
23+
centos*)
24+
if ! hash curl 2>/dev/null; then
25+
echo "curl not found, installing..."
26+
sudo yum install -y curl
27+
fi
28+
29+
package=powershell-6.0.0_beta.1-1.el7.centos.x86_64.rpm
30+
;;
31+
ubuntu)
32+
if ! hash curl 2>/dev/null; then
33+
echo "curl not found, installing..."
34+
sudo apt-get install -y curl
35+
fi
36+
37+
case "$VERSION_ID" in
38+
14.04)
39+
package=powershell_6.0.0-beta.1-1ubuntu1.14.04.1_amd64.deb
40+
;;
41+
16.04)
42+
package=powershell_6.0.0-beta.1-1ubuntu1.16.04.1_amd64.deb
43+
;;
44+
*)
45+
echo "Ubuntu $VERSION_ID is not supported!" >&2
46+
exit 2
47+
esac
48+
;;
49+
opensuse)
50+
if ! hash curl 2>/dev/null; then
51+
echo "curl not found, installing..."
52+
sudo zypper install -y curl
53+
fi
54+
55+
56+
case "$VERSION_ID" in
57+
42.1)
58+
# TODO during next release remove fork and fix package name
59+
fork=TravisEz13
60+
package=powershell-6.0.0_beta.1-1.suse.42.1.x86_64.rpm
61+
;;
62+
*)
63+
echo "OpenSUSE $VERSION_ID is not supported!" >&2
64+
exit 2
65+
esac
66+
;;
67+
*)
68+
echo "$NAME is not supported!" >&2
69+
exit 2
70+
esac
71+
;;
72+
darwin*)
73+
# We don't check for curl as macOS should have a system version
74+
package=powershell-6.0.0-beta.1-osx.10.12-x64.pkg
75+
;;
76+
*)
77+
echo "$OSTYPE is not supported!" >&2
78+
exit 2
79+
;;
80+
esac
81+
82+
curl -L -o "$package" $(get_url "$package" "$fork")
83+
84+
if [[ ! -r "$package" ]]; then
85+
echo "ERROR: $package failed to download! Aborting..." >&2
86+
exit 1
87+
fi
88+
89+
# Installs PowerShell package
90+
case "$OSTYPE" in
91+
linux*)
92+
source /etc/os-release
93+
# Install dependencies
94+
echo "Installing PowerShell with sudo..."
95+
case "$ID" in
96+
centos)
97+
# yum automatically resolves dependencies for local packages
98+
sudo yum install "./$package"
99+
;;
100+
ubuntu)
101+
# dpkg does not automatically resolve dependencies, but spouts ugly errors
102+
sudo dpkg -i "./$package" &> /dev/null
103+
# Resolve dependencies
104+
sudo apt-get install -f
105+
;;
106+
opensuse)
107+
# Install the Microsoft public key so that zypper trusts the package
108+
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
109+
# zypper automatically resolves dependencies for local packages
110+
sudo zypper --non-interactive install "./$package" &> /dev/null
111+
;;
112+
*)
113+
esac
114+
;;
115+
darwin*)
116+
patched=0
117+
if hash brew 2>/dev/null; then
118+
brew update
119+
if [[ ! -d $(brew --prefix openssl) ]]; then
120+
echo "Installing OpenSSL with brew..."
121+
if ! brew install openssl; then
122+
echo "ERROR: OpenSSL failed to install! Crypto functions will not work..." >&2
123+
# Don't abort because it is not fatal
124+
elif ! brew install curl --with-openssl; then
125+
echo "ERROR: curl failed to build against OpenSSL; SSL functions will not work..." >&2
126+
# Still not fatal
127+
else
128+
# OpenSSL installation succeeded; reme mber to patch System.Net.Http after PowerShell installation
129+
patched=1
130+
fi
131+
fi
132+
133+
else
134+
echo "ERROR: brew not found! OpenSSL may not be available..." >&2
135+
# Don't abort because it is not fatal
136+
fi
137+
138+
echo "Installing $package with sudo ..."
139+
sudo installer -pkg "./$package" -target /
140+
if [[ $patched -eq 1 ]]; then
141+
echo "Patching System.Net.Http for libcurl and OpenSSL..."
142+
find /usr/local/microsoft/powershell -name System.Net.Http.Native.dylib | xargs sudo install_name_tool -change /usr/lib/libcurl.4.dylib /usr/local/opt/curl/lib/libcurl.4.dylib
143+
fi
144+
;;
145+
esac
146+
147+
powershell -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME"'
148+
success=$?
149+
150+
if [[ "$success" != 0 ]]; then
151+
echo "ERROR: PowerShell failed to install!" >&2
152+
exit "$success"
153+
fi

build/travis.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Install InvokeBuild
2+
Install-Module InvokeBuild -Scope CurrentUser -Force
3+
4+
# Build the code and perform tests
5+
Import-module InvokeBuild
6+
Invoke-Build

0 commit comments

Comments
 (0)