Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/travis #27

Merged
merged 5 commits into from
Mar 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
sudo: required
dist: trusty
language: php
php:
- '7.0'

install:
- ./build/install_dependencies_ubuntu14.sh
- dotnet restore ./src/Peachpie.NETCore.Web
- dotnet build -f netstandard1.6 ./src/Peachpie.NETCore.Web
- dotnet restore ./src/Peachpie.Compiler.Tools
- dotnet restore ./src/Peachpie.NET.Sdk
- dotnet build -f netcoreapp1.0 ./src/Peachpie.Compiler.Tools
- dotnet restore ./Samples/ConsoleApplication1
- dotnet run -p ./Samples/ConsoleApplication1/ConsoleApplication1.msbuildproj

script:
- ./src/Tools/runtests_shell/runtests.sh
16 changes: 0 additions & 16 deletions .travis.yml.off

This file was deleted.

4 changes: 2 additions & 2 deletions build/install_dependencies_ubuntu14.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

# Add the dotnet apt-get feed (for .NET Core)
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893

# Update apt-get cache
sudo apt-get update

# Install .NET Core SDK
sudo apt-get install dotnet-dev-1.0.0-preview2-003131 -y
sudo apt-get install dotnet-dev-1.0.1 -y


# Install Powershell (https://www.rootusers.com/how-to-install-powershell-on-linux)
Expand Down
12 changes: 11 additions & 1 deletion build/update_packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ $packagesSource = (Resolve-Path "~/.nuget/packages").Path

# Create the Nuget packages and delete those currently installed
foreach ($project in $projects) {
dotnet pack --no-build -c $configuration --version-suffix $suffix "$rootDir/src/$project"
$appendedArgs = New-Object System.Collections.Generic.List[System.String]

# Do not pack full .NET 4.6 assemblies if they weren't produced
$projectDir = "$rootDir/src/$project"
if (!(Test-Path $projectDir/bin/$configuration/net46/*)) {
$packFramework = if ($project -eq "Peachpie.Compiler.Tools") { "netcoreapp1.0" } else { "netstandard1.6" }
$appendedArgs.Add("/p:TargetFrameworks=")
$appendedArgs.Add("/p:TargetFramework=$packFramework")
}

dotnet pack --no-build -c $configuration --version-suffix $suffix $projectDir $appendedArgs

$installedFolder = "$packagesSource/$project/$version-$suffix"
if (Test-Path $installedFolder) {
Expand Down
24 changes: 24 additions & 0 deletions src/Tools/runtests_shell/Test.msbuildproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<Description>Simpliest PHP project for .NET Core, a console app.</Description>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(TestFile)" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Peachpie.Compiler.Tools" Version="0.6.0-dev" />
<PackageReference Include="Peachpie.NET.Sdk" Version="0.6.0-dev" PrivateAssets="Build" />
</ItemGroup>

<!-- As a temporary solution, import C# Visual Studio design time targets in order to be able to load the project in Visual Studio -->
<PropertyGroup>
<CSharpDesignTimeTargetsPath Condition="'$(CSharpDesignTimeTargetsPath)'==''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.CSharp.DesignTime.targets</CSharpDesignTimeTargetsPath>
</PropertyGroup>
<Import Project="$(CSharpDesignTimeTargetsPath)" Condition="'$(CSharpDesignTimeTargetsPath)' != '' and Exists('$(CSharpDesignTimeTargetsPath)')" />

</Project>
8 changes: 0 additions & 8 deletions src/Tools/runtests_shell/bin/output.runtimeconfig.json

This file was deleted.

12 changes: 0 additions & 12 deletions src/Tools/runtests_shell/common.rsp

This file was deleted.

110 changes: 0 additions & 110 deletions src/Tools/runtests_shell/references.rsp.tpl

This file was deleted.

23 changes: 7 additions & 16 deletions src/Tools/runtests_shell/runtests.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
# Prepare the files needed to compile and run the tests

TOOL_DIR="./src/Tools/runtests_shell"
OUTPUT_DIR="$TOOL_DIR/bin"

# Peachpie.App
cp src/Peachpie.Runtime/bin/Debug/netstandard1.6/Peachpie.Runtime.dll $OUTPUT_DIR
cp src/Peachpie.Library/bin/Debug/netstandard1.6/Peachpie.Library.dll $OUTPUT_DIR
cp src/Peachpie.Library.MySql/bin/Debug/netstandard1.6/Peachpie.Library.MySql.dll $OUTPUT_DIR

# The location of the referenced libraries may differ and the compiler works properly only with absolute addresses
NUGET_DIR="$(readlink -f ~/.nuget/packages)"
awk "{print \"--reference:$NUGET_DIR/\" \$0}" $TOOL_DIR/references.rsp.tpl > $TOOL_DIR/references.rsp

COMPILE_PHP_DLL="./src/Peachpie.Compiler.Tools/bin/Debug/netcoreapp1.0/dotnet-compile-php.dll"
COMPILE_PHP="dotnet $COMPILE_PHP_DLL --temp-output:$OUTPUT_DIR --out:$OUTPUT_DIR/output.exe @$TOOL_DIR/common.rsp @$TOOL_DIR/references.rsp"
OUTPUT_DIR="$TOOL_DIR/bin/Debug/netcoreapp1.0"

PHP_TMP_FILE=$OUTPUT_DIR/php.out
PEACH_TMP_FILE=$OUTPUT_DIR/peach.out
Expand All @@ -23,18 +11,21 @@ COLOR_RED="\033[1;31m"
COLOR_RESET="\033[0m"
HR="----------------------------------------------------------------------------------------------------------------------------------------------------------------"

# Restore the testing project to gather all dependencies
dotnet restore $TOOL_DIR

# Compile and run every PHP file in ./tests and check the output against the one from the PHP interpreter
for PHP_FILE in $(find ./tests -name *.php)
for PHP_FILE in $(find $PWD/tests -name *.php)
do
echo -n "Testing $PHP_FILE..."
COMPILE_OUTPUT="$($COMPILE_PHP $PHP_FILE 2>&1)"
COMPILE_OUTPUT="$(dotnet build $TOOL_DIR /p:TestFile=$PHP_FILE)"
if [ $PIPESTATUS != 0 ] ; then
echo -e $COLOR_RED"Compilation error"$COLOR_RESET
echo "$COMPILE_OUTPUT"
FAILURE="FAILURE"
else
PHP_OUTPUT="$(php $PHP_FILE)"
PEACH_OUTPUT="$(dotnet $OUTPUT_DIR/output.exe)"
PEACH_OUTPUT="$(dotnet $OUTPUT_DIR/Test.dll)"

if [ "$PHP_OUTPUT" = "$PEACH_OUTPUT" ] ; then
echo -e $COLOR_GREEN"OK"$COLOR_RESET
Expand Down