Skip to content

Commit 5960a8a

Browse files
committed
Move to GH actions
1 parent 7a193cf commit 5960a8a

File tree

94 files changed

+152
-4299
lines changed

Some content is hidden

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

94 files changed

+152
-4299
lines changed

.github/workflows/ci.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
jobs:
11+
build:
12+
strategy:
13+
fail-fast: false
14+
runs-on: windows-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Build and Test
21+
run: ./Build.ps1
22+
shell: pwsh
23+
- name: Push to MyGet
24+
env:
25+
NUGET_URL: https://www.myget.org/F/automapperdev/api/v3/index.json
26+
NUGET_API_KEY: ${{ secrets.MYGET_CI_API_KEY }}
27+
run: ./Push.ps1
28+
shell: pwsh
29+
- name: Artifacts
30+
uses: actions/upload-artifact@v2
31+
with:
32+
name: artifacts
33+
path: artifacts/**/*

.github/workflows/release.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: false
11+
runs-on: windows-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
- name: Build and Test
18+
run: ./Build.ps1
19+
shell: pwsh
20+
- name: Push to MyGet
21+
env:
22+
NUGET_URL: https://www.myget.org/F/automapperdev/api/v3/index.json
23+
NUGET_API_KEY: ${{ secrets.MYGET_CI_API_KEY }}
24+
run: ./Push.ps1
25+
shell: pwsh
26+
- name: Push to NuGet
27+
env:
28+
NUGET_URL: https://api.nuget.org/v3/index.json
29+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
30+
run: ./Push.ps1
31+
shell: pwsh
32+
- name: Artifacts
33+
uses: actions/upload-artifact@v2
34+
with:
35+
name: artifacts
36+
path: artifacts/**/*

AutoMapper.Collection.sln

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.29411.108
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{19AAEE83-5EEC-4EAA-9CF7-16F8ED58B50E}"
7-
ProjectSection(SolutionItems) = preProject
8-
.nuget\NuGet.Config = .nuget\NuGet.Config
9-
EndProjectSection
10-
EndProject
116
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{578F2483-CF08-409D-A316-31BCB7C5D9D0}"
127
ProjectSection(SolutionItems) = preProject
13-
appveyor.yml = appveyor.yml
8+
Build.ps1 = Build.ps1
149
Directory.Build.props = Directory.Build.props
1510
global.json = global.json
11+
Push.ps1 = Push.ps1
1612
README.md = README.md
1713
version.props = version.props
14+
.github\workflows\ci.yml = .github\workflows\ci.yml
15+
.github\workflows\release.yml = .github\workflows\release.yml
1816
EndProjectSection
1917
EndProject
2018
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper.Collection", "src\AutoMapper.Collection\AutoMapper.Collection.csproj", "{37AD667A-8080-476C-88FD-20310AC7CAF3}"

Push.ps1

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
$scriptName = $MyInvocation.MyCommand.Name
2+
$artifacts = "./artifacts"
3+
4+
if ([string]::IsNullOrEmpty($Env:NUGET_API_KEY)) {
5+
Write-Host "${scriptName}: NUGET_API_KEY is empty or not set. Skipped pushing package(s)."
6+
} else {
7+
Get-ChildItem $artifacts -Filter "*.nupkg" | ForEach-Object {
8+
Write-Host "$($scriptName): Pushing $($_.Name)"
9+
dotnet nuget push $_ --source $Env:NUGET_URL --api-key $Env:NUGET_API_KEY
10+
if ($lastexitcode -ne 0) {
11+
throw ("Exec: " + $errorMessage)
12+
}
13+
}
14+
}

appveyor.yml

-39
This file was deleted.

build.cmd

-5
This file was deleted.

build.ps1

