Skip to content

Commit 6cff022

Browse files
committed
[build] add package verification to release workflow
1 parent db53a72 commit 6cff022

2 files changed

Lines changed: 24 additions & 50 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ jobs:
116116
run: ./go ${{ matrix.language }}:release
117117
secrets: inherit
118118

119+
verify:
120+
name: Verify Published Packages
121+
needs: docs
122+
uses: ./.github/workflows/bazel.yml
123+
with:
124+
name: Verify packages
125+
run: ./go all:verify
126+
119127
docs:
120128
name: Update ${{ matrix.language }} Documentation
121129
needs: [stage, publish, github-release]
@@ -150,7 +158,7 @@ jobs:
150158

151159
unrestrict-trunk:
152160
name: Unrestrict Trunk Branch
153-
needs: [github-release]
161+
needs: verify
154162
uses: ./.github/workflows/restrict-trunk.yml
155163
with:
156164
restrict: false
@@ -198,7 +206,7 @@ jobs:
198206
on-release-failure:
199207
name: On Release Failure
200208
runs-on: ubuntu-latest
201-
needs: [stage, publish, docs, github-release, update-version, nightly, mirror]
209+
needs: [stage, publish, docs, github-release, update-version, nightly, mirror, verify]
202210
if: failure()
203211
steps:
204212
- uses: actions/checkout@v4
@@ -217,5 +225,6 @@ jobs:
217225
• Nightly Version Updated: ${{ needs.update-version.result }}
218226
• Nightly Packages: ${{ needs.nightly.result }}
219227
• Mirror Updated: ${{ needs.mirror.result }}
228+
• Packages Verified: ${{ needs.verify.result }}
220229
MSG_MINIMAL: actions url
221230
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}

Rakefile

Lines changed: 13 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -396,24 +396,14 @@ RELEASE_CREDENTIALS = {
396396
dotnet_nightly: {env: [%w[GITHUB_TOKEN]]}
397397
}.freeze
398398

399-
def package_published?(url, max_attempts: 12, delay: 10)
399+
def verify_package_published(url)
400400
puts "Verifying #{url}..."
401401
uri = URI(url)
402-
max_attempts.times do |attempt|
403-
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https',
404-
open_timeout: 10, read_timeout: 10) { |http| http.request(Net::HTTP::Get.new(uri)) }
405-
if res.is_a?(Net::HTTPSuccess)
406-
puts 'Verified!'
407-
return true
408-
end
409-
puts "Not yet indexed, waiting... (#{attempt + 1}/#{max_attempts})"
410-
sleep(delay)
411-
rescue StandardError => e
412-
warn "Error: #{e.message}"
413-
sleep(delay) unless attempt == max_attempts - 1
414-
end
415-
warn "Not found after #{max_attempts * delay}s"
416-
false
402+
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https',
403+
open_timeout: 10, read_timeout: 10) { |http| http.request(Net::HTTP::Get.new(uri)) }
404+
raise "Package not published: #{url}" unless res.is_a?(Net::HTTPSuccess)
405+
406+
puts 'Verified!'
417407
end
418408

419409
def sonatype_api_post(url, token)
@@ -632,15 +622,11 @@ namespace :node do
632622

633623
puts 'Running Node package release...'
634624
Bazel.execute('run', ['--config=release'], '//javascript/selenium-webdriver:selenium-webdriver.publish')
635-
636-
Rake::Task['node:verify'].invoke unless nightly
637625
end
638626

639627
desc 'Verify Node package is published on npm'
640628
task :verify do
641-
package_published?(
642-
"https://registry.npmjs.org/selenium-webdriver/#{node_version}"
643-
) || warn('npm verification failed - package may still be indexing')
629+
verify_package_published("https://registry.npmjs.org/selenium-webdriver/#{node_version}")
644630
end
645631

646632
task deploy: :release
@@ -706,15 +692,11 @@ namespace :py do
706692
command = nightly ? '//py:selenium-release-nightly' : '//py:selenium-release'
707693
puts "Running Python release command: #{command}"
708694
Bazel.execute('run', ['--config=release'], command)
709-
710-
Rake::Task['py:verify'].invoke unless nightly
711695
end
712696

