-
Notifications
You must be signed in to change notification settings - Fork 5
128 lines (124 loc) · 3.9 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: build
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
env:
SRC_BRANCH: main
BUILD_BRANCH: build
BUILD_DIRNAME: build
BUILD_BRANCH_REPO_DIRNAME: build.repo
jobs:
init-build-branch:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Create branch if it does not exist
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if ! git ls-remote --exit-code --heads origin ${{ env.BUILD_BRANCH }}; then
echo "Branch does not exist, creating and pushing..."
git checkout --orphan ${{ env.BUILD_BRANCH }}
git rm -rf .
git commit --allow-empty -m "First commit"
git push origin ${{ env.BUILD_BRANCH }}
else
echo "Branch already exists, skipping push."
fi
build-wasm:
runs-on: ubuntu-latest
container:
image: juniorrojas/llvm-enzyme:latest
steps:
- name: Clone src branch
uses: actions/checkout@v4
with:
ref: ${{ env.SRC_BRANCH }}
- name: Build WASM
run: |
export LLVM_BIN_DIR=/usr/lib/llvm-11/bin
export ENZYME=/Enzyme/enzyme/build/Enzyme/LLVMEnzyme-11.so
./build.sh
- name: Upload WASM
uses: actions/upload-artifact@v4
with:
name: algovivo.wasm
path: build/algovivo.wasm
build-dynamic-lib:
runs-on: ubuntu-latest
container:
image: juniorrojas/llvm-enzyme:latest
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Build
run: |
export LLVM_BIN_DIR=/usr/lib/llvm-11/bin
export ENZYME=/Enzyme/enzyme/build/Enzyme/LLVMEnzyme-11.so
export BUILD_WASM=0
./build.sh
- name: Upload dynamic lib
uses: actions/upload-artifact@v4
with:
name: algovivo.so
path: build/algovivo.so
build-js:
runs-on: ubuntu-latest
steps:
- name: Clone src branch
uses: actions/checkout@v4
with:
ref: ${{ env.SRC_BRANCH }}
- name: Build lib
run: |
npm ci
npm run build
- name: Upload lib build
uses: actions/upload-artifact@v4
with:
name: build-js
path: ${{ env.BUILD_DIRNAME }}/
push-build:
runs-on: ubuntu-latest
needs: [init-build-branch, build-wasm, build-dynamic-lib, build-js]
steps:
- name: Download WASM build
uses: actions/download-artifact@v4
with:
name: algovivo.wasm
path: ${{ env.BUILD_DIRNAME }}/
- name: Download dynamic lib
uses: actions/download-artifact@v4
with:
name: algovivo.so
path: ${{ env.BUILD_DIRNAME }}/
- name: Download JS build
uses: actions/download-artifact@v4
with:
name: build-js
path: ${{ env.BUILD_DIRNAME }}/
- name: Configure git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- run: ls -l build
- name: Clone build branch
uses: actions/checkout@v4
with:
ref: ${{ env.BUILD_BRANCH }}
path: ${{ env.BUILD_BRANCH_REPO_DIRNAME }}
- name: Push to build branch
run: |
rm -rf ${{ env.BUILD_BRANCH_REPO_DIRNAME }}/${{ env.BUILD_DIRNAME }}
cp -r build ${{ env.BUILD_BRANCH_REPO_DIRNAME }}
cd ${{ env.BUILD_BRANCH_REPO_DIRNAME }}
ls -la
ls -la ${{ env.BUILD_DIRNAME }}
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add build
git commit -m "Update build"
git push origin ${{ env.BUILD_BRANCH }}