-
Notifications
You must be signed in to change notification settings - Fork 5
125 lines (103 loc) · 4.1 KB
/
BuildTestDeploy.yml
File metadata and controls
125 lines (103 loc) · 4.1 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: OVFToolsBuildTestDeploy
on: [push, pull_request]
jobs:
check_license:
runs-on: windows-latest
steps:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.x'
architecture: 'x64'
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true
- name: Check license headers
run: python manage_license_headers.py ci
build_and_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Dotnet sdk
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Remove GUI Projects (Linux)
if: contains(matrix.os, 'ubuntu')
run: dotnet sln OpenVectorFormatTools.sln remove OVFFileConverterGUI/OVFFileConverterGUI.csproj
- name: Build
run: dotnet build --configuration Release
- name: Test Linux
if: contains(matrix.os, 'ubuntu')
run: |
dotnet run --configuration Release --framework net8.0 --no-build --project ReaderWriter/FileReaderWriterFactoryGRPCWrapper/FileReaderWriterFactoryGRPCWrapper.csproj &
grpcpid="$!"
echo "started grpc server"
sleep 5s
dotnet test --no-build --configuration Release --framework net8.0
kill $grpcpid
- name: Test Windows
if: contains(matrix.os, 'windows')
run: |
$j = Start-Process -PassThru -Filepath 'dotnet' -WorkingDirectory $PWD -ArgumentList 'run --configuration Release --framework net8.0 --no-build --project .\ReaderWriter\FileReaderWriterFactoryGRPCWrapper\FileReaderWriterFactoryGRPCWrapper.csproj'
Start-Sleep -s 5
dotnet test --no-build --configuration Release
$j | Select-Object -Property Id | Stop-Process
publish_nuget:
needs: [check_license, build_and_test]
if: startsWith(github.ref, 'refs/tags/v') # make sure deploy only runs on tags with version number
runs-on: windows-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Dotnet sdk
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build Windows
run: |
dotnet sln OpenVectorFormatTools.sln remove OVFFileConverterGUI/OVFFileConverterGUI.csproj
dotnet build --configuration Release
- name: Nuget Deploy
run: |
$env:RELEASE_VERSION=($env:GITHUB_REF).split("tags/v")[-1]
echo $env:RELEASE_VERSION
echo $env:GITHUB_SHA
mkdir nupkg
dotnet pack -p:PackageVersion=$env:RELEASE_VERSION -o $PWD\nupkg -p:RepositoryCommit=$env:GITHUB_SHA --configuration Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
cd nupkg
dotnet nuget push "**/*.nupkg" --api-key ${{secrets.NUGET_DEPLOY_KEY}} --source "https://api.nuget.org/v3/index.json" --skip-duplicate
publish_docker:
needs: [check_license, build_and_test]
if: startsWith(github.ref, 'refs/tags/v') # make sure deploy only runs on tags with version number
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true
- name: Set env
run: |
echo "RELEASE_VERSION=${GITHUB_REF_NAME:1}" >> $GITHUB_ENV
echo $RELEASE_VERSION
- name: Build container
run: docker build . -t digitalproductionaachen/ovf-grpc:$RELEASE_VERSION
- name: Push container
run: |
echo ${{secrets.DOCKER_HUB_DEPLOY_KEY}} | docker login --username ${{secrets.DOCKER_HUB_USER}} --password-stdin
docker push digitalproductionaachen/ovf-grpc:$RELEASE_VERSION
docker tag digitalproductionaachen/ovf-grpc:$RELEASE_VERSION digitalproductionaachen/ovf-grpc:latest
docker push digitalproductionaachen/ovf-grpc:latest