Skip to content

Commit e176c47

Browse files
Merge pull request #49 from AutoMapper/pr/fixAM10
Support GitHub Actions and remove AppVouyer
2 parents a804c1e + ea3c231 commit e176c47

File tree

94 files changed

+132
-4304
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

+132
-4304
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
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

Lines changed: 36 additions & 0 deletions
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.EFCore.sln

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ VisualStudioVersion = 16.0.29519.87
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{578F2483-CF08-409D-A316-31BCB7C5D9D0}"
77
ProjectSection(SolutionItems) = preProject
8+
Build.ps1 = Build.ps1
9+
Push.ps1 = Push.ps1
10+
.github\workflows\ci.yml = .github\workflows\ci.yml
11+
.github\workflows\release.yml = .github\workflows\release.yml
812
.editorconfig = .editorconfig
9-
appveyor.yml = appveyor.yml
13+
icon.png = icon.png
1014
README.md = README.md
1115
version.props = version.props
1216
EndProjectSection

Directory.Build.props

Lines changed: 0 additions & 3 deletions
This file was deleted.

Push.ps1

Lines changed: 14 additions & 0 deletions
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

Lines changed: 0 additions & 36 deletions
This file was deleted.

build.cmd

Lines changed: 0 additions & 5 deletions
This file was deleted.

build.ps1

Lines changed: 28 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +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-
Remove-Item "$artifacts_dir" -recurse -force -ErrorAction SilentlyContinue | out-null
18-
Remove-Item "$result_dir" -recurse -force -ErrorAction SilentlyContinue | out-null
19-
}
20-
21-
task init {
22-
23-
# Make sure per-user dotnet is installed
24-
25-
Install-Dotnet
26-
}
27-
28-
task release {
29-
30-
$global:config = "release"
31-
32-
}
33-
34-
task compile -depends clean {
35-
36-
$tag = $(git tag -l --points-at HEAD)
37-
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
38-
$suffix = @{ $true = ""; $false = "ci-$revision"}[$tag -ne $NULL -and $revision -ne "local"]
39-
$commitHash = $(git rev-parse --short HEAD)
40-
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
41-
42-
$buildParam = @{ $true = ""; $false = "--version-suffix=$buildSuffix"}[$tag -ne $NULL -and $revision -ne "local"]
43-
$packageParam = @{ $true = ""; $false = "--version-suffix=$suffix"}[$tag -ne $NULL -and $revision -ne "local"]
44-
45-
Write-Output "build: Tag is $tag"
46-
Write-Output "build: Package version suffix is $suffix"
47-
Write-Output "build: Build version suffix is $buildSuffix"
48-
49-
# restore all project references (creating project.assets.json for each project)
50-
exec { dotnet restore $base_dir\AutoMapper.Collection.EFCore.sln /nologo }
51-
52-
exec { dotnet build $base_dir\AutoMapper.Collection.EFCore.sln -c $config $buildParam --no-restore /nologo }
53-
54-
exec { dotnet pack $base_dir\AutoMapper.Collection.EFCore.sln -c $config --include-symbols --no-build --no-restore --output $artifacts_dir $packageParam /nologo}
55-
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+
}
5623
}
5724

58-
task test {
25+
$artifacts = ".\artifacts"
5926

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

62-
}
29+
exec { & dotnet clean -c Release }
6330

64-
function Install-Dotnet
65-
{
66-
$dotnetcli = Get-CommandLocation -command 'dotnet'
31+
exec { & dotnet build -c Release }
6732

68-
if ($null -eq $dotnetcli)
69-
{
70-
$dotnetPath = "$pwd\.dotnet"
71-
$dotnetCliVersion = if ($null -eq $env:DOTNET_CLI_VERSION) { 'Latest' } else { $env:DOTNET_CLI_VERSION }
72-
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
73-
&([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Channel "LTS" -version $dotnetCliVersion -InstallDir $dotnetPath -NoPath
74-
$env:Path = "$dotnetPath;$env:Path"
75-
}
76-
}
33+
exec { & dotnet test -c Release -r $artifacts --no-build -l trx --verbosity=normal }
7734

78-
function Get-CommandLocation {
79-
param ($command)
80-
(Get-ChildItem env:\path).Value.split(';') | `
81-
Where-Object { $_ } | `
82-
ForEach-Object{ [System.Environment]::ExpandEnvironmentVariables($_) } | `
83-
Where-Object { test-path $_ } |`
84-
ForEach-Object{ Get-ChildItem "$_\*" -include *.bat,*.exe,*.cmd } | `
85-
ForEach-Object{ $file = $_.Name; `
86-
if ($file -and ($file -eq $command -or `
87-
$file -eq ($command + '.exe') -or `
88-
$file -eq ($command + '.bat') -or `
89-
$file -eq ($command + '.cmd'))) `
90-
{ `
91-
$_.FullName `
92-
} `
93-
} | `
94-
Select-Object -unique
95-
}
35+
exec { & dotnet pack .\AutoMapper.Collection.EFCore.sln -c Release -o $artifacts --no-build }

icon.png

1.63 KB
Loading

src/AutoMapper.Collection.EntityFrameworkCore/AutoMapper.Collection.EntityFrameworkCore.csproj

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,35 @@
66
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
77
<AssemblyName>AutoMapper.Collection.EntityFrameworkCore</AssemblyName>
88
<PackageId>AutoMapper.Collection.EntityFrameworkCore</PackageId>
9-
<PackageIconUrl>https://s3.amazonaws.com/automapper/icon.png</PackageIconUrl>
9+
<PackageIcon>icon.png</PackageIcon>
1010
<PackageProjectUrl>https://github.com/AutoMapper/Automapper.Collection.EFCore</PackageProjectUrl>
11-
<PackageLicenseUrl>https://github.com/AutoMapper/AutoMapper.Collection.EFCore/blob/master/LICENSE.txt</PackageLicenseUrl>
1211
<AssemblyOriginatorKeyFile>../Key.snk</AssemblyOriginatorKeyFile>
12+
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
13+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1314
<SignAssembly>true</SignAssembly>
14-
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
15+
<IncludeSymbols>true</IncludeSymbols>
16+
<MinVerTagPrefix>v</MinVerTagPrefix>
17+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
18+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
19+
<Deterministic>true</Deterministic>
1520
</PropertyGroup>
1621

22+
<ItemGroup>
23+
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
24+
</ItemGroup>
25+
1726
<ItemGroup>
1827
<PackageReference Include="AutoMapper.Collection" Version="[7.0.0,8.0.0)" />
1928
</ItemGroup>
2029

2130
<ItemGroup>
2231
<PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="4.0.2" />
23-
<PackageReference Include="Microsoft.CodeAnalysis.VersionCheckAnalyzer" Version="3.3.0">
32+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.14" />
33+
<PackageReference Include="Roslynator.Analyzers" Version="2.3.0">
2434
<PrivateAssets>all</PrivateAssets>
2535
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2636
</PackageReference>
27-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.14" />
28-
<PackageReference Include="Roslynator.Analyzers" Version="2.3.0">
37+
<PackageReference Include="MinVer" Version="2.3.1">
2938
<PrivateAssets>all</PrivateAssets>
3039
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3140
</PackageReference>
@@ -35,5 +44,5 @@
3544
<Reference Include="System" />
3645
<Reference Include="Microsoft.CSharp" />
3746
</ItemGroup>
38-
47+
3948
</Project>

0 commit comments

Comments
 (0)