From d2678a072288cf85cfc13572861cc0ac545df6ce Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Thu, 17 Feb 2022 13:58:52 -0800 Subject: [PATCH 1/3] feat: add GH action to update dependencies --- .github/workflows/update-dependencies.yml | 62 +++++++++++++++++++++++ Makefile | 5 +- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/update-dependencies.yml diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml new file mode 100644 index 00000000..dd2bc2fd --- /dev/null +++ b/.github/workflows/update-dependencies.yml @@ -0,0 +1,62 @@ +name: Update dependencies +on: + schedule: + # Run automatically at 7AM PST Tuesday + - cron: '0 14 * * 2' + workflow_dispatch: + +jobs: + update-dependencies-and-test: + name: Update Dependencies & Test + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + java: [ 8, 11 ] + + steps: + - name: Checkout sendgrid-java + uses: actions/checkout@v2 + + - name: Updating semver dependencies + run: make update-deps + + - name: Run Unit Tests + run: make test-docker version=${{ matrix.java }} + + commit-dependencies: + name: Commit Updated Dependencies + if: success() + needs: [ update-dependencies-and-test ] + runs-on: ubuntu-latest + steps: + - name: Checkout sendgrid-java + uses: actions/checkout@v2 + + - name: Updating semver dependencies + run: make update-deps + + - name: Add & Commit + uses: EndBug/add-and-commit@v8.0.2 + with: + add: 'pom.xml' + default_author: 'github_actions' + message: 'Chore: update sendgrid-java dependencies' + + notify-on-failure: + name: Slack notify on failure + if: failure() + needs: [ update-dependencies-and-test, commit-dependencies ] + runs-on: ubuntu-latest + steps: + - uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: failure + SLACK_ICON_EMOJI: ':github:' + SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, commit dependencies *{1}*, {2}/{3}/actions/runs/{4}', needs.update-dependencies-and-test.result, needs.commit-dependencies.result, github.server_url, github.repository, github.run_id) }} + SLACK_TITLE: Action Failure - ${{ github.repository }} + 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/Makefile b/Makefile index 5bd698c8..3983b6aa 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: install package test test-integ test-docker clean +.PHONY: install package test test-integ test-docker update-deps clean VERSION := $(shell mvn help:evaluate -Dexpression=project.version --batch-mode | grep -e '^[^\[]') install: @@ -20,5 +20,8 @@ test-docker: curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/HEAD/prism/prism-java.sh -o prism.sh version=$(version) bash ./prism.sh +update-deps: + mvn versions:use-latest-releases versions:commit -DallowMajorUpdates=false + clean: mvn clean From 1b7b8821aa76e681c6e81f6803be1df8f49a3393 Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Wed, 23 Feb 2022 18:04:11 -0800 Subject: [PATCH 2/3] combine into 1 job --- .github/workflows/update-dependencies.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index dd2bc2fd..1ab7d101 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 strategy: + max-parallel: 1 matrix: java: [ 8, 11 ] @@ -24,6 +25,14 @@ jobs: - name: Run Unit Tests run: make test-docker version=${{ matrix.java }} + - name: Add & Commit + if: matrix.java == '11' + uses: EndBug/add-and-commit@v8.0.2 + with: + add: 'pom.xml' + default_author: 'github_actions' + message: 'chore: update sendgrid-java dependencies' + commit-dependencies: name: Commit Updated Dependencies if: success() @@ -36,24 +45,17 @@ jobs: - name: Updating semver dependencies run: make update-deps - - name: Add & Commit - uses: EndBug/add-and-commit@v8.0.2 - with: - add: 'pom.xml' - default_author: 'github_actions' - message: 'Chore: update sendgrid-java dependencies' - notify-on-failure: name: Slack notify on failure if: failure() - needs: [ update-dependencies-and-test, commit-dependencies ] + needs: [ update-dependencies-and-test ] runs-on: ubuntu-latest steps: - uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: failure SLACK_ICON_EMOJI: ':github:' - SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, commit dependencies *{1}*, {2}/{3}/actions/runs/{4}', needs.update-dependencies-and-test.result, needs.commit-dependencies.result, github.server_url, github.repository, github.run_id) }} + SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, {2}/{3}/actions/runs/{4}', needs.update-dependencies-and-test.result, github.server_url, github.repository, github.run_id) }} SLACK_TITLE: Action Failure - ${{ github.repository }} SLACK_USERNAME: GitHub Actions SLACK_MSG_AUTHOR: twilio-dx From 5d4dbd71986dc4a545a434af719ed48698fa51fe Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Thu, 24 Feb 2022 10:36:42 -0800 Subject: [PATCH 3/3] fix slack message indices and remove commit-dependencies --- .github/workflows/update-dependencies.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 1ab7d101..d2e4152c 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -33,18 +33,6 @@ jobs: default_author: 'github_actions' message: 'chore: update sendgrid-java dependencies' - commit-dependencies: - name: Commit Updated Dependencies - if: success() - needs: [ update-dependencies-and-test ] - runs-on: ubuntu-latest - steps: - - name: Checkout sendgrid-java - uses: actions/checkout@v2 - - - name: Updating semver dependencies - run: make update-deps - notify-on-failure: name: Slack notify on failure if: failure() @@ -55,7 +43,7 @@ jobs: env: SLACK_COLOR: failure SLACK_ICON_EMOJI: ':github:' - SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, {2}/{3}/actions/runs/{4}', needs.update-dependencies-and-test.result, github.server_url, github.repository, github.run_id) }} + SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, {1}/{2}/actions/runs/{3}', needs.update-dependencies-and-test.result, github.server_url, github.repository, github.run_id) }} SLACK_TITLE: Action Failure - ${{ github.repository }} SLACK_USERNAME: GitHub Actions SLACK_MSG_AUTHOR: twilio-dx