Skip to content

Commit f0cc2f5

Browse files
Enable CI support for .NET Core
1 parent 10c9164 commit f0cc2f5

324 files changed

Lines changed: 3447 additions & 1543 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
11
language: csharp
2-
2+
sudo: required
3+
dist: trusty
4+
addons:
5+
apt:
6+
sources: ['ubuntu-toolchain-r-test']
7+
packages:
8+
- gettext
9+
- libcurl4-openssl-dev
10+
- libicu-dev
11+
- libssl-dev
12+
- libunwind8
13+
- zlib1g
14+
- libstdc++6
15+
env:
16+
global:
17+
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
18+
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
19+
mono:
20+
- 4.0.5
321
os:
422
- linux
5-
- osx
23+
24+
before_install:
25+
- curl https://download.microsoft.com/download/B/4/6/B4678511-01F4-4F97-902B-0E58A985932A/dotnet-dev-debian-x64.1.0.0-rc4-004771.tar.gz -o /tmp/dotnet.tar.gz
26+
- sudo mkdir -p /opt/dotnet
27+
- sudo tar zxf /tmp/dotnet.tar.gz -C /opt/dotnet
28+
- sudo ln -s /opt/dotnet/dotnet /usr/local/bin
629

730
script:
831
- ./bin/fetch-configlet
932
- ./bin/configlet .
10-
- ./build.sh
33+
- ./build.sh

