Skip to content

Commit 47bd8bc

Browse files
committed
Make ProGraML pip install-able.
1 parent 777f07e commit 47bd8bc

File tree

123 files changed

+1258
-756
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1258
-756
lines changed

.bazelrc

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# See: https://bazel.build/versions/master/docs/bazel-user-manual.html#flag--compilation_mode
22

3-
# This flag is set by the bazel IntelliJ plugin. Set it here so that alternating
4-
# between command line and IntelliJ invocations does not reset the analysis cache.
5-
build --runs_per_test=1
6-
test --runs_per_test=1
7-
8-
# This project uses C++14.
3+
# This project requires c++14.
4+
#
5+
# NOTE(cummins): This flag has to be pushed out to the copts argument of a
6+
# handful of cxx targets, grep for them when changing the standard.
7+
#
8+
# NOTE(cummins): LLVM 3.8 is not compatible with C++17 or later.
99
build --cxxopt='-std=c++14'
1010
test --cxxopt='-std=c++14'
1111

12-
# Default to continuing on build error. Override using --keep_going=false.
13-
build --keep_going
14-
test --keep_going
12+
# Workaround for broken grpc build on macOS.
13+
# See: https://github.com/bazelbuild/bazel/issues/4341
14+
build --copt -DGRPC_BAZEL_BUILD
15+
test --copt -DGRPC_BAZEL_BUILD
16+
17+
# Show test error output. Override using --test_output={summary,full}.
18+
test --test_output=errors
1519

1620
# Show test error output. Override using --test_output={summary,full}.
1721
test --test_output=errors
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Install build dependencies
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Install dependencies (linux)
7+
run: |
8+
if [ "$(uname)" != "Darwin" ]; then
9+
curl -L "https://github.com/bazelbuild/bazelisk/releases/download/v1.6.1/bazelisk-linux-amd64" > bazel
10+
chmod +x bazel
11+
sudo mv bazel /usr/local/bin/bazel
12+
sudo apt-get install clang-9 patchelf
13+
fi
14+
shell: bash
15+
16+
- name: Install dependencies (macos)
17+
run: |
18+
if [ "$(uname)" = "Darwin" ]; then
19+
brew install bazelisk zlib
20+
fi
21+
shell: bash
22+
env:
23+
LDFLAGS: -L/usr/local/opt/zlib/lib
24+
CPPFLAGS: -I/usr/local/opt/zlib/include
25+
PKG_CONFIG_PATH: /usr/local/opt/zlib/lib/pkgconfig
26+
27+
- name: Install Python dependencies
28+
run: |
29+
python -m pip install -r requirements.txt
30+
echo /home/runner/.local/bin >> $GITHUB_PATH
31+
shell: bash
32+
33+
- name: whoami
34+
run: ./tools/whoami.sh
35+
shell: bash

.github/workflows/bazel_test.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: CI
3+
4+
on:
5+
push:
6+
branches:
7+
- development
8+
- stable
9+
pull_request:
10+
11+
jobs:
12+
test:
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest, macos-latest]
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Setup python
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: 3.9
26+
27+
- name: Install build dependencies
28+
uses: ./.github/actions/install-build-dependencies
29+
30+
- name: Test
31+
run: make test
32+
env:
33+
BAZEL_OPTS: --batch
34+
BAZEL_TEST_OPTS: --config=ci --test_timeout=300,900,1800,7200
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: CI
3+
4+
on:
5+
push:
6+
branches:
7+
- development
8+
- stable
9+
pull_request:
10+
11+
jobs:
12+
test:
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest, macos-latest]
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Setup python
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: 3.9
26+
27+
- name: Install build dependencies
28+
uses: ./.github/actions/install-build-dependencies
29+
30+
- name: Install
31+
run: |
32+
mkdir "${GITHUB_WORKSPACE}/install"
33+
bazel run --config=ci //:install "${GITHUB_WORKSPACE}/install"
34+
echo "${GITHUB_WORKSPACE}/install/bin" >> $GITHUB_PATH
35+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/install/lib" >> $GITHUB_ENV
36+
37+
- name: Test installed binaries
38+
run: |
39+
llvm2graph --version

