-
Notifications
You must be signed in to change notification settings - Fork 6
159 lines (133 loc) · 5.64 KB
/
build.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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: "Build & Test & Release"
on:
push:
pull_request:
workflow_dispatch:
jobs:
build_and_test:
name: Build & Test on ${{ matrix.OS_NAME }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
OS_NAME: win-x64
- os: ubuntu-latest
OS_NAME: linux-x64
- os: macos-latest
OS_NAME: osx-x64
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
- name: Restore Dependencies
run: dotnet restore
- name: Build Project
run: dotnet build -c Release --no-restore
- name: Test Project
run: dotnet test --configuration Release --no-build --verbosity normal --logger:"console;verbosity=normal"
- name: Pack Project
run: dotnet pack -c Release
release:
needs: build_and_test
if: (startsWith(github.event.ref, 'refs/tags/'))
name: Release
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
- name: Publish Tools
run: |
./publish.sh DxFeed.Graal.Net.Tools
./publish.sh DxFeed.Graal.Net.Tools win-x64
./publish.sh DxFeed.Graal.Net.Tools linux-x64
./publish.sh DxFeed.Graal.Net.Tools osx-x64
codesign -f -s - artifacts/Publish/osx-x64/DxFeed.Graal.Net.Tools/DxFeed.Graal.Net.Tools
./publish.sh DxFeed.Graal.Net.Tools osx-arm64
codesign -f -s - artifacts/Publish/osx-arm64/DxFeed.Graal.Net.Tools/DxFeed.Graal.Net.Tools
(cd artifacts/Publish/DxFeed.Graal.Net.Tools/ && zip DxFeed.Graal.Net.Tools-framework-dependent-${{ github.ref_name }}.zip . -r -D)
(cd artifacts/Publish/win-x64/DxFeed.Graal.Net.Tools/ && zip DxFeed.Graal.Net.Tools-self-contained-win-x64-${{ github.ref_name }}.zip . -r -D)
(cd artifacts/Publish/linux-x64/DxFeed.Graal.Net.Tools/ && zip DxFeed.Graal.Net.Tools-self-contained-linux-x64-${{ github.ref_name }}.zip . -r -D)
(cd artifacts/Publish/osx-x64/DxFeed.Graal.Net.Tools/ && zip DxFeed.Graal.Net.Tools-self-contained-osx-x64-${{ github.ref_name }}.zip . -r -D)
(cd artifacts/Publish/osx-arm64/DxFeed.Graal.Net.Tools/ && zip DxFeed.Graal.Net.Tools-self-contained-osx-arm64-${{ github.ref_name }}.zip . -r -D)
shell: bash
- name: Upload Tools
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: |
artifacts/Publish/DxFeed.Graal.Net.Tools/DxFeed.Graal.Net.Tools-framework-dependent-${{ github.ref_name }}.zip
artifacts/Publish/linux-x64/DxFeed.Graal.Net.Tools/DxFeed.Graal.Net.Tools-self-contained-linux-x64-${{ github.ref_name }}.zip
artifacts/Publish/osx-arm64/DxFeed.Graal.Net.Tools/DxFeed.Graal.Net.Tools-self-contained-osx-arm64-${{ github.ref_name }}.zip
artifacts/Publish/osx-x64/DxFeed.Graal.Net.Tools/DxFeed.Graal.Net.Tools-self-contained-osx-x64-${{ github.ref_name }}.zip
artifacts/Publish/win-x64/DxFeed.Graal.Net.Tools/DxFeed.Graal.Net.Tools-self-contained-win-x64-${{ github.ref_name }}.zip
token: ${{ secrets.GITHUB_TOKEN }}
- name: Pack NuGet
run: dotnet pack -c Release --property:PackageOutputPath=${{ github.workspace }}/artifacts/Packages
- name: Upload NuGet
run: |
nuget push artifacts/Packages/DxFeed.Graal.Net.${{ github.ref_name }}.nupkg \
-Source ${{ secrets.JFROG_PATH }}/${{ github.ref_name }} \
-ApiKey ${{ secrets.JFROG_API_KEY }}
shell: bash
build_and_upload_docs:
needs: release
if: (startsWith(github.event.ref, 'refs/tags/'))
name: Build & Upload Docs
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
- name: Restore Dependencies
run: dotnet restore
- name: Build Project
run: dotnet build -c Release --no-restore
- name: Install DocFX
run: dotnet tool update -g docfx
- name: Prepare Tag
id: prepare_tag
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "DEPLOY_TAG_NAME=deploy-${TAG_NAME}" >> "${GITHUB_OUTPUT}"
- name: Build Doc
run: ./build_doc.cmd
- name: Upload Doc
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: artifacts/Documentation
tag_name: ${{ steps.prepare_tag.outputs.DEPLOY_TAG_NAME }}
commit_message: 'deploy: ${{ github.ref_name }}'
allow_empty_commit: true
# ToDo Create a reusable workflow and extract uploading artifacts to a separate flow.
# - name: Upload DxFeed.Graal.Net.Tools
# if: github.event_name == 'workflow_dispatch'
# uses: actions/upload-artifact@v3
# with:
# name: DxFeed.Graal.Net.Tools-self-contained-${{ matrix.OS_NAME }}
# path: |
# artifacts/Publish/${{ matrix.OS_NAME }}/
#
# - name: Upload DxFeed.Graal.Net.Tools for macOS Apple Silicon
# if: github.event_name == 'workflow_dispatch' && matrix.os == 'macOS-latest'
# uses: actions/upload-artifact@v3
# with:
# name: DxFeed.Graal.Net.Tools-self-contained-osx-arm64
# path: |
# artifacts/Publish/osx-arm64