appveyor.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
init:
2+
- ps: (New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/5/F/E/5FEB7E95-C643-48D5-8329-9D2C63676CE8/dotnet-dev-win-x64.1.0.0-rc4-004771.exe', "c:/dotnet-install.exe")
3+
- cmd: c:\dotnet-install.exe /install /quiet
14
build_script:
25
- ps: .\build.cmd
3-
6+
environment:
7+
DOTNET_CLI_TELEMETRY_OPTOUT: true
8+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
49
test: off

build.fsx

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@ open Fake.DotNetCli
55

66
let buildDir = "./build/"
77
let sourceDir = "./exercises/"
8-
let projects = !! (buildDir @@ "*/*.csproj")
9-
let tests = !! (buildDir @@ "**/*Test.cs")
108

11-
let restore project = DotNetCli.Restore (fun p ->
12-
{ p with NoCache = true
13-
Project = project })
9+
let testFiles = !! (buildDir @@ "*/*Test.cs")
10+
let allProjects = !! (buildDir @@ "*/*.csproj")
11+
let defaultProjects =
12+
!! (buildDir @@ "*/*.csproj") --
13+
(buildDir @@ "*/DotDsl.csproj") --
14+
(buildDir @@ "*/React.csproj")
15+
let refactoringProjects =
16+
!! (buildDir @@ "*/TreeBuilding.csproj") ++
17+
(buildDir @@ "*/Ledger.csproj") ++
18+
(buildDir @@ "*/Markdown.csproj")
1419

15-
let build project = DotNetCli.Build (fun p ->
16-
{ p with Project = project })
17-
18-
let test project = DotNetCli.Test (fun p ->
19-
{ p with Project = project })
20+
let restore project = DotNetCli.Restore (fun p -> { p with Project = project })
21+
let build project = DotNetCli.Build (fun p -> { p with Project = project })
22+
let test project = DotNetCli.Test (fun p -> { p with Project = project })
2023

2124
let restoreAndBuild project =
2225
restore project
@@ -27,22 +30,52 @@ let restoreAndTest project =
2730
test project
2831

2932
Target "Clean" (fun _ ->
30-
CleanDirs [buildDir]
33+
DeleteDir buildDir
3134
)
3235

33-
Target "Copy" (fun _ ->
36+
Target "CopyExercises" (fun _ ->
3437
CopyDir buildDir sourceDir allFiles
3538
)
3639

37-
Target "Test" (fun _ ->
38-
let ignorePattern = "Skip\s*=\s*\"Remove to run test\""
39-
RegexReplaceInFilesWithEncoding ignorePattern "" System.Text.Encoding.UTF8 tests
40-
41-
Seq.iter restoreAndTest projects
40+
Target "IgnoreExampleImplementation" (fun _ ->
41+
RegexReplaceInFilesWithEncoding
42+
"</PropertyGroup>"
43+
"</PropertyGroup><ItemGroup><Compile Remove=\"Example.cs\" /></ItemGroup>"
44+
System.Text.Encoding.UTF8 allProjects
45+
)
46+
47+
Target "BuildUsingDefaultImplementation" (fun _ ->
48+
Seq.iter restoreAndBuild defaultProjects
49+
)
50+
51+
Target "EnableAllTests" (fun _ ->
52+
RegexReplaceInFilesWithEncoding
53+
"Skip\s*=\s*\"Remove to run test\""
54+
""
55+
System.Text.Encoding.UTF8 testFiles
56+
)
57+
58+
Target "TestRefactoringProjects" (fun _ ->
59+
Seq.iter restoreAndTest refactoringProjects
60+
)
61+
62+
Target "TestUsingExampleImplementation" (fun _ ->
63+
let useExampleInsteadOfDefaultImplementation project =
64+
let projectDir = directory project
65+
let exampleFile = projectDir @@ "Example.cs"
66+
let defaultFile = projectDir @@ filename project + "" |> changeExt ".cs"
67+
CopyFile defaultFile exampleFile
68+
69+
Seq.iter useExampleInsteadOfDefaultImplementation allProjects
70+
Seq.iter restoreAndTest allProjects
4271
)
4372

4473
"Clean"
45-
==> "Copy"
46-
==> "Test"
74+
==> "CopyExercises"
75+
==> "IgnoreExampleImplementation"
76+
==> "BuildUsingDefaultImplementation"
77+
==> "EnableAllTests"
78+
==> "TestRefactoringProjects"
79+
==> "TestUsingExampleImplementation"
4780

48-
RunTargetOrDefault "Test"
81+
RunTargetOrDefault "TestUsingExampleImplementation"

circle.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
machine:
22
environment:
33
TERM: xterm-256color
4+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
5+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
46
dependencies:
57
pre:
8+
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
69
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
710
- echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
811
- sudo apt-get update
912
- sudo apt-get install mono-complete
13+
- sudo apt-get install gettext
14+
- sudo apt-get install libcurl4-openssl-dev
15+
- sudo apt-get install libicu-dev
16+
- sudo apt-get install libssl-dev
17+
- sudo apt-get install libunwind8
18+
- sudo apt-get install zlib1g
19+
- sudo apt-get install libstdc++6
20+
- curl https://download.microsoft.com/download/B/4/6/B4678511-01F4-4F97-902B-0E58A985932A/dotnet-dev-debian-x64.1.0.0-rc4-004771.tar.gz -o /tmp/dotnet.tar.gz
21+
- sudo mkdir -p /opt/dotnet
22+
- sudo tar zxf /tmp/dotnet.tar.gz -C /opt/dotnet
23+
- sudo ln -s /opt/dotnet/dotnet /usr/local/bin
1024
test:
1125
override:
1226
- ./build.sh

exercises/accumulate/Accumulate.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
public static class AccumulateExtensions
5+
{
6+
public static IEnumerable<U> Accumulate<T, U>(this IEnumerable<T> collection, Func<T, U> func)
7+
{
8+
throw new NotImplementedException("You need to implement this function.");
9+
}
10+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10-
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11-
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc4-build1270" />
1212
</ItemGroup>
1313

1414
</Project>

exercises/acronym/Acronym.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
public static class Acronym
4+
{
5+
public static string Abbreviate(string phrase)
6+
{
7+
throw new NotImplementedException("Please implement this function");
8+
}
9+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10-
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11-
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc4-build1270" />
1212
</ItemGroup>
1313

1414
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
public static class Base
4+
{
5+
public static int[] Rebase(int inputBase, int[] inputDigits, int outputBase)
6+
{
7+
throw new NotImplementedException("Please implement this function");
8+
}
9+
}

exercises/all-your-base/all-your-base.csproj renamed to exercises/all-your-base/AllYourBase.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10-
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11-
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc4-build1270" />
1212
</ItemGroup>
1313

1414
</Project>

0 commit comments

Comments
 (0)