-
Notifications
You must be signed in to change notification settings - Fork 222
110 lines (90 loc) · 2.65 KB
/
build.yml
File metadata and controls
110 lines (90 loc) · 2.65 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build devStore
on:
push:
paths:
- 'global.json'
- 'src/**'
- '.github/**'
branches:
- main
pull_request:
paths:
- 'global.json'
- 'src/**'
- '.github/**'
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
versioning:
name: Versioning
runs-on: ubuntu-latest
outputs:
TAG: ${{ steps.tagging.outputs.TAG }}
steps:
- name: Tagging
id: tagging
run: |
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
echo "TAG=latest" >> $GITHUB_OUTPUT
else
echo "TAG=preview" >> $GITHUB_OUTPUT
fi
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
needs: versioning
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
ports:
- 1433:1433
env:
ACCEPT_EULA: "Y"
SA_PASSWORD: ${{ secrets.TEST_DB_SA_PASSWORD }}
options: --health-cmd="exit 0" --health-interval=10s --health-timeout=5s --health-retries=3
rabbitmq:
image: masstransit/rabbitmq
ports:
- 5672:5672
env:
RABBITMQ_DEFAULT_USER: "devstore"
RABBITMQ_DEFAULT_PASS: ${{ secrets.TEST_RABBITMQ_PASSWORD }}
env:
TAG: ${{ needs.versioning.outputs.TAG }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration Release --no-restore
- name: Run tests
run: dotnet test --no-build --no-restore --configuration Release --logger "console;verbosity=detailed" --logger trx --results-directory "TestResults"
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: dotnet-test-results
path: ./src/TestResults
build-docker-image-services:
name: Build docker image services
runs-on: ubuntu-latest
needs: build-and-test
env:
TAG: ${{ needs.versioning.outputs.TAG }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build docker images
working-directory: ./docker
run: |
TAG=${{ env.TAG }} docker compose -f ./docker-compose-local.yml build
- name: Push docker images
working-directory: ./docker
run: |
TAG=${{ env.TAG }} docker compose -f ./docker-compose-local.yml push