Skip to content

Commit

Permalink
chore: Build on AppVeyor and Travis CI
Browse files Browse the repository at this point in the history
* chore: setup AppVeyor and Travis CI
* chore: update NuGet to 4.5.1
* chore: ignore release scripts
  • Loading branch information
mexx authored Feb 11, 2018
1 parent 04de865 commit 17ba602
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
*.user
*.ncrunch*
*.cache
release.cmd
release.sh
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: csharp

sudo: false # use the new container-based Travis infrastructure

before_install:
- chmod +x build.sh

script:
- ./build.sh Default
Binary file modified Source/.nuget/NuGet.exe
Binary file not shown.
12 changes: 9 additions & 3 deletions Source/.nuget/NuGet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
<NuGetExePath>$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
<PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>

<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) "$(NuGetExePath)"</NuGetCommand>

<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
<PackageSources>""</PackageSources>

Expand All @@ -18,8 +24,8 @@
<BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>

<!-- Commands -->
<RestoreCommand>"$(NuGetExePath)" install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
<BuildCommand>"$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
Expand Down
2 changes: 1 addition & 1 deletion Source/FeatureSwitcher.Specs/FeatureSwitcher.Specs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Import Project="$(SolutionDir).nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
2 changes: 1 addition & 1 deletion Source/FeatureSwitcher/FeatureSwitcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<None Include="Package.nuspec" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Import Project="$(SolutionDir).nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
7 changes: 7 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
init:
- git config --global core.autocrlf input
build_script:
- cmd: build.cmd Default
test: off
artifacts:
- path: Release
18 changes: 1 addition & 17 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
@echo off
cls

SET TARGET="Default"

IF NOT [%1]==[] (set TARGET="%~1")

SET FAKE_VERSION=2.2.0

:Build
cls

echo Installing FAKE %FAKE_VERSION%
"Source\.nuget\NuGet.exe" "install" "FAKE" "-OutputDirectory" "Source\packages" "-ExcludeVersion" "-Version" "%FAKE_VERSION%"

"Source\packages\FAKE\tools\Fake.exe" "build.fsx" "target=%TARGET%"

rem Bail if we're running a TeamCity build.
if defined TEAMCITY_PROJECT_NAME goto Quit

rem Loop the build script.
set CHOICE=nothing
echo (Q)uit, (Enter) runs the build again
set /P CHOICE=
if /i "%CHOICE%"=="Q" goto :Quit

GOTO Build

:Quit
exit /b %errorlevel%
7 changes: 4 additions & 3 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#I @"Source\packages\Fake\tools"
#I @"Source/packages/FAKE/tools"
#r "FakeLib.dll"

open Fake
Expand Down Expand Up @@ -82,8 +82,9 @@ Target "BuildNuGet" (fun _ ->
Description = ""
Version = packageVersion()
Dependencies = []
OutputPath = nugetDir
WorkingDir = nugetDir
ToolPath = sourceDir @@ ".nuget" @@ "NuGet.exe" |> FullName
OutputPath = nugetDir |> FullName
WorkingDir = nugetDir |> FullName
AccessKey = NugetKey
Publish = NugetKey <> "" })
(sourceDir @@ projectName @@ "Package.nuspec")
Expand Down
39 changes: 39 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

set -eu

cd "$(dirname "$0")"

TARGET="Default"
if [ "$1" != "" ]
then
TARGET="$1"
fi

NUGET_EXE=Source/.nuget/NuGet.exe
FAKE_VERSION=2.2.0
FAKE_EXE=Source/packages/FAKE/tools/FAKE.exe

FSIARGS=""
FSIARGS2=""
OS=${OS:-"unknown"}
if [ "$OS" != "Windows_NT" ]
then
# Can't use FSIARGS="--fsiargs -d:MONO" in zsh, so split it up
# (Can't use arrays since dash can't handle them)
FSIARGS="--fsiargs"
FSIARGS2="-d:MONO"
fi

run() {
echo $@
if [ "$OS" != "Windows_NT" ]
then
mono "$@"
else
"$@"
fi
}

run $NUGET_EXE install FAKE -OutputDirectory Source/packages -ExcludeVersion -Version $FAKE_VERSION -Verbosity detailed
run $FAKE_EXE "target=$TARGET" $FSIARGS $FSIARGS2 build.fsx

0 comments on commit 17ba602

Please sign in to comment.