Skip to content

Commit f0b5a04

Browse files
authored
Nightly dotnet (#13838)
* [dotnet] Changes for nightly in dotnet * [dotnet] Fixing copy & paste error * [dotnet] Debugging * [dotnet] Installing dotnet only for this * [dotnet] Setting up dotnet with actions * [dotnet] Fixing typo * [dotnet] Fixing typo (2) * [dotnet] Uncommenting
1 parent 54829c7 commit f0b5a04

File tree

4 files changed

+68
-8
lines changed

4 files changed

+68
-8
lines changed

.github/workflows/bazel.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ on:
3636
required: false
3737
type: string
3838
default: ''
39+
dotnet-version:
40+
description: Custom DotNet version to install
41+
required: false
42+
type: string
43+
default: ''
3944
java-version:
4045
description: Custom Java version to install
4146
required: false
@@ -87,6 +92,11 @@ jobs:
8792
- name: Set Ruby version
8893
if: inputs.ruby-version != ''
8994
run: echo '${{ inputs.ruby-version }}' > rb/.ruby-version
95+
- name: Setup DotNet
96+
if: inputs.dotnet-version != ''
97+
uses: actions/setup-dotnet@v4
98+
with:
99+
dotnet-version: ${{ inputs.dotnet-version }}
90100
- name: Setup Java
91101
if: inputs.java-version != ''
92102
uses: actions/setup-java@v3

.github/workflows/nightly.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on:
1919
- ruby
2020
- python
2121
- grid
22+
- dotnet
2223

2324
jobs:
2425
ruby:
@@ -31,7 +32,7 @@ jobs:
3132
gem:
3233
- selenium-webdriver
3334
with:
34-
name: Release
35+
name: Nightly Ruby Release
3536
cache-key: rb-nightly-${{ matrix.gem }}
3637
run: |
3738
export GEM_HOST_API_KEY="Bearer $GITHUB_TOKEN"
@@ -43,7 +44,7 @@ jobs:
4344
name: Python
4445
uses: ./.github/workflows/bazel.yml
4546
with:
46-
name: Release
47+
name: Nightly Python Release
4748
cache-key: python-nightly
4849
run: |
4950
./go "py:version[nightly]"
@@ -58,18 +59,31 @@ jobs:
5859
name: Java
5960
uses: ./.github/workflows/bazel.yml
6061
with:
61-
name: Release
62+
name: Nightly Java Release
6263
cache-key: java-nightly
6364
run: |
6465
./go publish-maven-snapshot
6566
secrets: inherit
6667

68+
dotnet:
69+
if: (github.repository_owner == 'seleniumhq') && (inputs.language == 'dotnet' || github.event_name == 'schedule')
70+
name: DotNet
71+
uses: ./.github/workflows/bazel.yml
72+
with:
73+
name: Nightly DotNet Release
74+
cache-key: dotnet-nightly
75+
dotnet-version: '6.x'
76+
run: |
77+
./go "dotnet:version[nightly]"
78+
./go dotnet:release
79+
secrets: inherit
80+
6781
grid:
6882
if: (github.repository_owner == 'seleniumhq') && (inputs.language == 'grid' || github.event_name == 'schedule')
6983
name: Grid
7084
uses: ./.github/workflows/bazel.yml
7185
with:
72-
name: Release
86+
name: Nightly Grid Release
7387
cache-key: grid-nightly
7488
run: |
7589
echo build --stamp >>.bazelrc.local

Rakefile

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,9 +811,21 @@ namespace :dotnet do
811811
Rake::Task['dotnet:build'].invoke(args)
812812
Rake::Task['dotnet:zip_assets'].invoke(args)
813813

814+
release_version = dotnet_version
815+
api_key = ENV.fetch('NUGET_API_KEY', nil)
816+
push_destination = 'https://api.nuget.org/v3/index.json'
817+
if release_version.include?('-nightly')
818+
# Nightly builds are pushed to GitHub NuGet repository
819+
# This commands will run in GitHub Actions
820+
api_key = ENV.fetch('GITHUB_TOKEN', nil)
821+
github_push_url = 'https://nuget.pkg.github.com/seleniumhq/index.json'
822+
push_destination = 'github'
823+
sh "dotnet nuget add source --username seleniumhq --password #{api_key} --store-password-in-clear-text --name #{push_destination} #{github_push_url}"
824+
end
825+
814826
["./bazel-bin/dotnet/src/webdriver/Selenium.WebDriver.#{dotnet_version}.nupkg",
815827
"./bazel-bin/dotnet/src/support/Selenium.Support.#{dotnet_version}.nupkg"].each do |asset|
816-
sh "dotnet nuget push #{asset} --api-key #{ENV.fetch('NUGET_API_KEY', nil)} --source https://api.nuget.org/v3/index.json"
828+
sh "dotnet nuget push #{asset} --api-key #{api_key} --source #{push_destination}"
817829
end
818830
end
819831

@@ -854,14 +866,38 @@ namespace :dotnet do
854866

855867
desc 'Update .NET version'
856868
task :version, [:version] do |_task, arguments|
869+
bump_nightly = arguments[:version] === 'nightly'
857870
old_version = dotnet_version
858-
new_version = updated_version(old_version, arguments[:version])
871+
new_version = nil
872+
873+
# There are three cases we want to deal with:
874+
# 1. Switching from a release build to a nightly one
875+
# 2. Updating a nightly build for the next nightly build
876+
# 3. Switching from nightlies to a release build.
877+
878+
if bump_nightly && old_version.include?('-nightly')
879+
# This is the case where we are updating a nightly build to the next nightly build.
880+
# This change is usually done by the CI system and never committed.
881+
# The "-nightlyYmdHM" is removed to add a new timestamp.
882+
new_version = old_version.gsub(/\-nightly\d+$/, '') + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
883+
elsif bump_nightly
884+
# This is the case after a production release and the version number is configured
885+
# to start doing nightly builds.
886+
new_version = old_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
887+
else
888+
if old_version.include?('-nightly')
889+
new_version = old_version.gsub(/\-nightly\d+$/, '')
890+
else
891+
new_version = updated_version(old_version.gsub(/\-nightly\d+$/, ''), arguments[:version])
892+
new_version = new_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
893+
end
894+
end
859895

860896
file = 'dotnet/selenium-dotnet-version.bzl'
861897
text = File.read(file).gsub(old_version, new_version)
862898
File.open(file, "w") { |f| f.puts text }
863899

864-
Rake::Task['dotnet:changelog'].invoke
900+
Rake::Task['dotnet:changelog'].invoke unless new_version.include?('-nightly') || bump_nightly
865901
end
866902
end
867903

dotnet/selenium-dotnet-version.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# BUILD FILE SYNTAX: STARLARK
22

3-
SE_VERSION = "4.19.0"
3+
SE_VERSION = "4.20.0-nightly202404171829"
44
ASSEMBLY_VERSION = "4.0.0.0"
55
SUPPORTED_NET_STANDARD_VERSIONS = ["netstandard2.0"]
66

0 commit comments

Comments
 (0)