Skip to content

Commit

Permalink
Merge pull request #21 from Matts966/alphasql
Browse files Browse the repository at this point in the history
Fix broken bazel installation on MacOS and add test for MacOS
  • Loading branch information
Matts966 authored Aug 1, 2020
2 parents fb9e033 + ef4269f commit 0acfc62
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 43 deletions.
34 changes: 13 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ jobs:
- name: Cache
uses: actions/cache@v2
with:
path: /private/var/tmp
key: ${{ runner.os }}-bazel-build-${{ hashFiles('./**') }}
restore-keys: ${{ runner.os }}-bazel-build-
- name: Install bazel 1.0.0 and Build
path: /private/var/tmp/*bazel*
key: ${{ runner.os }}-bazelisk-build-${{ hashFiles('./**') }}
restore-keys: ${{ runner.os }}-bazelisk-build-
- name: Build
shell: bash
run: |
(cd "/usr/local/Cellar/bazel/3.3.1/libexec/bin" && curl -LO https://releases.bazel.build/1.0.0/release/bazel-1.0.0-darwin-x86_64 && chmod +x bazel-1.0.0-darwin-x86_64)
CC=g++ bazel build //alphasql:all
make
mkdir alphasql_darwin_amd64
mv ./bazel-bin/alphasql/dag ./alphasql_darwin_amd64/dag
mv ./bazel-bin/alphasql/pipeline_type_checker ./alphasql_darwin_amd64/pipeline_type_checker
Expand Down Expand Up @@ -53,22 +52,15 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-bazel-build-${{ hashFiles('./**') }}
restore-keys: ${{ runner.os }}-bazel-build-
- name: Install bazel 1.0.0 and Build
key: ${{ runner.os }}-bazelisk-build-${{ hashFiles('./**') }}
restore-keys: ${{ runner.os }}-bazelisk-build-
- name: Build
run: |
sudo apt-get update && \
sudo apt-get install tzdata build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update && \
sudo apt-get install --no-install-recommends -y make gcc-9 g++-9 && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9
sudo apt install curl gnupg
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt update && sudo apt install bazel-1.0.0
bazel build //...
sudo apt-get update
sudo apt-get install --no-install-recommends -y gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9
bazelisk build //...
mkdir alphasql_linux_x86_64
mv ./bazel-bin/alphasql/dag ./alphasql_linux_x86_64/dag
mv ./bazel-bin/alphasql/pipeline_type_checker ./alphasql_linux_x86_64/pipeline_type_checker
Expand Down
44 changes: 28 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: test
on: push
jobs:
test:
name: Test the repository
linux:
name: Test the repository on Linux
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
Expand All @@ -13,19 +13,31 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-bazel-build-${{ hashFiles('./**') }}
restore-keys: ${{ runner.os }}-bazel-build-
key: ${{ runner.os }}-bazelisk-build-${{ hashFiles('./**') }}
restore-keys: ${{ runner.os }}-bazelisk-build-
- name: Test the repository
run: |
sudo apt-get update && \
sudo apt-get install tzdata build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update && \
sudo apt-get install --no-install-recommends -y make gcc-9 g++-9 && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9
sudo apt install curl gnupg
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt update && sudo apt install bazel-1.0.0
bazel test --test_output=errors //alphasql/...
sudo apt-get update
sudo apt-get install --no-install-recommends -y gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9
bazelisk test --test_output=errors //alphasql/...
osx:
name: Test the repository on Mac
runs-on: macOS-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Cache
uses: actions/cache@v2
with:
path: /private/var/tmp/*bazel*
key: ${{ runner.os }}-bazelisk-build-${{ hashFiles('./**') }}
restore-keys: ${{ runner.os }}-bazelisk-build-
- name: Test the repository
shell: bash
run: |
make
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
.PHONY: build-and-check
build-and-check: test sample
build-and-check: test
make sample

.PHONY: osx
osx:
CC=g++ bazel build //alphasql:all
CC=g++ bazelisk build //alphasql:all
sudo cp ./bazel-bin/alphasql/dag /usr/local/bin
sudo cp ./bazel-bin/alphasql/pipeline_type_checker /usr/local/bin

.PHONY: sample
sample: osx
color() { \
set -o pipefail; "$$@" 2>&1>&3|sed $$'s,.*,\e[31m&\e[m,'>&2; \
} 3>&1 && \
ls -d samples/*/ | while read sample; do \
echo ""; \
dag $$sample --output_path $$sample/dag.dot; \
dot -Tpng $$sample/dag.dot -o $$sample/dag.png; \
pipeline_type_checker $$sample/dag.dot \
color pipeline_type_checker $$sample/dag.dot \
--json_schema_path ./samples/sample-schema.json; \
done;

.PHONY: test
test: osx
CC=g++ bazel test //alphasql:all
CC=g++ bazelisk test //alphasql:all
4 changes: 2 additions & 2 deletions alphasql/dag_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ namespace alphasql {
}
auto function_info = function_information_or_status.value();

// TODO(Matts966): Multiple function definitions lead to cycles like tables
// and we should think if we should raise error here.
// TODO(Matts966): Multiple function definitions leads to duplicate key errors
// and problematic, so emit an understandable error here is more helpful.
for (auto const& defined : function_info.defined) {
const std::string function_name = absl::StrJoin(defined, ".");

Expand Down

0 comments on commit 0acfc62

Please sign in to comment.