-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (44 loc) · 2.17 KB
/
salesperson-api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: salesperson-api
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- src/Services/Sales/**
- .github/workflows/salesperson-api.yml
env:
DOTNET_VERSION: 7.0.x
REGISTRY_NAME: cradventureworks
APP_NAME: adventureworks_salespersonapi
jobs:
BuildLinux:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Github Action'
uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build and run unit tests
run: |
cd src/Services/Sales
dotnet build tests/AW.Services.Sales.Core.UnitTests/AW.Services.Sales.Core.UnitTests.csproj
dotnet test tests/AW.Services.Sales.Core.UnitTests/AW.Services.Sales.Core.UnitTests.csproj --no-build --no-restore
dotnet build tests/AW.Services.Sales.Infrastructure.EFCore.UnitTests/AW.Services.Sales.Infrastructure.EFCore.UnitTests.csproj
dotnet test tests/AW.Services.Sales.Infrastructure.EFCore.UnitTests/AW.Services.Sales.Infrastructure.EFCore.UnitTests.csproj --no-build --no-restore
dotnet build src/AW.Services.Sales.SalesPerson.REST.API/AW.Services.Sales.SalesPerson.REST.API.csproj
dotnet build tests/AW.Services.Sales.SalesPerson.REST.API.UnitTests/AW.Services.Sales.SalesPerson.REST.API.UnitTests.csproj
dotnet test tests/AW.Services.Sales.SalesPerson.REST.API.UnitTests/AW.Services.Sales.SalesPerson.REST.API.UnitTests.csproj --no-build --no-restore
- name: Login to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ env.REGISTRY_NAME }}.azurecr.io
username: ${{ secrets.AZ_SP_CLIENT_ID }}
password: ${{ secrets.AZ_SP_CLIENT_SECRET }}
- name: Build the Docker image
run: |
cd src
docker build -f Services/Sales/src/AW.Services.Sales.SalesPerson.REST.API/Dockerfile -t ${{ env.REGISTRY_NAME }}.azurecr.io/${{ env.APP_NAME }}:latest .
- name: Push Image to Docker
run: docker push ${{ env.REGISTRY_NAME }}.azurecr.io/${{ env.APP_NAME }}:latest