-
Notifications
You must be signed in to change notification settings - Fork 1
163 lines (136 loc) · 7.14 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Test libquil
on:
pull_request:
workflow_call:
jobs:
build-linux:
name: Build libquil.so
runs-on: ubuntu-latest
steps:
- name: root suid tar
run: sudo chown root /bin/tar && sudo chmod u+s /bin/tar
- uses: actions/checkout@v2
with:
path: "libquil"
- name: Cache SBCL
id: cache-sbcl
uses: actions/cache@v3
with:
path: |
/usr/local/lib/libsbcl.so
/usr/local/lib/sbcl
/usr/local/bin/sbcl
~/quicklisp
~/.sbclrc
key: ${{ runner.os }}-build-${{ hashFiles('**/versions') }}
- if: steps.cache-sbcl.outputs.cache-hit != 'true'
name: Install SBCL, libraries, and quicklisp
run: |
sudo apt update && sudo apt install -y sbcl build-essential
sudo git clone --single-branch --branch sbcl-2.2.4 https://git.code.sf.net/p/sbcl/sbcl /usr/src/sbcl
cd /usr/src/sbcl && sudo sh make.sh && sudo sh make-shared-library.sh
sudo apt remove -y sbcl
sudo sh install.sh
sudo cp src/runtime/libsbcl.so /usr/local/lib/libsbcl.so
sudo apt install -y wget
wget -P /tmp/ 'https://beta.quicklisp.org/quicklisp.lisp'
sbcl --noinform --non-interactive --load /tmp/quicklisp.lisp --eval "(quicklisp-quickstart:install :dist-url \"http://beta.quicklisp.org/dist/quicklisp/2022-04-01/distinfo.txt\")"
sbcl --noinform --non-interactive --load ~/quicklisp/setup.lisp --eval '(ql-util:without-prompting (ql:add-to-init-file))'
echo "#+quicklisp(push (truename \"$GITHUB_WORKSPACE\") ql:*local-project-directories*)" >> ~/.sbclrc
rm -f /tmp/quicklisp.lisp
cat ~/.sbclrc
- name: Pull Lisp dependencies
run: |
git clone https://github.com/notmgsk/quilc.git $GITHUB_WORKSPACE/quilc && cd $GITHUB_WORKSPACE/quilc && git checkout bffea7fdb972cc9b3a50b790246b6a3143c88c7a
git clone https://github.com/quil-lang/qvm.git $GITHUB_WORKSPACE/qvm && cd $GITHUB_WORKSPACE/qvm && git checkout 4617625cb6053b1adfd3f7aea9cd2be328b225f6
git clone https://github.com/quil-lang/magicl.git $GITHUB_WORKSPACE/magicl
git clone https://github.com/stylewarning/cl-permutation $GITHUB_WORKSPACE/cl-permutation
git clone https://github.com/quil-lang/sbcl-librarian.git $GITHUB_WORKSPACE/sbcl-librarian && cd $GITHUB_WORKSPACE/sbcl-librarian && git checkout 04f7e390c777084ac43b8df9e90593a041da2381
- name: Install quilc dependencies
run: sudo apt update && sudo apt install -y libblas-dev libffi-dev libffi7 liblapack-dev libz-dev gfortran
- name: Build libquil.so
run: |
cd $GITHUB_WORKSPACE/libquil
ls
sbcl --noinform --non-interactive --eval '(ql:quickload :sbcl-librarian)'
sbcl --dynamic-space-size 8192 --noinform --non-interactive --eval '(ql:quickload :libquil)'
make
- name: Test
run: |
cd $GITHUB_WORKSPACE/libquil/examples/qvm && LD_LIBRARY_PATH=../.. make test
cd $GITHUB_WORKSPACE/libquil/examples/quilc && LD_LIBRARY_PATH=../.. make test
- name: Package files
run: |
mkdir -p $GITHUB_WORKSPACE/artifacts/libquil && cp $GITHUB_WORKSPACE/libquil/libquil.h $GITHUB_WORKSPACE/libquil/libquil.so $GITHUB_WORKSPACE/libquil/libquil.core /usr/local/lib/libsbcl.so $GITHUB_WORKSPACE/artifacts/libquil
- name: Store artifact
uses: actions/upload-artifact@v3
with:
name: linux-amd64
path: ${{ github.workspace }}/artifacts/*
build-macos:
name: Build libquil.dylib
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
path: "libquil"
- name: Cache SBCL
id: cache-sbcl-macos
uses: actions/cache@v3
with:
path: |
/usr/local/lib/libsbcl.so
/usr/local/lib/sbcl
/usr/local/bin/sbcl
~/quicklisp
~/.sbclrc
key: ${{ runner.os }}-build-${{ hashFiles('**/macos-versions' )}}
- uses: Homebrew/actions/setup-homebrew@master
name: Setup homebrew
- if: steps.cache-sbcl-macos.outputs.cache-hit != 'true'
name: Install SBCL, libraries, and quicklisp
run: |
brew install sbcl git
git clone --branch x86-null-tn https://git.code.sf.net/p/sbcl/sbcl /tmp/sbcl
cd /tmp/sbcl && sudo sh make.sh --without-compact-instance-header --without-immobile-space --without-immobile-code && sudo sh make-shared-library.sh
brew remove -f sbcl
sudo sh install.sh
sudo cp src/runtime/libsbcl.so /usr/local/lib/libsbcl.so
brew install wget
wget -P /tmp/ 'https://beta.quicklisp.org/quicklisp.lisp'
sbcl --noinform --non-interactive --load /tmp/quicklisp.lisp --eval "(quicklisp-quickstart:install :dist-url \"http://beta.quicklisp.org/dist/quicklisp/2022-04-01/distinfo.txt\")"
sbcl --noinform --non-interactive --load ~/quicklisp/setup.lisp --eval '(ql-util:without-prompting (ql:add-to-init-file))'
echo "#+quicklisp(push (truename \"$GITHUB_WORKSPACE\") ql:*local-project-directories*)" >> ~/.sbclrc
rm -f /tmp/quicklisp.lisp
cat ~/.sbclrc
- name: Pull Lisp dependencies
run: |
git clone https://github.com/notmgsk/quilc.git $GITHUB_WORKSPACE/quilc && cd $GITHUB_WORKSPACE/quilc && git checkout bffea7fdb972cc9b3a50b790246b6a3143c88c7a
git clone https://github.com/quil-lang/qvm.git $GITHUB_WORKSPACE/qvm && cd $GITHUB_WORKSPACE/qvm && git checkout 4617625cb6053b1adfd3f7aea9cd2be328b225f6
git clone https://github.com/quil-lang/magicl.git $GITHUB_WORKSPACE/magicl
git clone https://github.com/stylewarning/cl-permutation $GITHUB_WORKSPACE/cl-permutation
git clone https://github.com/quil-lang/sbcl-librarian.git $GITHUB_WORKSPACE/sbcl-librarian && cd $GITHUB_WORKSPACE/sbcl-librarian && git checkout 04f7e390c777084ac43b8df9e90593a041da2381
- name: Install quilc dependencies
run: brew install lapack openblas libffi gfortran
- name: Build libquil.dylib
run: |
cd $GITHUB_WORKSPACE/libquil
ls
sbcl --noinform --non-interactive --eval '(ql:quickload :sbcl-librarian)'
sbcl --dynamic-space-size 8192 --noinform --non-interactive --eval '(ql:quickload :libquil)'
make
- name: ls
run: |
ls $GITHUB_WORKSPACE/libquil/libquil.dylib
- name: Test
run: |
cd $GITHUB_WORKSPACE/libquil/examples/qvm && DYLD_LIBRARY_PATH=$GITHUB_WORKSPACE/libquil make test
cd $GITHUB_WORKSPACE/libquil/examples/quilc && DYLD_LIBRARY_PATH=$GITHUB_WORKSPACE/libquil make test
- name: Package files
run: |
mkdir -p $GITHUB_WORKSPACE/artifacts/libquil && cp $GITHUB_WORKSPACE/libquil/libquil.h $GITHUB_WORKSPACE/libquil/libquil.dylib $GITHUB_WORKSPACE/libquil/libquil.core /usr/local/lib/libsbcl.so $GITHUB_WORKSPACE/artifacts/libquil
- name: Store artifact
uses: actions/upload-artifact@v3
with:
name: macos
path: ${{ github.workspace }}/artifacts/*