fix: generate readme should be its own ci job #527
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |