Skip to content

Commit 4d228fc

Browse files
committed
Add tag workflow (#136)
1 parent 295aeb3 commit 4d228fc

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

.github/workflows/tagger.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Tag CI
2+
3+
on: [release]
4+
5+
jobs:
6+
build:
7+
name: Enzyme Tag CI
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: tibdex/github-app-token@v1
11+
id: generate_token
12+
with:
13+
app_id: ${{ secrets.APP_ID }}
14+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
15+
repository: JuliaPackaging/Yggdrasil
16+
17+
- uses: actions/checkout@v2
18+
with:
19+
repository: 'JuliaPackaging/Yggdrasil'
20+
fetch-depth: 1
21+
path: ygg
22+
23+
- uses: actions/checkout@v2
24+
with:
25+
fetch-depth: 1
26+
path: enz
27+
- name: replace
28+
run: |
29+
cd ygg
30+
git rm -rf E/Enzyme
31+
mkdir -p E/Enzyme/Enzyme@9
32+
cd E/Enzyme
33+
cp ../../../enz/.packaging/build_tarballs.jl Enzyme@9/build_tarballs.jl
34+
sed "s~%ENZYME_VERSION%~${GITHUB_REF}~g" Enzyme@9/build_tarballs.jl -i
35+
sed "s~%ENZYME_HASH%~${GITHUB_SHA}~g" Enzyme@9/build_tarballs.jl -i
36+
git add Enzyme@9
37+
- name: Create Pull Request
38+
id: cpr
39+
uses: peter-evans/create-pull-request@v3
40+
with:
41+
path: ygg
42+
commit-message: "Upgrade enzyme to ${{ github.ref }}"
43+
title: "Upgrade enzyme to ${{ github.ref }}"
44+
token: ${{ steps.generate_token.outputs.token }}
45+
reviewers: vchuravy
46+
branch: enzyme/${{ github.ref }}
47+
- name: Check outputs
48+
run: |
49+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
50+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

.packaging/build_tarballs.jl

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using BinaryBuilder, Pkg
2+
3+
name = "Enzyme"
4+
repo = "https://github.com/wsmoses/Enzyme.git"
5+
6+
auto_version = "%ENZYME_VERSION%"
7+
version = VersionNumber(split(auto_version, "/")[end])
8+
9+
# Collection of sources required to build attr
10+
sources = [GitSource(repo, "%ENZYME_HASH%")]
11+
12+
# These are the platforms we will build for by default, unless further
13+
# platforms are passed in on the command line
14+
platforms = expand_cxxstring_abis(supported_platforms())
15+
16+
# Bash recipe for building across all platforms
17+
script = raw"""
18+
cd Enzyme
19+
# install_license LICENSE.TXT
20+
CMAKE_FLAGS=()
21+
# Release build for best performance
22+
CMAKE_FLAGS+=(-DENZYME_EXTERNAL_SHARED_LIB=ON)
23+
CMAKE_FLAGS+=(-DCMAKE_BUILD_TYPE=RelWithDebInfo)
24+
# Install things into $prefix
25+
CMAKE_FLAGS+=(-DCMAKE_INSTALL_PREFIX=${prefix})
26+
# Explicitly use our cmake toolchain file and tell CMake we're cross-compiling
27+
CMAKE_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN})
28+
CMAKE_FLAGS+=(-DCMAKE_CROSSCOMPILING:BOOL=ON)
29+
# Tell CMake where LLVM is
30+
CMAKE_FLAGS+=(-DLLVM_DIR="${prefix}/lib/cmake/llvm")
31+
# Force linking against shared lib
32+
CMAKE_FLAGS+=(-DLLVM_LINK_LLVM_DYLIB=ON)
33+
# Build the library
34+
CMAKE_FLAGS+=(-DBUILD_SHARED_LIBS=ON)
35+
cmake -B build -S enzyme -GNinja ${CMAKE_FLAGS[@]}
36+
ninja -C build -j ${nproc} install
37+
"""
38+
39+
# The products that we will ensure are always built
40+
products = Product[
41+
LibraryProduct(["libEnzyme-9", "libEnzyme"], :libEnzyme),
42+
]
43+
44+
dependencies = [
45+
BuildDependency(PackageSpec(name="LLVM_full_jll", version=v"9.0.1")),
46+
# Dependency(PackageSpec(name="libLLVM_jll", version=v"9.0.1"))
47+
]
48+
49+
50+
# Build the tarballs.
51+
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
52+
preferred_gcc_version=v"8", julia_compat="1.5")

0 commit comments

Comments
 (0)