-
Notifications
You must be signed in to change notification settings - Fork 8
108 lines (90 loc) · 3.38 KB
/
build.yaml
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
name: On pull request
on:
pull_request:
branches: [main]
jobs:
build_csharp:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
target-framework: [net6.0]
grpc-web: [false, true]
include:
- os: windows-latest
target-framework: net462
grpc-web: false
- os: windows-latest
target-framework: net462
grpc-web: true
runs-on: ${{ matrix.os }}
env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
steps:
- name: Get current time
uses: gerred/actions/current-time@master
id: current-time
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
- name: Verify README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: stable
project_type: sdk
sdk_language: .NET
template_file: ./README.template.md
output_file: ./README.md
dev_docs_slug: dotnet
- name: Commitlint and Other Shared Build Steps
uses: momentohq/standards-and-practices/github-actions/shared-build@gh-actions-v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: dotnet build ${{ matrix.grpc-web && '-p:DefineConstants=USE_GRPC_WEB' || '' }}
- name: Unit Test
run: dotnet test --logger "console;verbosity=detailed" -f ${{ matrix.target-framework }} tests/Unit/Momento.Sdk.Tests
- name: Integration Test
run: dotnet test --logger "console;verbosity=detailed" -f ${{ matrix.target-framework }} tests/Integration/Momento.Sdk.Tests
build_examples:
runs-on: ubuntu-latest
env:
# TODO: remove token stored as secret in favor of using a
# momento-local instance that can be spun up for testing
MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
steps:
- name: Setup repo
uses: actions/checkout@v2
- name: Set up dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
- name: Run MomentoApplication example
id: validation-momentoapplication
continue-on-error: true
working-directory: ./examples/MomentoApplication
run: dotnet run
- name: Run doc API snippets
id: validation-docexampleapis
continue-on-error: true
working-directory: ./examples/DocExampleApis
run: dotnet run
- name: Test example failure
id: test-example-failure
run: |
if [[ "${{ steps.validation-momentoapplication.outcome }}" == "failure" || "${{ steps.validation-docexampleapis.outcome }}" == "failure" ]]
then
echo "failure=true" >> $GITHUB_OUTPUT
else
echo "failure=false" >> $GITHUB_OUTPUT
fi
- name: Send CI failure mail
if: ${{ steps.test-example-failure.outputs.failure == 'true' }}
uses: momentohq/standards-and-practices/github-actions/error-email-action@gh-actions-v1
with:
username: ${{secrets.MOMENTO_ROBOT_GMAIL_USERNAME}}
password: ${{secrets.MOMENTO_ROBOT_GMAIL_PASSWORD}}
- name: Flag Job Failure
if: ${{ steps.test-example-failure.outputs.failure == 'true' }}
run: exit 1