Skip to content

Commit

Permalink
Add publish
Browse files Browse the repository at this point in the history
  • Loading branch information
willsbctm committed Mar 16, 2023
1 parent 23bac9d commit ef5deff
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
run: dotnet build $SOLUTION -c $BUILD_CONFIG --no-restore

- name: Run tests
run: dotnet test -c $BUILD_CONFIG --no-restore --no-build
run: dotnet test --logger trx -c $BUILD_CONFIG --no-restore --no-build
49 changes: 49 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'DotNet.Core.Runtime.Faker.sln'

steps:
- uses: actions/checkout@v3

- uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x.x

- name: Install dependencies
run: dotnet restore

- name: Build
run: dotnet build $SOLUTION -c $BUILD_CONFIG --no-restore

- name: Tag name
id: tag-name
run: |
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create the package
run: dotnet pack -p:PackageVersion=$SOURCE_TAG -c $BUILD_CONFIG src/DotNet.Core.Runtime.Faker.Moq --no-build --no-restore
env:
SOURCE_TAG: ${{ steps.tag-name.outputs.SOURCE_TAG }}

- name: Create the package
run: dotnet pack -p:PackageVersion=$SOURCE_TAG -c $BUILD_CONFIG src/DotNet.Core.Runtime.Faker.FakeItEasy --no-build --no-restore
env:
SOURCE_TAG: ${{ steps.tag-name.outputs.SOURCE_TAG }}

- name: Publish the package to nuget.org
run: dotnet nuget push **/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<PackageId>Luna.DotNet.Core.Runtime.Faker.FakeItEasy</PackageId>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IncludeSymbols>true</IncludeSymbols>
<Authors>William Espinosa de Rezende</Authors>
<PackageDescription>Biblioteca para troca de dependências em tempo de execução dos testes com FakeItEasy</PackageDescription>
<PackageTags>dotnet core; tests; fakeiteasy;</PackageTags>
<RepositoryUrl>https://github.com/willsbctm/DotNet.Core.Runtime.Faker</RepositoryUrl>
<RepositoryBranch>main</RepositoryBranch>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<PackageId>Luna.DotNet.Core.Runtime.Faker.Moq</PackageId>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IncludeSymbols>true</IncludeSymbols>
<Authors>William Espinosa de Rezende</Authors>
<PackageDescription>Biblioteca para troca de dependências em tempo de execução dos testes com Moq</PackageDescription>
<PackageTags>dotnet core; tests; moq;</PackageTags>
<RepositoryUrl>https://github.com/willsbctm/DotNet.Core.Runtime.Faker</RepositoryUrl>
<RepositoryBranch>main</RepositoryBranch>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using DotNet.Core.Faker.Runtime.WebApi.Sample;
using DotNet.Core.Runtime.Faker.WebApi.Sample;
using FluentAssertions;
using Microsoft.AspNetCore.Mvc.Testing;
Expand All @@ -15,7 +14,7 @@ namespace DotNet.Core.Faker.Runtime.Integration.Tests
public class RuntimeFakerUsingCustomFakerTests
{
protected static DateTime changedValue;
private WebApplicationFactory<Startup> factory;
private WebApplicationFactory<Program> factory;
private IServiceProvider serviceProvider;
private HttpClient cliente;

Expand All @@ -24,7 +23,7 @@ public void OneTimeSetUp()
{
changedValue = new Bogus.Faker().Date.Past();

factory = new WebApplicationFactory<Startup>().WithWebHostBuilder(builder =>
factory = new WebApplicationFactory<Program>().WithWebHostBuilder(builder =>
builder.ConfigureTestServices(services =>
{
services.AddServiceWithFaker(() => new Clock());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using DotNet.Core.Faker.Runtime.WebApi.Sample;
using DotNet.Core.Runtime.Faker.WebApi.Sample;
using FluentAssertions;
using Microsoft.AspNetCore.Mvc.Testing;
Expand All @@ -17,7 +16,7 @@ namespace DotNet.Core.Faker.Runtime.Integration.Tests
public class RuntimeFakerUsingFakeItEasyTests
{
private DateTime registeredValue;
private WebApplicationFactory<Startup> factory;
private WebApplicationFactory<Program> factory;
private IServiceProvider serviceProvider;
private HttpClient cliente;

Expand All @@ -26,7 +25,7 @@ public void OneTimeSetUp()
{
registeredValue = new Bogus.Faker().Date.Future();

factory = new WebApplicationFactory<Startup>().WithWebHostBuilder(builder =>
factory = new WebApplicationFactory<Program>().WithWebHostBuilder(builder =>
builder.ConfigureTestServices(services =>
{
services.AddServiceWithFaker<Clock>(faker => A.CallTo(() => faker.Now()).Returns(registeredValue));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using DotNet.Core.Faker.Runtime.WebApi.Sample;
using DotNet.Core.Runtime.Faker.WebApi.Sample;
using FluentAssertions;
using Microsoft.AspNetCore.Mvc.Testing;
Expand All @@ -16,7 +15,7 @@ namespace DotNet.Core.Faker.Runtime.Integration.Tests
public class RuntimeFakerUsingMoqTests
{
private DateTime registeredValue;
private static WebApplicationFactory<Startup> factory;
private static WebApplicationFactory<Program> factory;
private static IServiceProvider serviceProvider;
private HttpClient cliente;

Expand All @@ -25,7 +24,7 @@ public void OneTimeSetUp()
{
registeredValue = new Bogus.Faker().Date.Future();

factory = new WebApplicationFactory<Startup>().WithWebHostBuilder(builder =>
factory = new WebApplicationFactory<Program>().WithWebHostBuilder(builder =>
builder.ConfigureTestServices(services =>
{
services.AddServiceWithFaker<Clock>(mock => mock.Setup(x => x.Now()).Returns(registeredValue));
Expand Down
2 changes: 2 additions & 0 deletions test/DotNet.Core.Runtime.Faker.WebApi.Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
app.MapControllers();

app.Run();

public partial class Program { }
28 changes: 0 additions & 28 deletions test/DotNet.Core.Runtime.Faker.WebApi.Sample/Startup.cs

This file was deleted.

0 comments on commit ef5deff

Please sign in to comment.