Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 8b8db0e

Browse files
authored
feat(certificate-processing): add build pipeline via github action (#499)
1 parent de781b5 commit 8b8db0e

4 files changed

Lines changed: 68 additions & 6 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CertificateProcessing.API
2+
3+
on:
4+
push:
5+
paths:
6+
- "src/Services/CertificateProcessing/**"
7+
- ".github/workflows/certificate-processing.api.yml"
8+
- "src/Libraries/OpenTelemetry/**"
9+
- "build/dotnet/**"
10+
- "src/Directory.Build.props"
11+
- "docker-compose.yml"
12+
- "docker-compose.override.yml"
13+
- "docker-compose.dcproj"
14+
- "docker-compose-test.yml"
15+
- "docker-compose-test.override.yml"
16+
pull_request:
17+
paths:
18+
- "src/Services/CertificateProcessing/**"
19+
- ".github/workflows/certificate-processing.api.yml"
20+
- "src/Libraries/OpenTelemetry/**"
21+
- "build/dotnet/**"
22+
- "src/Directory.Build.props"
23+
- "docker-compose.yml"
24+
- "docker-compose.override.yml"
25+
- "docker-compose.dcproj"
26+
- "docker-compose-test.yml"
27+
- "docker-compose-test.override.yml"
28+
29+
jobs:
30+
build:
31+
runs-on: ubuntu-16.04
32+
33+
steps:
34+
- uses: actions/checkout@v1
35+
36+
- name: set image tag
37+
run: echo "TAG=$(git tag --points-at HEAD | cut -c 2-4)" >> $GITHUB_ENV
38+
39+
- name: build
40+
run: docker-compose build certificateprocessing.api
41+
42+
- uses: azure/docker-login@v1
43+
if: startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master'
44+
with:
45+
login-server: index.docker.io
46+
username: ${{ secrets.DOCKERIO_USERNAME }}
47+
password: ${{ secrets.DOCKERIO_PASSWORD }}
48+
49+
- name: push image
50+
if: startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master'
51+
run: docker-compose push certificateprocessing.api

src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
<TargetFramework>net5.0</TargetFramework>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageReference Include="Serilog" Version="2.10.0" />
7-
<PackageReference Include="Serilog.Enrichers.Span" Version="1.3.0" />
8-
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
9-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
6+
<!-- Swagger -->
7+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5"/>
8+
<!-- Logging -->
9+
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0"/>
10+
<PackageReference Include="Serilog.Enrichers.Span" Version="1.3.0"/>
11+
<PackageReference Include="Serilog.Sinks.Seq" Version="5.0.1"/>
1012
</ItemGroup>
1113
</Project>

src/Services/CertificateProcessing/CertificateProcessing.API/Program.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1+
using System;
2+
using System.Diagnostics;
3+
using System.IO;
14
using Microsoft.AspNetCore.Hosting;
5+
using Microsoft.Extensions.Configuration;
26
using Microsoft.Extensions.Hosting;
37
using Serilog;
48
using Serilog.Enrichers.Span;
59

610
namespace CertificateProcessing.API
711
{
8-
public class Program
12+
public static class Program
913
{
1014
public static readonly string Namespace = typeof(Program).Namespace!;
11-
public static readonly string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
15+
public static readonly string AppName = Namespace[(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1)..];
1216

17+
[System.Diagnostics.CodeAnalysis.SuppressMessage(
18+
"Design",
19+
"CA1031:Do not catch general exception types",
20+
Justification = "Top level all exception catcher")]
1321
public static int Main(string[] args)
1422
{
1523
Activity.DefaultIdFormat = ActivityIdFormat.W3C;

src/Services/CertificateProcessing/CertificateProcessing.API/Startup.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Microsoft.Extensions.Configuration;
44
using Microsoft.Extensions.DependencyInjection;
55
using Microsoft.Extensions.Hosting;
6+
using Microsoft.Extensions.Logging;
67
using Microsoft.OpenApi.Models;
78
using Serilog;
89

0 commit comments

Comments
 (0)