| 76 | end |
| 77 | |
| 78 | def test_vote |
| 79 | github_token = File.read(@env)[/^GH_TOKEN=(.*)$/, 1] |
| 80 | uri = URI.parse("https://api.github.com/graphql") |
| 81 | n_issues_query = { |
| 82 | "query" => <<-QUERY, |
| 83 | query { |
| 84 | search(query: "repo:apache/arrow is:issue is:closed milestone:#{@release_version}", |
| 85 | type: ISSUE) { |
| 86 | issueCount |
| 87 | } |
| 88 | } |
| 89 | QUERY |
| 90 | } |
| 91 | response = Net::HTTP.post(uri, |
| 92 | n_issues_query.to_json, |
| 93 | "Content-Type" => "application/json", |
| 94 | "Authorization" => "Bearer #{github_token}") |
| 95 | n_resolved_issues = JSON.parse(response.body)["data"]["search"]["issueCount"] |
| 96 | github_repository = ENV["GITHUB_REPOSITORY"] || "apache/arrow" |
| 97 | github_api_url = "https://api.github.com" |
| 98 | verify_prs = URI("#{github_api_url}/repos/#{github_repository}/pulls" + |
| 99 | "?state=open" + |
| 100 | "&head=apache:release-#{@release_version}-rc0") |
| 101 | verify_pr_url = nil |
| 102 | headers = { |
| 103 | "Accept" => "application/vnd.github+json", |
| 104 | } |
| 105 | |
| 106 | if github_token |
| 107 | headers["Authorization"] = "Bearer #{github_token}" |
| 108 | end |
| 109 | verify_prs.open(headers) do |response| |
| 110 | verify_pr_url = (JSON.parse(response.read)[0] || {})["html_url"] |
| 111 | end |
| 112 | output = source("VOTE") |
| 113 | tarball_hash = Digest::SHA512.file("artifacts/#{@archive_name}").to_s |
| 114 | assert_equal(<<-VOTE.strip, output[/^-+$(.+?)^-+$/m, 1].strip) |
| 115 | To: dev@arrow.apache.org |
| 116 | Subject: [VOTE] Release Apache Arrow #{@release_version} - RC0 |
| 117 | |
| 118 | Hi, |
| 119 | |
| 120 | I would like to propose the following release candidate (RC0) of Apache |
| 121 | Arrow version #{@release_version}. This is a release consisting of #{n_resolved_issues} |
| 122 | resolved GitHub issues[1]. |
| 123 | |
| 124 | This release candidate is based on commit: |
| 125 | #{@current_commit} [2] |
| 126 | |
| 127 | The source release rc0 is hosted at [3]. |
| 128 | The binary artifacts are hosted at [4][5][6][7][8][9]. |
| 129 | The changelog is located at [10]. |
| 130 | |
| 131 | Please download, verify checksums and signatures, run the unit tests, |
| 132 | and vote on the release. See [11] for the SHA-512 checksum for this RC and [12] |
| 133 | for how to validate a release candidate. |
| 134 | |
| 135 | See also a verification result on GitHub pull request [13]. |