Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic #38

Merged
merged 13 commits into from
Aug 9, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ build
native/.gradle
native/build
native/vendor
vendor/
fixtures/*_got
20 changes: 14 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
language: go

go:
- 1.9
- '1.10'

services:
- docker

env:
- BBLFSHD_VERSION=v2.6.1

before_script:
- go get -v gopkg.in/bblfsh/sdk.v1/...
- bblfsh-sdk prepare-build .
- go get -v -t ./driver/...
- curl -L https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 > $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep
- dep ensure --vendor-only
- go get ./vendor/gopkg.in/bblfsh/sdk.v2/cmd/...
- go install ./vendor/gopkg.in/bblfsh/sdk.v2/cmd/...
- docker pull bblfsh/bblfshd:$BBLFSHD_VERSION

script:
- make test integration-test
- bblfsh-sdk update --dry-run
- bblfsh-sdk build ci-build
- bblfsh-sdk test --bblfshd $BBLFSHD_VERSION ci-build

after_success:
- make push
- bblfsh-sdk push ci-build
83 changes: 83 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Prerequisites:
# dep ensure --vendor-only
# bblfsh-sdk release

#==============================
# Stage 1: Native Driver Build
#==============================
FROM openjdk:8-slim as native

# install build dependencies
RUN apt-get update && apt-get install -y make bash wget gradle


ADD native /native
WORKDIR /native

# build native driver
RUN make
RUN gradle shadowJar


#================================
# Stage 1.1: Native Driver Tests
#================================
FROM native as native_test
# run native driver tests
RUN wget https://services.gradle.org/distributions/gradle-4.9-bin.zip
RUN unzip -o gradle-4.9-bin.zip
RUN gradle-4.9/bin/gradle test --info --stacktrace
RUN rm -rf gradle-4.9*


#=================================
# Stage 2: Go Driver Server Build
#=================================
FROM golang:1.10-alpine as driver

ENV DRIVER_REPO=github.com/bblfsh/bash-driver
ENV DRIVER_REPO_PATH=/go/src/$DRIVER_REPO

ADD vendor $DRIVER_REPO_PATH/vendor
ADD driver $DRIVER_REPO_PATH/driver

WORKDIR $DRIVER_REPO_PATH/

# build server binary
RUN go build -o /tmp/driver ./driver/main.go
# build tests
RUN go test -c -o /tmp/fixtures.test ./driver/fixtures/

#=======================
# Stage 3: Driver Build
#=======================
FROM openjdk:8-jre-alpine



LABEL maintainer="source{d}" \
bblfsh.language="bash"

WORKDIR /opt/driver

# copy static files from driver source directory
ADD ./native/src/main/sh/native.sh ./bin/native


# copy build artifacts for native driver
COPY --from=native /native/build/libs/native-jar-with-dependencies.jar ./bin/


# copy driver server binary
COPY --from=driver /tmp/driver ./bin/

# copy tests binary
COPY --from=driver /tmp/fixtures.test ./bin/
# move stuff to make tests work
RUN ln -s /opt/driver ../build
VOLUME /opt/fixtures

# copy driver manifest and static files
ADD .manifest.release.toml ./etc/manifest.toml

ENTRYPOINT ["/opt/driver/bin/driver"]
Loading