713697
desc 'Verify Python package is published on PyPI'
714698
task :verify do
715-
package_published?(
716-
"https://pypi.org/pypi/selenium/#{python_version}/json"
717-
) || warn('PyPI verification failed - package may still be indexing')
699+
verify_package_published("https://pypi.org/pypi/selenium/#{python_version}/json")
718700
end
719701

720702
desc 'generate and copy files required for local development'
@@ -916,22 +898,16 @@ namespace :rb do
916898
puts 'Releasing Ruby gems...'
917899
Bazel.execute('run', ['--config=release'], '//rb:selenium-webdriver-release')
918900
Bazel.execute('run', ['--config=release'], '//rb:selenium-devtools-release') unless patch_release
919-
920-
Rake::Task['rb:verify'].invoke
921901
end
922902
end
923903

924904
desc 'Verify Ruby packages are published on RubyGems'
925905
task :verify do
926906
patch_release = ruby_version.split('.').fetch(2, '0').to_i.positive?
927907

928-
package_published?(
929-
"https://rubygems.org/api/v2/rubygems/selenium-webdriver/versions/#{ruby_version}.json"
930-
) || warn('RubyGems verification failed - selenium-webdriver may still be indexing')
908+
verify_package_published("https://rubygems.org/api/v2/rubygems/selenium-webdriver/versions/#{ruby_version}.json")
931909
unless patch_release
932-
package_published?(
933-
"https://rubygems.org/api/v2/rubygems/selenium-devtools/versions/#{ruby_version}.json"
934-
) || warn('RubyGems verification failed - selenium-devtools may still be indexing')
910+
verify_package_published("https://rubygems.org/api/v2/rubygems/selenium-devtools/versions/#{ruby_version}.json")
935911
end
936912
end
937913

@@ -1090,18 +1066,12 @@ namespace :dotnet do
10901066

10911067
puts "Pushing .NET packages to #{ENV.fetch('NUGET_SOURCE', nil)}..."
10921068
Bazel.execute('run', ['--config=release'], '//dotnet:publish')
1093-
1094-
Rake::Task['dotnet:verify'].invoke unless nightly
10951069
end
10961070

10971071
desc 'Verify .NET packages are published on NuGet'
10981072
task :verify do
1099-
package_published?(
1100-
"https://api.nuget.org/v3/registration5-semver1/selenium.webdriver/#{dotnet_version}.json"
1101-
) || warn('NuGet verification failed - Selenium.WebDriver may still be indexing')
1102-
package_published?(
1103-
"https://api.nuget.org/v3/registration5-semver1/selenium.support/#{dotnet_version}.json"
1104-
) || warn('NuGet verification failed - Selenium.Support may still be indexing')
1073+
verify_package_published("https://api.nuget.org/v3/registration5-semver1/selenium.webdriver/#{dotnet_version}.json")
1074+
verify_package_published("https://api.nuget.org/v3/registration5-semver1/selenium.support/#{dotnet_version}.json")
11051075
end
11061076

11071077
desc 'Generate .NET documentation'
@@ -1282,16 +1252,11 @@ namespace :java do
12821252
puts 'Publishing deployed packages...'
12831253
sonatype_api_post("https://central.sonatype.com/api/v1/publisher/deployment/#{encoded_id}", token)
12841254
puts "Published! Deployment ID: #{deployment_id}"
1285-
1286-
Rake::Task['java:verify'].invoke
12871255
end
12881256

12891257
desc 'Verify Java packages are published on Maven Central'
12901258
task :verify do
1291-
package_published?(
1292-
"https://repo1.maven.org/maven2/org/seleniumhq/selenium/selenium-java/#{java_version}/selenium-java-#{java_version}.pom",
1293-
max_attempts: 30, delay: 60
1294-
) || warn('Maven Central verification failed - may still be syncing')
1259+
verify_package_published("https://repo1.maven.org/maven2/org/seleniumhq/selenium/selenium-java/#{java_version}/selenium-java-#{java_version}.pom")
12951260
end
12961261

12971262
desc 'Install jars to local m2 directory'

0 commit comments

Comments
 (0)