Skip to content

CI

CI #1

Workflow file for this run

name: CI
on:
workflow_dispatch: {}
push:
branches:
- master
- beta
- sdk-release/**
- feature/**
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches:
- master
- beta
- sdk-release/**
- feature/**
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
7.0.404
8.0.x
- name: Install tools
run: |
dotnet tool restore
- name: Build Release
run: dotnet build src -c Release /p:ContinuousIntegrationBuild=true
- name: Build Debug
run: dotnet build src -c Debug
- uses: stripe/openapi/actions/stripe-mock@master
- name: Run test suite
run: make ci-test
- name: Run test suite (Debug)
run: make ci-test-debug
- name: Collect coverage
run: dotnet test --no-build -c Debug -f netcoreapp3.1 src/StripeTests/StripeTests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=CompilerGenerated
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
run: echo "commitBranch=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
run: echo "commitBranch=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
- name: Send code coverage report to coveralls.io
if: env.COVERALLS_REPO_TOKEN
run: |
export ARGS="--opencover \
-i src/StripeTests/coverage.netcoreapp3.1.opencover.xml \
--repoToken $COVERALLS_REPO_TOKEN \
--useRelativePaths \
--commitId $commitId \
--commitBranch $commitBranch \
--commitAuthor $commitAuthor \
--jobId $jobId"
if [ ! -z "${pullRequestId}" ];
then
export ARGS="$ARGS \
--pullRequest $pullRequestId"
fi
dotnet tool run csmacnz.Coveralls $ARGS
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
commitId: ${{ github.sha }}
commitAuthor: ${{ github.actor }}
jobId: ${{ github.run_id }}
pullRequestId: ${{ github.event.pull_request.number }}
- name: Pack
run: dotnet pack src/Stripe.net -c Release --no-build --output nuget
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: nuget
path: nuget/
compat:
name: Compat
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Run backcompat check
run: dotnet pack src/Stripe.net -p:RunBaselineCheck=true
publish:
name: Publish
if: (((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && startsWith(github.ref, 'refs/tags/v') && endsWith(github.actor, '-stripe'))
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
with:
name: nuget
path: nuget
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Publish NuGet packages to NuGet
run: dotnet nuget push nuget/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source "nuget.org"
- uses: stripe/openapi/actions/notify-release@master
if: always()
with:
bot_token: ${{ secrets.SLACK_BOT_TOKEN }}