Skip to content

Commit

Permalink
GitHub workflows instead of AppVeyor
Browse files Browse the repository at this point in the history
Fixing keys
  • Loading branch information
jbogard committed Jul 1, 2020
1 parent cfb2dc1 commit 314671c
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 1,137 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Expand Up @@ -62,5 +62,8 @@ dotnet_naming_style.camel_case_style.capitalization = camel_case
[*.xml]
indent_size = 2

[*.props]
indent_size = 2

[*.csproj]
indent_size = 2
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
strategy:
fail-fast: false
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build and Test
run: ./Build.ps1
shell: pwsh
- name: Push to MyGet

This comment has been minimized.

Copy link
@lbargaoanu

lbargaoanu Jul 8, 2020

Member

I take it this is intentional to allow people to try a PR using the MyGet build. With AppVeyor, I think the publish to MyGet happened only when merging into master.

This comment has been minimized.

Copy link
@jbogard

jbogard Jul 8, 2020

Author Member

Yeah, I wanted to be able to test things in a PR

env:
NUGET_URL: https://www.myget.org/F/automapperdev/api/v3/index.json
NUGET_API_KEY: ${{ secrets.MYGET_CI_API_KEY }}
run: ./Push.ps1
shell: pwsh
- name: Artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: artifacts/**/*
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,36 @@
name: Release

on:
push:
tags:
- '*.*.*'
jobs:
build:
strategy:
fail-fast: false
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build and Test
run: ./Build.ps1
shell: pwsh
- name: Push to MyGet
env:
NUGET_URL: https://www.myget.org/F/automapperdev/api/v3/index.json
NUGET_API_KEY: ${{ secrets.MYGET_CI_API_KEY }}
run: ./Push.ps1
shell: pwsh
- name: Push to NuGet
env:
NUGET_URL: https://api.nuget.org/v3/index.json
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: ./Push.ps1
shell: pwsh
- name: Artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: artifacts/**/*
7 changes: 4 additions & 3 deletions AutoMapper.sln
Expand Up @@ -5,13 +5,14 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0691ABF2-B3C7-43BF-9862-2D8D1299CE58}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
appveyor.yml = appveyor.yml
Build.ps1 = Build.ps1
.github\workflows\ci.yml = .github\workflows\ci.yml
CONTRIBUTING.md = CONTRIBUTING.md
default.ps1 = default.ps1
Directory.Build.props = Directory.Build.props
ISSUE_TEMPLATE.md = ISSUE_TEMPLATE.md
nuget.config = nuget.config
Push.ps1 = Push.ps1
README.md = README.md
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark", "src\Benchmark\Benchmark.csproj", "{B8051389-CB47-46FB-B234-9D49506704AA}"
Expand Down
36 changes: 36 additions & 0 deletions Build.ps1
@@ -0,0 +1,36 @@
# Taken from psake https://github.com/psake/psake

<#
.SYNOPSIS
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
to see if an error occcured. If an error is detected then an exception is thrown.
This function allows you to run command-line programs without having to
explicitly check the $lastexitcode variable.
.EXAMPLE
exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
#>
function Exec
{
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
)
& $cmd
if ($lastexitcode -ne 0) {
throw ("Exec: " + $errorMessage)
}
}

$artifacts = ".\artifacts"

if(Test-Path $artifacts) { Remove-Item $artifacts -Force -Recurse }

exec { & dotnet clean -c Release }

exec { & dotnet build -c Release }

exec { & dotnet test -c Release -r $artifacts --no-build -l trx --verbosity=normal }

exec { & dotnet pack .\src\AutoMapper\AutoMapper.csproj -c Release -o $artifacts --no-build }

15 changes: 7 additions & 8 deletions Directory.Build.props
@@ -1,12 +1,11 @@
<Project>

<PropertyGroup>
<VersionPrefix>10.0.0</VersionPrefix>
<Authors>Jimmy Bogard</Authors>
<LangVersion>latest</LangVersion>
<WarningsAsErrors>true</WarningsAsErrors>
<NoWarn>$(NoWarn);1701;1702;1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<Authors>Jimmy Bogard</Authors>
<LangVersion>latest</LangVersion>
<NoWarn>$(NoWarn);CS1701;CS1702;CS1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Features>strict</Features>
</PropertyGroup>

</Project>
14 changes: 14 additions & 0 deletions Push.ps1
@@ -0,0 +1,14 @@
$scriptName = $MyInvocation.MyCommand.Name
$artifacts = "./artifacts"

if ([string]::IsNullOrEmpty($Env:NUGET_API_KEY)) {
Write-Host "${scriptName}: NUGET_API_KEY is empty or not set. Skipped pushing package(s)."
} else {
Get-ChildItem $artifacts -Filter "*.nupkg" | ForEach-Object {
Write-Host "$($scriptName): Pushing $($_.Name)"
dotnet nuget push $_ --source $Env:NUGET_URL --api-key $Env:NUGET_API_KEY
if ($lastexitcode -ne 0) {
throw ("Exec: " + $errorMessage)
}
}
}
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
<img src="https://s3.amazonaws.com/automapper/logo.png" alt="AutoMapper">

[![Build status](https://ci.appveyor.com/api/projects/status/q261l3sbokafmx1o/branch/master?svg=true)](https://ci.appveyor.com/project/jbogard/automapper/branch/master)
[![CI](https://github.com/automapper/automapper/workflows/CI/badge.svg)](https://github.com/automapper/automapper/workflows/CI)
[![NuGet](http://img.shields.io/nuget/v/AutoMapper.svg)](https://www.nuget.org/packages/AutoMapper/)
[![MyGet (dev)](https://img.shields.io/myget/automapperdev/v/AutoMapper.svg)](http://myget.org/gallery/automapperdev)

Expand Down
30 changes: 0 additions & 30 deletions appveyor.yml

This file was deleted.

64 changes: 0 additions & 64 deletions default.ps1

This file was deleted.

Binary file added icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 0 additions & 14 deletions psake.cmd

This file was deleted.

53 changes: 0 additions & 53 deletions psake.ps1

This file was deleted.

31 changes: 0 additions & 31 deletions psake.psd1

This file was deleted.

1 comment on commit 314671c

@TylerCarlson1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbogard App Voyer API key doesn't work anymore. Do I just need to follow these changed and it should work with Github actions?

Please sign in to comment.