Skip to content

Commit

Permalink
Fix CI, and fix the checksums for the SuiteSparse.jl external stdlib (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
DilumAluthge authored Aug 24, 2021
1 parent 42447e6 commit 261749f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
version:
- '1.6'
- '1'
- 'nightly'
# - 'nightly'
os:
- ubuntu-latest
arch:
Expand Down
7 changes: 5 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
name = "BumpStdlibs"
uuid = "10e0400f-8273-43d0-bd6e-07483373ba4f"
authors = ["Dilum Aluthge", "contributors"]
version = "4.0.1"
version = "4.1.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"

[compat]
GitHub = "5.2"
HTTP = "0.9"
URIs = "1.1"
JSON3 = "1.9"
TimeZones = "1.5.2"
URIs = "1.1"
julia = "1.6"

[extras]
Expand Down
2 changes: 2 additions & 0 deletions src/BumpStdlibs.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module BumpStdlibs

import Dates
import Downloads
import GitHub
import HTTP
import JSON3
import TimeZones
import URIs

Expand Down
20 changes: 14 additions & 6 deletions src/bump-stdlibs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ function bump_stdlibs(julia_repo::AbstractString, config::Config)
upstream_julia_repo_name = m[2]
upstream_julia_repo = "$(upstream_julia_repo_owner)/$(upstream_julia_repo_name)"
@debug "Attempting to get upstream `julia` repo" upstream_julia_repo
upstream_julia_repo_gh = GitHub.repo(upstream_julia_repo; auth = config.auth)
whoami = GitHub.whoami(; auth = config.auth).login
upstream_julia_repo_gh = GitHub.repo(upstream_julia_repo; config.auth)
whoami = whoami_username(; config.auth)
@debug("My GitHub username is: $(whoami)")
fork_julia_repo_owner = whoami
fork_julia_repo_name = upstream_julia_repo_name
Expand Down Expand Up @@ -194,8 +194,16 @@ function _bump_single_stdlib(stdlib::StdlibInfo, config::Config, state::State)
cd("stdlib") do
run(`make`)
end
file_to_target = Dict(
"suitesparse" => "libsuitesparse",
)
for file in checksum_files_that_need_refreshing
run(`make -f contrib/refresh_checksums.mk $(file)`)
if haskey(file_to_target, file)
target = file_to_target[file]
else
target = file
end
run(`make -f contrib/refresh_checksums.mk $(target)`)
end
run(`git add -A`)
run(`git commit -m "$(commit_message)"`)
Expand All @@ -211,7 +219,7 @@ function _bump_single_stdlib(stdlib::StdlibInfo, config::Config, state::State)
if do_push
run(`git push --force origin $(pr_branch)`)
end
whoami = GitHub.whoami(; auth = config.auth).login
whoami = whoami_username(; config.auth)
pr_head_with_fork_owner = "$(whoami):$(pr_branch)"
pr_state = Dict{String, Any}(
"base" => upstream_julia_repo_default_branch,
Expand All @@ -220,8 +228,8 @@ function _bump_single_stdlib(stdlib::StdlibInfo, config::Config, state::State)
"maintainer_can_modify" => true,
"title" => pr_title,
)
@debug "" upstream_julia_repo_gh
@debug "" fork_julia_repo_gh
@debug "" upstream_julia_repo_gh.full_name
@debug "" fork_julia_repo_gh.full_name
@debug "" pr_state
pr = create_or_update_pull_request(upstream_julia_repo_gh, pr_state; auth = config.auth)
end # cd(joinpath(temp_dir, "FORK"))
Expand Down
26 changes: 24 additions & 2 deletions src/github.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,29 @@ function is_pr_exists_exception(ex)
return false
end

function _get_token_from_auth(auth::GitHub.OAuth2)
return auth.token
end

function whoami_username(; auth)
io = IOBuffer()
Downloads.download(
"https://api.github.com/user",
io;
headers = Dict(
"Authorization" => "token $(_get_token_from_auth(auth))",
),
)
str = String(take!(io))
json = JSON3.read(str)
login = json.login::String
return login
end

function create_or_update_pull_request(repo::GitHub.Repo, params; auth)
whoami = GitHub.whoami(; auth = auth).login
whoami = whoami_username(; auth)
try
@info "Attempting to create a new pull request..."
new_pr = GitHub.create_pull_request(
repo;
params=params,
Expand All @@ -49,9 +69,11 @@ function create_or_update_pull_request(repo::GitHub.Repo, params; auth)
)
@debug "" found_prs
if length(found_prs) != 1
@warn "length(found_prs) != 1" length(found_prs)
@warn "length(found_prs) != 1" length(found_prs) found_prs [x.number for x in found_prs]
end
found_pr = found_prs[1]
@info "There is already an existing pull request: $(found_pr.number)"
@info "Attempting to update the existing pull request..."
existing_pr = GitHub.update_pull_request(
repo,
found_pr.number;
Expand Down

2 comments on commit 261749f

@DilumAluthge
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/43412

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.1.0 -m "<description of version>" 261749fb614a9bf5a901b125ba856cb4201c25e4
git push origin v4.1.0

Please sign in to comment.