Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 30 additions & 43 deletions .ci/register_package.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = Dependency[dep for dep in merged["dependencies"] if !(isa(dep, Bu
lazy_artifacts = merged["lazy_artifacts"]
augment_platform_block = merged["augment_platform_block"]
build_version = BinaryBuilder.get_next_wrapper_version(name, version)
repo = "JuliaBinaryWrappers/$(name)_jll.jl"
repo = "EnzymeAD/$(name)_jll.jl"
code_dir = joinpath(Pkg.devdir(), "$(name)_jll")
julia_compat = merged["julia_compat"]

Expand All @@ -54,17 +54,6 @@ function mvdir(src, dest)
end
end

function download_cached_binaries(download_dir)
NAME = ENV["NAME"]
PROJECT = ENV["PROJECT"]
artifacts = "$(PROJECT)/products/$(NAME)*.tar.*"
cmd = `buildkite-agent artifact download $artifacts $download_dir`
if !success(pipeline(cmd; stderr))
error("Download failed")
end
mvdir(joinpath(download_dir, PROJECT, "products"), download_dir)
end

function download_binaries_from_release(download_dir)
function do_download(download_dir, info)
url = info["url"]
Expand Down Expand Up @@ -96,42 +85,40 @@ for json_obj in [merged, objs_unmerged...]
json_obj["dependencies"] = Dependency[dep for dep in json_obj["dependencies"] if BinaryBuilderBase.is_runtime_dependency(dep)]
end
skip_build = get(ENV, "SKIP_BUILD", "false") == "true"
mktempdir() do download_dir
# Grab the binaries for our package
if skip_build
# We only want to update the wrappers, so download the tarballs from the
# latest build.
download_binaries_from_release(download_dir)
else
# We are going to publish the new binaries we've just baked, take them
# out of the cache while they're hot.
download_cached_binaries(download_dir)
end

# Push up the JLL package (pointing to as-of-yet missing tarballs)
tag = "$(name)-v$(build_version)"
upload_prefix = "https://github.com/$(repo)/releases/download/$(tag)"
# binaries will be automatically placed in the `products/` subdir by the GitHub
# Actions workflow.
download_dir = joinpath(pwd(), "products")
# Grab the binaries for our package
if skip_build
# We only want to update the wrappers, so download the tarballs from the
# latest build.
download_binaries_from_release(download_dir)
end

# Push up the JLL package (pointing to as-of-yet missing tarballs)
tag = "$(name)-v$(build_version)"
upload_prefix = "https://github.com/$(repo)/releases/download/$(tag)"

# If we didn't rebuild the tarballs, save the original Artifacts.toml
artifacts_toml = skip_build ? read(joinpath(code_dir, "Artifacts.toml"), String) : ""
# This loop over the unmerged objects necessary in the event that we have multiple packages being built by a single build_tarballs.jl
for (i,json_obj) in enumerate(objs_unmerged)
from_scratch = (i == 1)
BinaryBuilder.rebuild_jll_package(json_obj; download_dir, upload_prefix, verbose, from_scratch)
end
# If we didn't rebuild the tarballs, save the original Artifacts.toml
artifacts_toml = skip_build ? read(joinpath(code_dir, "Artifacts.toml"), String) : ""
# This loop over the unmerged objects necessary in the event that we have multiple packages being built by a single build_tarballs.jl
for (i,json_obj) in enumerate(objs_unmerged)
from_scratch = (i == 1)
BinaryBuilder.rebuild_jll_package(json_obj; download_dir, upload_prefix, verbose, from_scratch)
end

# Restore Artifacts.toml
if skip_build
write(joinpath(code_dir, "Artifacts.toml"), artifacts_toml)
end
# Restore Artifacts.toml
if skip_build
write(joinpath(code_dir, "Artifacts.toml"), artifacts_toml)
end

# Push JLL package _before_ uploading to GitHub releases, so that this version of the code is what gets tagged
BinaryBuilder.push_jll_package(name, build_version)
# Push JLL package _before_ uploading to GitHub releases, so that this version of the code is what gets tagged
BinaryBuilder.push_jll_package(name, build_version; deploy_repo=repo)

if !skip_build
# Upload the tarballs to GitHub releases
BinaryBuilder.upload_to_github_releases(repo, tag, download_dir; verbose=verbose)
end
if !skip_build
# Upload the tarballs to GitHub releases
BinaryBuilder.upload_to_github_releases(repo, tag, download_dir; verbose=verbose)
end

# Sub off to Registrator to create a PR to General. Note: it's important to pass both
Expand Down
49 changes: 46 additions & 3 deletions .github/workflows/build-reactant-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: "Build Reactant_jll"

on:
workflow_call:
secrets:
ENZYMEAD_BOT_ID:
required: true
ENZYMEAD_BOT_PRIVATE_KEY:
required: true
inputs:
julia_version:
description: 'Julia version'
Expand Down Expand Up @@ -212,10 +217,29 @@ jobs:
needs: build-platforms

steps:
- uses: actions/create-github-app-token@v2
id: generate_token
with:
app-id: "${{ secrets.ENZYMEAD_BOT_ID }}"
private-key: "${{ secrets.ENZYMEAD_BOT_PRIVATE_KEY }}"
- uses: actions/checkout@v5
with:
repository: 'EnzymeAD/ReactantBuilder'
ref: ${{ inputs.reactantbuilder_ref == '' && github.sha || inputs.reactantbuilder_ref }}
- name: Set JULIA_PROJECT
# We have to use `${GITHUB_WORKSPACE}` instead of `github.workspace` because GitHub
# is terrible and the two don't match inside containers:
# https://github.com/actions/runner/issues/2058
run:
echo "JULIA_PROJECT=${GITHUB_WORKSPACE}/.ci" >> "${GITHUB_ENV}"
- name: Set and create PRODUCTS_DIR
# We have to use `${GITHUB_WORKSPACE}` instead of `github.workspace` because GitHub
# is terrible and the two don't match inside containers:
# https://github.com/actions/runner/issues/2058
run: |
PRODUCTS_DIR=${{ inputs.build_project }}/products
mkdir -p "${PRODUCTS_DIR}"
echo "PRODUCTS_DIR=${PRODUCTS_DIR}" >> "${GITHUB_ENV}"
- uses: julia-actions/setup-julia@v2
with:
version: '${{ inputs.julia_version }}'
Expand All @@ -225,13 +249,32 @@ jobs:
- uses: actions/download-artifact@v6
with:
merge-multiple: true
path: ${{ env.PRODUCTS_DIR }}
- name: Change Reactant commit
run: |
if [[ -n "${{ inputs.reactant_commit }}" ]]; then
echo 'Changing Reactant commit to ${{ inputs.reactant_commit }}...'
sed -i 's/reactant_commit = ".*"/reactant_commit = "'${{ inputs.reactant_commit }}'"/' R/Reactant/build_tarballs.jl
fi
- name: Check
- name: Set up git
run: |
pwd
ls -lhrt
git config --global user.name "$enzymead-bot[bot]"
git config --global user.email "238314553+enzymead-bot[bot]@users.noreply.github.com"
- name: Instantiate environment
timeout-minutes: 20
shell: julia --color=yes {0}
run: |
using Pkg
Pkg.instantiate()
- name: Generate meta.json
run: |
julia --compile=min ./build_tarballs.jl --meta-json=$(basename ${{ inputs.build_project }}).meta.json
working-directory: ${{ inputs.build_project }}
env:
GITHUB_TOKEN:
- name: Register
run: |
julia ${JULIA_PROJECT}/register_package.jl "$(basename ${{ inputs.build_project }}).meta.json" --verbose
working-directory: ${{ inputs.build_project }}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
1 change: 1 addition & 0 deletions .github/workflows/build-reactant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ jobs:
strategy:
fail-fast: false
uses: ./.github/workflows/build-reactant-reusable.yml
secrets: inherit
3 changes: 3 additions & 0 deletions R/Reactant/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ augment_platform_block="""

# for gpu in ("none", "cuda", "rocm"), mode in ("opt", "dbg"), platform in platforms
for gpu in ("none", "cuda"), mode in ("opt", "dbg"), cuda_version in ("none", "12.9", "13.0"), platform in platforms
if !Sys.islinux(platform) || gpu != "none" || mode != "opt"
continue
end

augmented_platform = deepcopy(platform)
augmented_platform["mode"] = mode
Expand Down
Loading