diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ae2b41e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release +on: + push: + tags: + - '*' + workflow_dispatch: + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v1.8.2 + with: + dotnet-version: '3.1.x' + + - name: Publish package to NuGet + run: | + make install + dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json + + notify-on-failure: + name: Slack notify on failure + if: ${{ failure() }} + needs: [ release ] + runs-on: ubuntu-latest + steps: + - uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: 'danger' + SLACK_ICON_EMOJI: ':github:' + SLACK_MESSAGE: ${{ format('Failed to release {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} + SLACK_TITLE: Release Failure + SLACK_USERNAME: GitHub Actions + SLACK_MSG_AUTHOR: twilio-dx + SLACK_FOOTER: Posted automatically using GitHub Actions + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + MSG_MINIMAL: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..64178ca --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,47 @@ +name: Tests +on: + push: + branches: [ '*' ] + pull_request: + branches: [ main ] + schedule: + # Run automatically at 8AM PST Monday-Friday + - cron: '0 15 * * 1-5' + workflow_dispatch: + +jobs: + tests: + name: Run Tests + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v1.8.2 + with: + dotnet-version: '3.1.x' + + - name: Build & Test + run: make test + - run: bash <(curl -s https://codecov.io/bash) + + notify-on-failure: + name: Slack notify on failure + if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} + needs: [ tests ] + runs-on: ubuntu-latest + steps: + - uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: 'danger' + SLACK_ICON_EMOJI: ':github:' + SLACK_MESSAGE: ${{ format('Failed running build on {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} + SLACK_TITLE: Build Failure + SLACK_USERNAME: GitHub Actions + SLACK_MSG_AUTHOR: twilio-dx + SLACK_FOOTER: Posted automatically using GitHub Actions + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + MSG_MINIMAL: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 23299a3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: csharp -script: -- make test -after_success: -- bash <(curl -s https://codecov.io/bash) -deploy: - skip_cleanup: true - provider: script - script: nuget push /home/travis/build/sendgrid/csharp-http-client/*.nupkg -ApiKey - $NUGET_API_KEY -Source https://api.nuget.org/v3/index.json - on: - branch: main - tags: true -notifications: - slack: - if: branch = main - on_pull_requests: false - on_success: never - on_failure: change - rooms: - secure: orpGfECBe6dSCCkitAIr7uoOYD/XAJnnWaPtOmMF42EO18KwuU1TCGVk3TpIlbEAU8e+iLc9lXdkSXmr5+aV4825fcux+OQ8LlRUWS88Xw37gS6JAj8HC5a0zUByt3+qmz5yW948nMs+iK2lPxTyymtOfMl89sYgbRYeGOH6zK37uHJXJtgD5QLgmNmmEXYWAxIMGzu0J9ZJyn5svLCd5+9CejAghR/NDP7E7ioca1CvDPB7HLQrRyvB0HBzS/ad/+PCciIg23scZFlMXdcE1Dqhgn8z6qyixw2sXjhu2fBOJy+kZIiDi4ZxbzCw3MMlcT98n7CSB/rEkAJgUBA4oeF6i9tjQt/JSEXwvQGi3cRfS79jtUePKeZFZOSYbq8sD4cFgA1vnRxAZ0jDB2yw2i+YVMSOrEig35KbV4H/SeQIgU64g3Rd7RQncemCcBi1TntBf4J7KO0wvmB1gGifL4MNCvdU0ZV2CHJ+O71l1xO4t91QWmTp5mFW1XF7SK0iL78mI8rG0bgfSSP2NTjWac7xLtoQBVrRK99HN988cYwM8cv3UwRBzYSrtQBEKWlDVr/sJRoRRHjYVPNhaNYVG8toxnoq1BzGuGtfjIMzctiFdIZRKOCutJZnvJ8nycaieWEmcJtFdxQsIXxYx1r6NgBV4C7v7jjIYsPtxKUpxR8= diff --git a/README.md b/README.md index c09781a..ef2a3b1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![SendGrid Logo](twilio_sendgrid_logo.png) -[![Travis Badge](https://travis-ci.com/sendgrid/csharp-http-client.svg?branch=main)](https://travis-ci.com/sendgrid/csharp-http-client) +[![BuildStatus](https://github.com/sendgrid/csharp-http-client/actions/workflows/test.yml/badge.svg)](https://github.com/sendgrid/csharp-http-client/actions/workflows/test.yml) [![NuGet](https://img.shields.io/nuget/v/SendGrid.CSharp.Http.Client.svg)](https://www.nuget.org/packages/SendGrid.CSharp.HTTP.Client) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid) diff --git a/UnitTest/RequiredFilesExistTest.cs b/UnitTest/RequiredFilesExistTest.cs index 6433676..dbe963a 100644 --- a/UnitTest/RequiredFilesExistTest.cs +++ b/UnitTest/RequiredFilesExistTest.cs @@ -27,11 +27,6 @@ public void checkGitIgnoreExists() { Assert.True(File.Exists("./.gitignore")); } - // ./.travis.yml - public void checkTravisExists() { - Assert.True(File.Exists("./.travis.yml")); - } - // ./.codeclimate.yml public void checkCodeClimateExists() { Assert.True(File.Exists("./.codeclimate.yml"));