Skip to content

Commit

Permalink
Upgrade CI (typedb#67)
Browse files Browse the repository at this point in the history
## What is the goal of this PR?

We bring the CI pipeline in to line with the other Grakn repos, and enable creating end-to-end and integration tests that can depend upon a specific Grakn commit.

## What are the changes implemented in this PR?

- Updates to Bazel 0.25.2
- Swaps `force_python` for `python_version` as per new Bazel 
- Updates pip deployment for `snapshot` and `release`
- Overhauls WORKSPACE file, and includes the necessary transitive dependencies
  • Loading branch information
jmsfltchr authored Jul 12, 2019
1 parent 8dd0cfd commit f6ede6c
Show file tree
Hide file tree
Showing 6 changed files with 439 additions and 240 deletions.
39 changes: 21 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ commands:
- run:
name: Bazel - Install
command: |
curl -OL https://github.com/bazelbuild/bazel/releases/download/0.20.0/bazel-0.20.0-installer-linux-x86_64.sh
chmod +x bazel-0.20.0-installer-linux-x86_64.sh
sudo ./bazel-0.20.0-installer-linux-x86_64.sh
curl -OL https://github.com/bazelbuild/bazel/releases/download/0.25.2/bazel-0.25.2-installer-linux-x86_64.sh
chmod +x bazel-0.25.2-installer-linux-x86_64.sh
sudo ./bazel-0.25.2-installer-linux-x86_64.sh
jobs:
test:
Expand All @@ -23,20 +23,21 @@ jobs:
- run: unzip grakn-core-all-mac-1.5.3.zip
- run: nohup grakn-core-all-mac-1.5.3/grakn server start
- run: cd grakn-core-all-mac-1.5.3 && ./grakn console -k test_schema -f ../kglib/kgcn/test_data/schema.gql
- run: bazel test //kglib/... --test_output=streamed --force_python PY3 --python_path $(which python)
- run: bazel test //kglib/... --test_output=streamed --python_version PY3 --python_path $(which python)

test-deploy-pip:
deploy-pip-snapshot:
machine: true
working_directory: ~/kglib
steps:
- checkout
- bazel_install
- run: sudo apt-get update
- run: pyenv install 3.6.3
- run: pyenv global 3.6.3
- run: date +%s > VERSION
- run: cat VERSION
- run: bazel run //:deploy-pip -- test $PYPI_TEST_SERVER_USERNAME $PYPI_TEST_SERVER_PASSWORD
- run: |
echo -n "$(cat VERSION)-$CIRCLE_SHA1" > VERSION
export DEPLOY_PIP_USERNAME=$REPO_GRAKN_USERNAME
export DEPLOY_PIP_PASSWORD=$REPO_GRAKN_PASSWORD
bazel run //:deploy-pip -- snapshot
end-to-end-test:
machine: true
Expand All @@ -47,7 +48,7 @@ jobs:
- run: sudo apt-get update
- run: pyenv install 3.6.3
- run: pyenv global 3.6.3
- run: bazel test //examples:test_pypi_end_to_end_test --test_output=streamed --force_python PY3 --python_path $(which python) --spawn_strategy=standalone
- run: bazel test //examples:test_pypi_end_to_end_test --test_output=streamed --python_version PY3 --python_path $(which python) --spawn_strategy=standalone

deploy-git:
machine: true
Expand All @@ -62,39 +63,41 @@ jobs:
VERSION_TAG="v"$(cat "VERSION")
curl -X POST --fail --data "{\"tag_name\": \"${VERSION_TAG}\",\"target_commitish\": \"${CIRCLE_SHA1}\",\"name\": \"Draft\",\"body\": \"\",\"draft\": true,\"prerelease\": false}" https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/releases?access_token=${GITHUB_DEPLOYMENT_TOKEN}
deploy-pip:
deploy-pip-release:
machine: true
working_directory: ~/kglib
steps:
- checkout
- bazel_install
- run: sudo apt-get update
- run: pyenv install 3.6.3
- run: pyenv global 3.6.3
- run: bazel run //:deploy-pip -- pypi $PYPI_USERNAME $PYPI_PASSWORD
- run: |
export DEPLOY_PIP_USERNAME=$REPO_PYPI_USERNAME
export DEPLOY_PIP_PASSWORD=$REPO_PYPI_PASSWORD
bazel run //:deploy-pip -- release
workflows:
version: 2
kglib:
jobs:
- test
- test-deploy-pip:
- deploy-pip-snapshot:
requires:
- test
- end-to-end-test:
requires:
- test-deploy-pip
- deploy-pip-snapshot
- approve-deploy-git:
type: approval
requires:
- end-to-end-test
- deploy-git:
requires:
- approve-deploy-git
- approve-deploy-pip:
- approve-deploy-pip-release:
type: approval
requires:
- deploy-git
- deploy-pip:
- deploy-pip-release:
requires:
- approve-deploy-pip
- approve-deploy-pip-release
39 changes: 13 additions & 26 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ exports_files(["requirements.txt"])

load("@io_bazel_rules_python//python:python.bzl", "py_library", "py_test")
load("@pypi_dependencies//:requirements.bzl", "requirement")
load("@pypi_deployment_dependencies//:requirements.bzl", deployment_requirement = "requirement")
load("@graknlabs_bazel_distribution_pip//:requirements.bzl", deployment_requirement = "requirement")

load("@graknlabs_bazel_distribution//pip:rules.bzl", "deploy_pip")
load("@graknlabs_bazel_distribution//pip:rules.bzl", "assemble_pip", "deploy_pip")

deploy_pip(
name = "deploy-pip",
package_name = "grakn-kglib",
assemble_pip(
name = "assemble-pip",
target = "//kglib:kglib",
version_file = "//:VERSION",
package_name = "grakn-kglib",
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
Expand All @@ -35,27 +36,13 @@ deploy_pip(
'grpcio==1.16.0', 'protobuf==3.6.1', 'six==1.11.0', 'enum34==1.1.6', 'twine==1.12.1', 'requests==2.21.0'],
keywords = ["machine learning", "logical reasoning", "knowledege graph", "grakn", "database", "graph",
"knowledgebase", "knowledge-engineering"],
deployment_properties = "//:deployment.properties",

description = "A Machine Learning Library for the Grakn knowledge graph.",
long_description_file = "//:README.md",
deps = [
deployment_requirement("twine"),
deployment_requirement("setuptools"),
deployment_requirement("wheel"),
deployment_requirement("requests"),
deployment_requirement("urllib3"),
deployment_requirement("chardet"),
deployment_requirement("certifi"),
deployment_requirement("idna"),
deployment_requirement("tqdm"),
deployment_requirement("requests_toolbelt"),
deployment_requirement("pkginfo"),
deployment_requirement("readme_renderer"),
deployment_requirement("pygments"),
deployment_requirement("docutils"),
deployment_requirement("bleach"),
deployment_requirement("webencodings"),
deployment_requirement("six"),
],
target = "//kglib:kglib"
)

deploy_pip(
name = "deploy-pip",
target = ":assemble-pip",
deployment_properties = "@graknlabs_build_tools//:deployment.properties",
)
Loading

0 comments on commit f6ede6c

Please sign in to comment.