]> git.proxmox.com Git - ceph.git/blame - ceph/src/arrow/dev/release/02-source-test.rb
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / dev / release / 02-source-test.rb
CommitLineData
1d09f67e
TL
1# Licensed to the Apache Software Foundation (ASF) under one
2# or more contributor license agreements. See the NOTICE file
3# distributed with this work for additional information
4# regarding copyright ownership. The ASF licenses this file
5# to you under the Apache License, Version 2.0 (the
6# "License"); you may not use this file except in compliance
7# with the License. You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing,
12# software distributed under the License is distributed on an
13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14# KIND, either express or implied. See the License for the
15# specific language governing permissions and limitations
16# under the License.
17
18class SourceTest < Test::Unit::TestCase
19 include GitRunnable
20 include VersionDetectable
21
22 def setup
23 @current_commit = git_current_commit
24 detect_versions
25 @tag_name = "apache-arrow-#{@release_version}"
26 @script = File.expand_path("dev/release/02-source.sh")
27
28 Dir.mktmpdir do |dir|
29 Dir.chdir(dir) do
30 yield
31 end
32 end
33 end
34
35 def source(*targets)
36 env = {
37 "SOURCE_DEFAULT" => "0",
38 "release_hash" => @current_commit,
39 }
40 targets.each do |target|
41 env["SOURCE_#{target}"] = "1"
42 end
43 output = sh(env, @script, @release_version, "0")
44 sh("tar", "xf", "#{@tag_name}.tar.gz")
45 output
46 end
47
48 def test_symbolic_links
49 source
50 Dir.chdir(@tag_name) do
51 assert_equal([],
52 Find.find(".").find_all {|path| File.symlink?(path)})
53 end
54 end
55
56 def test_csharp_git_commit_information
57 source
58 Dir.chdir("#{@tag_name}/csharp") do
59 FileUtils.mv("dummy.git", "../.git")
60 sh("dotnet", "pack", "-c", "Release")
61 FileUtils.mv("../.git", "dummy.git")
62 Dir.chdir("artifacts/Apache.Arrow/Release") do
63 sh("unzip", "Apache.Arrow.#{@snapshot_version}.nupkg")
64 FileUtils.chmod(0400, "Apache.Arrow.nuspec")
65 nuspec = REXML::Document.new(File.read("Apache.Arrow.nuspec"))
66 nuspec_repository = nuspec.elements["package/metadata/repository"]
67 attributes = {}
68 nuspec_repository.attributes.each do |key, value|
69 attributes[key] = value
70 end
71 assert_equal({
72 "type" => "git",
73 "url" => "https://github.com/apache/arrow",
74 "commit" => @current_commit,
75 },
76 attributes)
77 end
78 end
79 end
80
81 def test_python_version
82 source
83 Dir.chdir("#{@tag_name}/python") do
84 sh("python3", "setup.py", "sdist")
85 if on_release_branch?
86 pyarrow_source_archive = "dist/pyarrow-#{@release_version}.tar.gz"
87 else
88 pyarrow_source_archive = "dist/pyarrow-#{@release_version}a0.tar.gz"
89 end
90 assert_equal([pyarrow_source_archive],
91 Dir.glob("dist/pyarrow-*.tar.gz"))
92 end
93 end
94
95 def test_vote
96 jira_url = "https://issues.apache.org/jira"
97 jql_conditions = [
98 "project = ARROW",
99 "status in (Resolved, Closed)",
100 "fixVersion = #{@release_version}",
101 ]
102 jql = jql_conditions.join(" AND ")
103 n_resolved_issues = nil
104 search_url = URI("#{jira_url}/rest/api/2/search?jql=#{CGI.escape(jql)}")
105 search_url.open do |response|
106 n_resolved_issues = JSON.parse(response.read)["total"]
107 end
108 output = source("VOTE")
109 assert_equal(<<-VOTE.strip, output[/^-+$(.+?)^-+$/m, 1].strip)
110To: dev@arrow.apache.org
111Subject: [VOTE] Release Apache Arrow #{@release_version} - RC0
112
113Hi,
114
115I would like to propose the following release candidate (RC0) of Apache
116Arrow version #{@release_version}. This is a release consisting of #{n_resolved_issues}
117resolved JIRA issues[1].
118
119This release candidate is based on commit:
120#{@current_commit} [2]
121
122The source release rc0 is hosted at [3].
123The binary artifacts are hosted at [4][5][6][7][8][9].
124The changelog is located at [10].
125
126Please download, verify checksums and signatures, run the unit tests,
127and vote on the release. See [11] for how to validate a release candidate.
128
129The vote will be open for at least 72 hours.
130
131[ ] +1 Release this as Apache Arrow #{@release_version}
132[ ] +0
133[ ] -1 Do not release this as Apache Arrow #{@release_version} because...
134
135[1]: https://issues.apache.org/jira/issues/?jql=project%20%3D%20ARROW%20AND%20status%20in%20%28Resolved%2C%20Closed%29%20AND%20fixVersion%20%3D%20#{@release_version}
136[2]: https://github.com/apache/arrow/tree/#{@current_commit}
137[3]: https://dist.apache.org/repos/dist/dev/arrow/apache-arrow-#{@release_version}-rc0
138[4]: https://apache.jfrog.io/artifactory/arrow/amazon-linux-rc/
139[5]: https://apache.jfrog.io/artifactory/arrow/centos-rc/
140[6]: https://apache.jfrog.io/artifactory/arrow/debian-rc/
141[7]: https://apache.jfrog.io/artifactory/arrow/nuget-rc/#{@release_version}-rc0
142[8]: https://apache.jfrog.io/artifactory/arrow/python-rc/#{@release_version}-rc0
143[9]: https://apache.jfrog.io/artifactory/arrow/ubuntu-rc/
144[10]: https://github.com/apache/arrow/blob/#{@current_commit}/CHANGELOG.md
145[11]: https://cwiki.apache.org/confluence/display/ARROW/How+to+Verify+Release+Candidates
146 VOTE
147 end
148end