Skip to content

Commit

Permalink
Add tag workflow (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed May 17, 2021
1 parent 295aeb3 commit 4d228fc
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/tagger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Tag CI

on: [release]

jobs:
build:
name: Enzyme Tag CI
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@v1
id: generate_token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
repository: JuliaPackaging/Yggdrasil

- uses: actions/checkout@v2
with:
repository: 'JuliaPackaging/Yggdrasil'
fetch-depth: 1
path: ygg

- uses: actions/checkout@v2
with:
fetch-depth: 1
path: enz
- name: replace
run: |
cd ygg
git rm -rf E/Enzyme
mkdir -p E/Enzyme/Enzyme@9
cd E/Enzyme
cp ../../../enz/.packaging/build_tarballs.jl Enzyme@9/build_tarballs.jl
sed "s~%ENZYME_VERSION%~${GITHUB_REF}~g" Enzyme@9/build_tarballs.jl -i
sed "s~%ENZYME_HASH%~${GITHUB_SHA}~g" Enzyme@9/build_tarballs.jl -i
git add Enzyme@9
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
path: ygg
commit-message: "Upgrade enzyme to ${{ github.ref }}"
title: "Upgrade enzyme to ${{ github.ref }}"
token: ${{ steps.generate_token.outputs.token }}
reviewers: vchuravy
branch: enzyme/${{ github.ref }}
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
52 changes: 52 additions & 0 deletions .packaging/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using BinaryBuilder, Pkg

name = "Enzyme"
repo = "https://github.com/wsmoses/Enzyme.git"

auto_version = "%ENZYME_VERSION%"
version = VersionNumber(split(auto_version, "/")[end])

# Collection of sources required to build attr
sources = [GitSource(repo, "%ENZYME_HASH%")]

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_cxxstring_abis(supported_platforms())

# Bash recipe for building across all platforms
script = raw"""
cd Enzyme
# install_license LICENSE.TXT
CMAKE_FLAGS=()
# Release build for best performance
CMAKE_FLAGS+=(-DENZYME_EXTERNAL_SHARED_LIB=ON)
CMAKE_FLAGS+=(-DCMAKE_BUILD_TYPE=RelWithDebInfo)
# Install things into $prefix
CMAKE_FLAGS+=(-DCMAKE_INSTALL_PREFIX=${prefix})
# Explicitly use our cmake toolchain file and tell CMake we're cross-compiling
CMAKE_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN})
CMAKE_FLAGS+=(-DCMAKE_CROSSCOMPILING:BOOL=ON)
# Tell CMake where LLVM is
CMAKE_FLAGS+=(-DLLVM_DIR="${prefix}/lib/cmake/llvm")
# Force linking against shared lib
CMAKE_FLAGS+=(-DLLVM_LINK_LLVM_DYLIB=ON)
# Build the library
CMAKE_FLAGS+=(-DBUILD_SHARED_LIBS=ON)
cmake -B build -S enzyme -GNinja ${CMAKE_FLAGS[@]}
ninja -C build -j ${nproc} install
"""

# The products that we will ensure are always built
products = Product[
LibraryProduct(["libEnzyme-9", "libEnzyme"], :libEnzyme),
]

dependencies = [
BuildDependency(PackageSpec(name="LLVM_full_jll", version=v"9.0.1")),
# Dependency(PackageSpec(name="libLLVM_jll", version=v"9.0.1"))
]


# Build the tarballs.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
preferred_gcc_version=v"8", julia_compat="1.5")

0 comments on commit 4d228fc

Please sign in to comment.