+28-89
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,35 @@
1-
Framework '4.5.1x86'
2-
3-
properties {
4-
$base_dir = resolve-path .
5-
$source_dir = "$base_dir\src"
6-
$result_dir = "$base_dir\results"
7-
$artifacts_dir = "$base_dir\artifacts"
8-
$global:config = "debug"
9-
}
10-
11-
12-
task default -depends local
13-
task local -depends init, compile, test
14-
task ci -depends clean, release, local
15-
16-
task clean {
17-
rd "$artifacts_dir" -recurse -force -ErrorAction SilentlyContinue | out-null
18-
rd "$result_dir" -recurse -force -ErrorAction SilentlyContinue | out-null
19-
}
20-
21-
task init {
22-
# Make sure per-user dotnet is installed
23-
Install-Dotnet
24-
}
25-
26-
task release {
27-
$global:config = "release"
28-
}
29-
30-
task compile -depends clean {
31-
32-
$tag = $(git tag -l --points-at HEAD)
33-
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
34-
$suffix = @{ $true = ""; $false = "ci-$revision"}[$tag -ne $NULL -and $revision -ne "local"]
35-
$commitHash = $(git rev-parse --short HEAD)
36-
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
37-
38-
$buildParam = @{ $true = ""; $false = "--version-suffix=$buildSuffix"}[$tag -ne $NULL -and $revision -ne "local"]
39-
$packageParam = @{ $true = ""; $false = "--version-suffix=$suffix"}[$tag -ne $NULL -and $revision -ne "local"]
40-
41-
Write-Output "build: Tag is $tag"
42-
Write-Output "build: Package version suffix is $suffix"
43-
Write-Output "build: Build version suffix is $buildSuffix"
44-
45-
# restore all project references (creating project.assets.json for each project)
46-
exec { dotnet restore $base_dir\AutoMapper.Collection.sln /nologo }
47-
48-
exec { dotnet build $base_dir\AutoMapper.Collection.sln -c $config $buildParam --no-restore /nologo }
49-
50-
exec { dotnet pack $base_dir\AutoMapper.Collection.sln -c $config --include-symbols --no-build --no-restore --output $artifacts_dir $packageParam /nologo }
1+
# Taken from psake https://github.com/psake/psake
2+
3+
<#
4+
.SYNOPSIS
5+
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
6+
to see if an error occcured. If an error is detected then an exception is thrown.
7+
This function allows you to run command-line programs without having to
8+
explicitly check the $lastexitcode variable.
9+
.EXAMPLE
10+
exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
11+
#>
12+
function Exec
13+
{
14+
[CmdletBinding()]
15+
param(
16+
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
17+
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
18+
)
19+
& $cmd
20+
if ($lastexitcode -ne 0) {
21+
throw ("Exec: " + $errorMessage)
22+
}
5123
}
5224

53-
task test {
25+
$artifacts = ".\artifacts"
5426

55-
exec { dotnet test $source_dir\AutoMapper.Collection.Tests -c $config --no-build --no-restore --results-directory $result_dir --logger trx /nologo }
27+
if(Test-Path $artifacts) { Remove-Item $artifacts -Force -Recurse }
5628

57-
exec { dotnet test $source_dir\AutoMapper.Collection.EntityFramework.Tests -c $config --no-build --no-restore --results-directory $result_dir --logger trx /nologo }
29+
exec { & dotnet clean -c Release }
5830

59-
}
31+
exec { & dotnet build -c Release }
6032

61-
function Install-Dotnet
62-
{
63-
$dotnetCli = (where-is "dotnet" | Select-Object -First 1)
64-
$install = ($null -eq $dotnetCli -or ($null -ne $env:DOTNET_CLI_VERSION -and $null -eq (&"$dotnetCli" --info | Where-Object { $_ -like " $env:DOTNET_CLI_VERSION*" })))
65-
66-
if ($install)
67-
{
68-
$dotnetPath = "$pwd\.dotnet"
69-
$dotnetCliVersion = if ($null -eq $env:DOTNET_CLI_VERSION) { 'Latest' } else { $env:DOTNET_CLI_VERSION }
70-
$dotnetInstallScriptUrl = 'https://raw.githubusercontent.com/dotnet/cli/v2.1.4/scripts/obtain/dotnet-install.ps1'
71-
$dotnetInstallScriptPath = '.\scripts\obtain\dotnet-install.ps1'
72-
73-
mkdir -Force ".\scripts\obtain\" | Out-Null
74-
Invoke-WebRequest $dotnetInstallScriptUrl -OutFile $dotnetInstallScriptPath
75-
& .\scripts\obtain\dotnet-install.ps1 -Channel "preview" -version $dotnetCliVersion -InstallDir $dotnetPath -NoPath
76-
$env:Path = "$dotnetPath;$env:Path"
77-
}
78-
}
33+
exec { & dotnet test -c Release -r $artifacts --no-build -l trx --verbosity=normal }
7934

80-
function where-is($command) {
81-
(Get-ChildItem env:\path).Value.split(';') | `
82-
Where-Object { $_ } | `
83-
ForEach-Object{ [System.Environment]::ExpandEnvironmentVariables($_) } | `
84-
Where-Object { test-path $_ } |`
85-
ForEach-Object{ Get-ChildItem "$_\*" -include *.bat,*.exe,*cmd } | `
86-
ForEach-Object{ $file = $_.Name; `
87-
if($file -and ($file -eq $command -or `
88-
$file -eq ($command + '.exe') -or `
89-
$file -eq ($command + '.bat') -or `
90-
$file -eq ($command + '.cmd'))) `
91-
{ `
92-
$_.FullName `
93-
} `
94-
} | `
95-
Select-Object -unique
96-
}
35+
exec { & dotnet pack .\src\AutoMapper\AutoMapper.csproj -c Release -o $artifacts --no-build }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
5+
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
6+
</configSections>
7+
<entityFramework>
8+
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
9+
<parameters>
10+
<parameter value="System.Data.SqlServerCe.4.0" />
11+
</parameters>
12+
</defaultConnectionFactory>
13+
<providers>
14+
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
15+
<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
16+
</providers>
17+
</entityFramework>
18+
<system.data>
19+
<DbProviderFactories>
20+
<remove invariant="System.Data.SqlServerCe.4.0" />
21+
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
22+
</DbProviderFactories>
23+
</system.data>
24+
</configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using Xunit;
2+
3+
[assembly: CollectionBehavior(DisableTestParallelization = true)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using Xunit;
2+
3+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

src/AutoMapper.Collection/AutoMapper.Collection.csproj

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@
1111
<PackageLicenseUrl>https://github.com/AutoMapper/AutoMapper.Collection/blob/master/LICENSE.txt</PackageLicenseUrl>
1212
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.1' ">$(PackageTargetFallback);portable-net45+win8+dnxcore50;portable-net45+win8</PackageTargetFallback>
1313
<AssemblyOriginatorKeyFile>../Key.snk</AssemblyOriginatorKeyFile>
14+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1415
<SignAssembly>true</SignAssembly>
15-
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
16+
<IncludeSymbols>true</IncludeSymbols>
17+
<MinVerTagPrefix>v</MinVerTagPrefix>
18+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
19+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
20+
<Deterministic>true</Deterministic>
21+
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
1622
</PropertyGroup>
1723

1824
<ItemGroup>

tools/NuGet.exe

-4.06 MB
Binary file not shown.

tools/psake/.gitattributes

-1
This file was deleted.

tools/psake/.gitignore

-3
This file was deleted.

tools/psake/NuGet.exe

-1.54 MB
Binary file not shown.

tools/psake/NuGetPackageBuilder.ps1

-35
This file was deleted.

0 commit comments

Comments
 (0)