-
-
Notifications
You must be signed in to change notification settings - Fork 33
214 lines (175 loc) · 6.5 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Build + Test
on:
push:
branches:
- main
- develop
pull_request:
env:
IsForkedRepository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
DotNetVersion: '6.0.100-preview.7.21379.14'
jobs:
build:
runs-on: ubuntu-latest
outputs:
semVer2: ${{ steps.nbgv.outputs.SemVer2 }}
isPreviewRelease: ${{ startsWith(steps.nbgv.outputs.PrereleaseVersionNoLeadingHyphen, 'preview') }}
isStableRelease: ${{ steps.nbgv.outputs.PrereleaseVersionNoLeadingHyphen == '' }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'true'
- name: Setup .NET Core ${{ env.DotNetVersion }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}
- name: Install dotnet-validate
run: dotnet tool install -g dotnet-validate --version 0.0.1-preview.130
- name: Determine semantic version
uses: dotnet/nbgv@master
id: nbgv
- name: Build
run: dotnet build --configuration Release -p:ContinuousIntegrationBuild=true
- name: Validate nuget packages
run: dotnet validate package local **/ExRam.*.nupkg
- name: Copy NuGet packages to artifacts
uses: actions/upload-artifact@v2
with:
name: NuGetPackages
path: ./**/ExRam.*.nupkg
if-no-files-found: error
test-linux:
runs-on: ubuntu-latest
services:
gremlinServer:
image: tinkerpop/gremlin-server
ports:
- 8182:8182
janusgraph:
image: janusgraph/janusgraph
ports:
- 8183:8182
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'true'
- name: Setup .NET Core ${{ env.DotNetVersion }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}
- name: Test
run: dotnet test --configuration Release --verbosity normal -p:RunGremlinServerIntegrationTests=${{ env.IsForkedRepository == 'false' }} -p:RunJanusGraphIntegrationTests=${{ env.IsForkedRepository == 'false' }}
- name: Copy *.received-files to artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: test-linux-received-snapshots
path: ./**/*.received.*
test-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'true'
- name: Start CosmosDb Emulator
uses: southpolesteve/cosmos-emulator-github-action@v1
env:
AZURE_COSMOS_EMULATOR_GREMLIN_ENDPOINT: true
- name: Setup .NET Core ${{ env.DotNetVersion }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}
- name: Test
run: dotnet test --configuration Release --verbosity normal -p:RunCosmosDbEmulatorIntegrationTests=${{ env.IsForkedRepository == 'false' }}
- name: Copy *.received-files to artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: test-windows-received-snapshots
path: ./**/*.received.*
create-snapshot-fix-pr:
if: ${{ always() && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs: [ test-linux, test-windows ]
env:
pr-message: 'Fix snapshots for #${{ github.event.number }}.'
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
continue-on-error: true
with:
name: test-linux-received-snapshots
- uses: actions/download-artifact@v2
continue-on-error: true
with:
name: test-windows-received-snapshots
- name: Rename received files
run: find . -type f -name '*.received.*' | while read FILE ; do newfile="$(echo ${FILE} |sed -e 's/received/verified/')"; mv "${FILE}" "${newfile}"; done
- name: Create snapshot changes pull request
uses: peter-evans/create-pull-request@v3
with:
commit-message: ${{ env.pr-message }}
title: ${{ env.pr-message }}
body: ${{ env.pr-message }}
base: ${{ github.head_ref }}
branch-suffix: short-commit-hash
publish:
needs: [ build, test-linux, test-windows ]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
- name: Setup .NET Core ${{ env.DotNetVersion }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}
- uses: actions/download-artifact@v2
with:
name: NuGetPackages
- name: Push NuGet packages to GitHub packages
if: ${{ github.ref == 'refs/heads/develop' }}
run: dotnet nuget push **/ExRam.*.nupkg
--source https://nuget.pkg.github.com/exram/index.json
--api-key ${{ secrets.GITHUB_TOKEN }}
--no-symbols true
--skip-duplicate
- name: Push NuGet packages to NuGet.org
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget push **/ExRam.*.nupkg
--source https://api.nuget.org/v3/index.json
--api-key ${{ secrets.NUGET_DEPLOY_KEY }}
--no-symbols true
--skip-duplicate
announce:
needs: [ build, publish ]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- name: Draft release
uses: release-drafter/release-drafter@8c2bf28
with:
name: ExRam.Gremlinq ${{ needs.build.outputs.semVer2 }}
prerelease: ${{ needs.build.outputs.isPreviewRelease }}
tag: ${{ needs.build.outputs.semVer2 }}
commitish: ${{ github.ref }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Send announcement tweet!
if: ${{ needs.build.outputs.isStableRelease == 'true' }}
uses: ethomson/send-tweet-action@v1
with:
status: |
Announcing the release of ExRam.Gremlinq ${{ needs.build.outputs.semVer2 }}!
ExRam.Gremlinq is the first #dotnet object-graph-mapper for @apachetinkerpop #gremlin enabled #graphdbs like @AzureCosmosDB, #AWS #Neptune or @JanusGraph.
https://github.com/ExRam/ExRam.Gremlinq/releases/tag/${{ needs.build.outputs.semVer2 }}
consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}