From ad8b8aeb467aaf7ab816501af1ff27f1d4ff93fd Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Thu, 17 Feb 2022 14:03:49 -0800 Subject: [PATCH 1/6] feat: add GH action to update dependencies --- .github/workflows/update_dependencies.yml | 67 +++++++++++++++++++++++ Makefile | 5 +- 2 files changed, 71 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 0000000..47c3332 --- /dev/null +++ b/.github/workflows/update_dependencies.yml @@ -0,0 +1,67 @@ +name: Update dependencies +on: + schedule: + # Run automatically at 6AM PST Tuesday + - cron: '0 6 * * 2' + workflow_dispatch: + +jobs: + update_dependencies: + name: Update Dependencies + runs-on: ubuntu-latest + steps: + - name: Checkout java-http-client + 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' + + test: + name: Test + if: success() + needs: [ update_dependencies ] + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + java: [ 8, 11, 17 ] + + steps: + - name: Checkout java-http-client + uses: actions/checkout@v2 + + - name: Set up Java + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + cache: 'maven' + + - run: mvn install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V + - name: Run Unit Tests + run: mvn test -B + + notify-on-failure: + name: Slack notify on failure + if: failure() + needs: [ update_dependencies, 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}*, Test *{1}*, {2}/{3}/actions/runs/{4}', needs.update_dependencies.result, needs.tests.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 3d76197..851986a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: install package test test-integration clean +.PHONY: install package test update-deps test-integration clean VERSION := $(shell mvn help:evaluate -Dexpression=project.version --batch-mode | grep -e '^[^\[]') install: @@ -13,5 +13,8 @@ package: test: mvn test +update-deps: + mvn versions:use-latest-releases versions:commit -DallowMajorUpdates=false + clean: mvn clean From 9fde84c258b9c560a543bf12ea9c5cbdca55cc4e Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Tue, 22 Feb 2022 14:13:16 -0800 Subject: [PATCH 2/6] update workflow jobs --- .github/workflows/update_dependencies.yml | 53 ++++++++++++----------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/.github/workflows/update_dependencies.yml b/.github/workflows/update_dependencies.yml index 47c3332..4eee94d 100644 --- a/.github/workflows/update_dependencies.yml +++ b/.github/workflows/update_dependencies.yml @@ -6,27 +6,8 @@ on: workflow_dispatch: jobs: - update_dependencies: - name: Update Dependencies - runs-on: ubuntu-latest - steps: - - name: Checkout java-http-client - 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' - - test: - name: Test - if: success() - needs: [ update_dependencies ] + update_dependencies_and_test: + name: Update Dependencies & Test runs-on: ubuntu-latest timeout-minutes: 20 strategy: @@ -37,6 +18,9 @@ jobs: - name: Checkout java-http-client uses: actions/checkout@v2 + - name: Updating semver dependencies + run: make update-deps + - name: Set up Java uses: actions/setup-java@v2 with: @@ -44,21 +28,38 @@ jobs: java-version: ${{ matrix.java }} cache: 'maven' - - run: mvn install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V - - name: Run Unit Tests - run: mvn test -B + - run: mvn install -Dgpg.skip -Dmaven.javadoc.skip=true -B -V + + commit_dependencies: + name: Commit Updated Dependencies + if: success() + needs: [ update_dependencies_and_test ] + runs-on: ubuntu-latest + steps: + - name: Checkout java-http-client + 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, test ] + 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}*, Test *{1}*, {2}/{3}/actions/runs/{4}', needs.update_dependencies.result, needs.tests.result, github.server_url, github.repository, github.run_id) }} + 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 From 89ad7777ea974ef318c9a181508ce85cee0d0ac0 Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Tue, 22 Feb 2022 14:50:52 -0800 Subject: [PATCH 3/6] kebab-case names and fix commit message --- ..._dependencies.yml => update-dependencies.yml} | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename .github/workflows/{update_dependencies.yml => update-dependencies.yml} (82%) diff --git a/.github/workflows/update_dependencies.yml b/.github/workflows/update-dependencies.yml similarity index 82% rename from .github/workflows/update_dependencies.yml rename to .github/workflows/update-dependencies.yml index 4eee94d..e8e7261 100644 --- a/.github/workflows/update_dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -1,12 +1,12 @@ name: Update dependencies on: schedule: - # Run automatically at 6AM PST Tuesday - - cron: '0 6 * * 2' + # Run automatically at 7AM PST Tuesday + - cron: '0 14 * * 2' workflow_dispatch: jobs: - update_dependencies_and_test: + update-dependencies-and-test: name: Update Dependencies & Test runs-on: ubuntu-latest timeout-minutes: 20 @@ -30,10 +30,10 @@ jobs: - run: mvn install -Dgpg.skip -Dmaven.javadoc.skip=true -B -V - commit_dependencies: + commit-dependencies: name: Commit Updated Dependencies if: success() - needs: [ update_dependencies_and_test ] + needs: [ update-dependencies-and-test ] runs-on: ubuntu-latest steps: - name: Checkout java-http-client @@ -47,19 +47,19 @@ jobs: with: add: 'pom.xml' default_author: 'github_actions' - message: 'Chore: update sendgrid-java dependencies' + message: 'chore: update java-http-client dependencies' notify-on-failure: name: Slack notify on failure if: failure() - needs: [ update_dependencies_and_test, commit_dependencies ] + 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_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 From 3b0a97072e62925b3dbaa53d70867ab4c5868605 Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Wed, 23 Feb 2022 18:22:28 -0800 Subject: [PATCH 4/6] combine into 1 job --- .github/workflows/update-dependencies.yml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index e8e7261..2fead86 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, 17 ] @@ -30,19 +31,8 @@ jobs: - run: mvn install -Dgpg.skip -Dmaven.javadoc.skip=true -B -V - commit-dependencies: - name: Commit Updated Dependencies - if: success() - needs: [ update-dependencies-and-test ] - runs-on: ubuntu-latest - steps: - - name: Checkout java-http-client - uses: actions/checkout@v2 - - - name: Updating semver dependencies - run: make update-deps - - name: Add & Commit + if: matrix.java == '17' uses: EndBug/add-and-commit@v8.0.2 with: add: 'pom.xml' @@ -52,14 +42,14 @@ jobs: 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 cff7e38a69a9d6b223444367df63d2e55a98680f Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Thu, 24 Feb 2022 10:35:25 -0800 Subject: [PATCH 5/6] fix slack message indices --- .github/workflows/update-dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 2fead86..7976bab 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -49,7 +49,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 From 72987467de99293df453635ae876feb5c70e8b84 Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Thu, 24 Feb 2022 11:35:53 -0800 Subject: [PATCH 6/6] move updating deps after java is setup --- .github/workflows/update-dependencies.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 7976bab..0dd69a7 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -19,9 +19,6 @@ jobs: - name: Checkout java-http-client uses: actions/checkout@v2 - - name: Updating semver dependencies - run: make update-deps - - name: Set up Java uses: actions/setup-java@v2 with: @@ -29,6 +26,9 @@ jobs: java-version: ${{ matrix.java }} cache: 'maven' + - name: Updating semver dependencies + run: make update-deps + - run: mvn install -Dgpg.skip -Dmaven.javadoc.skip=true -B -V - name: Add & Commit