-
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (97 loc) · 4.58 KB
/
cd_build_test_and_publish.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
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
name: '[CD] build, test & publish'
on:
workflow_dispatch:
inputs:
version:
description: |
# Specify the project version format:
major.minor.patch[-rc|beta|alpha].X
required: true
default: '0.0.0'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
configurations: [Debug, Release]
name: 'build ${{ matrix.prefix }}${{ matrix.configurations }} on ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.200
- name: 'dotnet build ${{ matrix.prefix }}${{ matrix.configurations }}'
run: |
dotnet build src/Exomia.ECS --configuration ${{ matrix.configurations }} --force --nologo -p:Platform=AnyCPU
dotnet build src/Exomia.ECS --configuration ${{ matrix.configurations }} --force --nologo -p:Platform=x86
dotnet build src/Exomia.ECS --configuration ${{ matrix.configurations }} --force --nologo -p:Platform=x64
test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
configurations: [Debug, Release]
name: 'test ${{ matrix.prefix }}${{ matrix.configurations }} on ${{ matrix.os }}'
needs: [build]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.200
- name: 'dotnet test ${{ matrix.prefix }}${{ matrix.configurations }}'
run: |
dotnet test tests/L0/Exomia.ECS.Tests --configuration ${{ matrix.configurations }} --nologo -p:Platform=AnyCPU
dotnet test tests/L0/Exomia.ECS.Tests --configuration ${{ matrix.configurations }} --nologo -p:Platform=x86
dotnet test tests/L0/Exomia.ECS.Tests --configuration ${{ matrix.configurations }} --nologo -p:Platform=x64
publish-on-github:
strategy:
matrix:
os: [windows-latest]
configurations: [Debug]
name: 'publish ${{ matrix.configurations }} to github [v${{ github.event.inputs.version }}] on ${{ matrix.os }}'
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.200
- name: publish ${{ github.repository }} [v${{ github.event.inputs.version }}]
run: |
dotnet pack --configuration ${{ matrix.configurations }} --verbosity m --force --nologo -p:Platform=AnyCPU -p:Version=${{ github.event.inputs.version }}
dotnet pack --configuration ${{ matrix.configurations }} --verbosity m --force --nologo -p:Platform=x86 -p:Version=${{ github.event.inputs.version }}
dotnet pack --configuration ${{ matrix.configurations }} --verbosity m --force --nologo -p:Platform=x64 -p:Version=${{ github.event.inputs.version }}
for f in ./*.nupkg
do
STATUSCODE=$(curl -sSX PUT --retry 3 -o /dev/null -w "%{http_code}" -u "${{ github.repository_owner }}:${{ github.token }}" -F package=@$f https://nuget.pkg.github.com/${{ github.repository_owner }}/)
echo "[$STATUSCODE:https://nuget.pkg.github.com/${{ github.repository_owner }}/] $f"
if [ "${STATUSCODE}" != 200 ] && [ "${STATUSCODE}" != 409 ]; then exit 1; fi
done
shell: bash
working-directory: src/Exomia.ECS
publish-on-nuget:
strategy:
matrix:
os: [windows-latest]
configurations: [Release]
name: 'publish ${{ matrix.configurations }} to nuget [v${{ github.event.inputs.version }}] on ${{ matrix.os }}'
needs: [test, publish-on-github]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.200
- name: publish ${{ github.repository }} [v${{ github.event.inputs.version }}]
run: |
dotnet pack --configuration ${{ matrix.configurations }} --verbosity m --force --nologo -p:Platform=AnyCPU -p:Version=${{ github.event.inputs.version }}
dotnet pack --configuration ${{ matrix.configurations }} --verbosity m --force --nologo -p:Platform=x86 -p:Version=${{ github.event.inputs.version }}
dotnet pack --configuration ${{ matrix.configurations }} --verbosity m --force --nologo -p:Platform=x64 -p:Version=${{ github.event.inputs.version }}
dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.EXOMIA_NUGET_API_KEY_PUSH }} --skip-duplicate
shell: bash
working-directory: src/Exomia.ECS