From 91453a1ee505136ec178a35b67ff7e3323b11d48 Mon Sep 17 00:00:00 2001 From: Aaron Lu <50029043+aalu1418@users.noreply.github.com> Date: Wed, 14 Feb 2024 07:13:28 -0700 Subject: [PATCH] feat: workflow for bumping solana e2e test image (#575) * workflow for bumping solana image * update commit author + PR body * disable on push, enable cron * PR deduplication * trigger re-run * remove on push * add bumping to relayer test CI install --- .github/workflows/dependency-updates.yml | 41 ++++++++++++++++++++++++ Makefile | 6 +++- scripts/update-solana.sh | 35 ++++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/dependency-updates.yml create mode 100755 scripts/update-solana.sh diff --git a/.github/workflows/dependency-updates.yml b/.github/workflows/dependency-updates.yml new file mode 100644 index 000000000..63e523c1b --- /dev/null +++ b/.github/workflows/dependency-updates.yml @@ -0,0 +1,41 @@ +name: DependencyUpdater +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' # check every day at midnight UTC + +jobs: + E2E-Solana-Image: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 # checkout branch that it is called from + - name: Check for solana image updates + id: solImage + run: | + make upgrade-e2e-solana-image + image=$(curl https://api.github.com/repos/solana-labs/solana/releases/latest | jq -r '.tag_name') + echo "image=$image" >> "$GITHUB_OUTPUT" + - name: Check if PR exists + id: check + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --head "bump/solana-${{ steps.solImage.outputs.image }}" \ + --json title \ + --jq 'length') + if ((prs > 0)); then + echo "skip=true" >> "$GITHUB_OUTPUT" + fi + - name: Create pull request + if: '!steps.check.outputs.skip' + uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 # v6.0.0 + with: + title: "[automated] bump solana image to ${{ steps.solImage.outputs.image }}" + branch: bump/solana-${{ steps.solImage.outputs.image }} + author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" + reviewers: aalu1418 + commit-message: "[automated] bump solana dependencies" + body: "Latest Solana mainnet release is [\"${{ steps.solImage.outputs.image }}\"](https://github.com/solana-labs/solana/releases/latest)" + diff --git a/Makefile b/Makefile index 4df0e3b92..29411da0c 100644 --- a/Makefile +++ b/Makefile @@ -98,4 +98,8 @@ lint-go-integration-tests: .PHONY: lint-go-relay lint-go-relay: - cd ./pkg && golangci-lint --color=always --exclude=dot-imports --timeout 10m --out-format checkstyle:golangci-lint-relay-report.xml run || true \ No newline at end of file + cd ./pkg && golangci-lint --color=always --exclude=dot-imports --timeout 10m --out-format checkstyle:golangci-lint-relay-report.xml run || true + +.PHONY: upgrade-e2e-solana-image +upgrade-e2e-solana-image: + ./scripts/update-solana.sh diff --git a/scripts/update-solana.sh b/scripts/update-solana.sh new file mode 100755 index 000000000..09c9124ae --- /dev/null +++ b/scripts/update-solana.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -e + +cliVersion=$(grep -oh "release.solana.com/v[0-9]*.[0-9]*.[0-9]*" scripts/install-solana-ci.sh) +echo "Current Test CLI Version: $cliVersion" + +cd integration-tests +testVersion=$(grep -oh "solanalabs/solana:v[0-9]*.[0-9]*.[0-9]*" */**/*.go) +echo "Current E2E Test Version: $testVersion" +cd .. + +latestTag=$(curl https://api.github.com/repos/solana-labs/solana/releases/latest | jq -r '.tag_name') +latestVersion="solanalabs/solana:$latestTag" +latestCLI="release.solana.com/$latestTag" +echo "Latest Solana Mainnet Version: $latestTag" + +if [ "$testVersion" = "$latestVersion" ] && [ "$cliVersion" = "$latestCLI" ] ; then + echo "Solana Versions Are Up To Date" + exit 0 +fi + +echo "Replacing Solana Image Version" + +if [ "$(uname -s)" = "Darwin" ]; then + sed -i '' -e "s~$cliVersion~$latestCLI~" scripts/install-solana-ci.sh + cd integration-tests + sed -i '' -e "s~$testVersion~$latestVersion~" */**/*.go +else + sed -i -e "s~$cliVersion~$latestCLI~" scripts/install-solana-ci.sh + cd integration-tests + sed -i -e "s~$testVersion~$latestVersion~" */**/*.go +fi +cd .. + +echo "Done"