.github/workflows/ci.yaml

-68
This file was deleted.

.github/workflows/coverage.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Test Coverage
3+
4+
on:
5+
push:
6+
branches:
7+
- development
8+
- stable
9+
pull_request:
10+
11+
jobs:
12+
pytest-cov:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Setup python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: 3.9
22+
23+
- name: Install build dependencies
24+
uses: ./.github/actions/install-build-dependencies
25+
26+
- name: Install
27+
run: make install
28+
env:
29+
BAZEL_OPTS: --batch
30+
BAZEL_BUILD_OPTS: --config=ci
31+
32+
- name: Test
33+
# Note the `|| true` as we don't care about failing tests in this
34+
# job.
35+
run: make install-test-cov || true
36+
37+
- name: Upload coverage to Codecov
38+
uses: codecov/codecov-action@v1
39+
with:
40+
files: ./coverage.xml
41+
if: ${{ always() }}

.github/workflows/install_test.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: CI
3+
4+
on:
5+
push:
6+
branches:
7+
- development
8+
- stable
9+
pull_request:
10+
schedule:
11+
- cron: 0 0 * * 0 # weekly
12+
13+
jobs:
14+
test:
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, macos-latest]
21+
python: [3.6, 3.7, 3.8, 3.9]
22+
exclude:
23+
# Only test recent python versions on macOS.
24+
- os: macos-latest
25+
python: 3.6
26+
- os: macos-latest
27+
python: 3.7
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- name: Set up Python ${{ matrix.python }}
32+
uses: actions/setup-python@v2
33+
with:
34+
python-version: ${{ matrix.python }}
35+
36+
- name: Install build dependencies
37+
uses: ./.github/actions/install-build-dependencies
38+
39+
- name: Install
40+
run: make install
41+
env:
42+
CC: clang
43+
CXX: clang++
44+
BAZEL_OPTS: --batch
45+
BAZEL_BUILD_OPTS: --config=ci
46+
47+
- name: Test
48+
run: make install-test
49+
env:
50+
CC: clang
51+
CXX: clang++
52+
53+
- name: Uninstall
54+
run: make uninstall

.gitignore

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
__pycache__/
1+
__pycache__
22
.DS_Store
33
.env
4-
/.clwb/
5-
/.idea/
4+
/.act
5+
/.clwb
6+
/.vscode
7+
/*.egg-info
68
/bazel-*
9+
/build
10+
/coverage.xml
11+
/dist
12+
/node_modules
13+
/package-lock.json

BUILD BUILD.bazel

+16-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1717
# See the License for the specific language governing permissions and
1818
# limitations under the License.
19+
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
1920

2021
exports_files([
2122
".bettercodehub.yml",
@@ -32,17 +33,30 @@ config_setting(
3233
visibility = ["//visibility:public"],
3334
)
3435

36+
py_binary(
37+
name = "py_package",
38+
srcs = ["empty.py"],
39+
main = "empty.py",
40+
deps = ["//programl"],
41+
)
42+
43+
genrule(
44+
name = "make_empty_py_file",
45+
outs = ["empty.py"],
46+
cmd = "touch $@",
47+
)
48+
3549
sh_binary(
3650
name = "install",
3751
srcs = ["install.sh"],
3852
data = [
39-
":package",
53+
":tar_package",
4054
"@bazel_tools//tools/bash/runfiles",
4155
],
4256
)
4357

4458
genrule(
45-
name = "package",
59+
name = "tar_package",
4660
srcs = [
4761
"//bin:analyze",
4862
"//bin:graph2cdfg",

0 commit comments

Comments
 (0)