From c6113f558ed6e6bcbddd121d1cb56954e78b02c9 Mon Sep 17 00:00:00 2001 From: Elise Shanholtz Date: Fri, 19 Nov 2021 12:00:28 -0800 Subject: [PATCH 1/6] chore: migrate to GitHub Actions --- .github/workflows/deploy.yml | 42 ++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 46 ++++++++++++++++++++++++++++++++++++ .travis.yml | 21 ---------------- README.md | 2 +- 4 files changed, 89 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..fb07b9c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,42 @@ +name: Deploy +on: + push: + tags: + - '*' + workflow_dispatch: + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + steps: + - name: Checkout sendgrid-csharp + 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: [ deploy ] + runs-on: ubuntu-latest + steps: + - uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: 'danger' + SLACK_ICON_EMOJI: ':github:' + SLACK_MESSAGE: ${{ format('Failed to deploy {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} + SLACK_TITLE: Deployment 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..4a955d1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,46 @@ +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: + - name: Checkout csharp-http-client + uses: actions/checkout@v2 + + - 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) From 4925b5962942069c03227ade7f30de2462569e05 Mon Sep 17 00:00:00 2001 From: Elise Shanholtz Date: Fri, 19 Nov 2021 13:53:37 -0800 Subject: [PATCH 2/6] names --- .github/workflows/deploy.yml | 1 - .github/workflows/test.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fb07b9c..b5e06f8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,6 @@ jobs: name: Deploy runs-on: ubuntu-latest steps: - - name: Checkout sendgrid-csharp uses: actions/checkout@v2 - name: Setup .NET Core SDK diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4a955d1..f622286 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 steps: - - name: Checkout csharp-http-client uses: actions/checkout@v2 - name: Setup .NET Core SDK From 6e4782080f51c51242caafd1c3213ed4598afcd3 Mon Sep 17 00:00:00 2001 From: Elise Shanholtz Date: Fri, 19 Nov 2021 14:03:07 -0800 Subject: [PATCH 3/6] syntax --- .github/workflows/deploy.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b5e06f8..5ab17f0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,7 @@ jobs: name: Deploy runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - name: Setup .NET Core SDK uses: actions/setup-dotnet@v1.8.2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f622286..1e0c46d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - name: Setup .NET Core SDK uses: actions/setup-dotnet@v1.8.2 From e0fc7edbf20ca1846ed12b16adbbc5d7fa43e643 Mon Sep 17 00:00:00 2001 From: Elise Shanholtz Date: Fri, 19 Nov 2021 14:52:15 -0800 Subject: [PATCH 4/6] fix fetch depth --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e0c46d..64178ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,8 @@ jobs: timeout-minutes: 20 steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Setup .NET Core SDK uses: actions/setup-dotnet@v1.8.2 From fc2abe198d46b10ad1b54b9e7dd7d7f4bbfd194d Mon Sep 17 00:00:00 2001 From: Elise Shanholtz Date: Fri, 19 Nov 2021 15:42:12 -0800 Subject: [PATCH 5/6] rename --- .github/workflows/{deploy.yml => release.yml} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename .github/workflows/{deploy.yml => release.yml} (78%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/release.yml similarity index 78% rename from .github/workflows/deploy.yml rename to .github/workflows/release.yml index 5ab17f0..ae2b41e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Deploy +name: Release on: push: tags: @@ -6,8 +6,8 @@ on: workflow_dispatch: jobs: - deploy: - name: Deploy + release: + name: Release runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -25,15 +25,15 @@ jobs: notify-on-failure: name: Slack notify on failure if: ${{ failure() }} - needs: [ deploy ] + 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 deploy {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} - SLACK_TITLE: Deployment Failure + 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 From 93b415a4448206f494b73d38dc4f3c8f2365a1a8 Mon Sep 17 00:00:00 2001 From: Elise Shanholtz Date: Mon, 22 Nov 2021 10:13:05 -0800 Subject: [PATCH 6/6] remove travis file check --- UnitTest/RequiredFilesExistTest.cs | 5 ----- 1 file changed, 5 deletions(-) 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"));