Skip to content

Commit

Permalink
build: bump rules_docker and instructions for installing bazelisk (#1680
Browse files Browse the repository at this point in the history
)
  • Loading branch information
subotic committed Jul 20, 2020
1 parent 49bedbe commit 55518d7
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 35 deletions.
1 change: 1 addition & 0 deletions .bazelversion
@@ -0,0 +1 @@
3.4.1
74 changes: 55 additions & 19 deletions .github/workflows/main.yml
Expand Up @@ -19,10 +19,17 @@ jobs:
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect
- name: Setup Bazel
uses: abhinavsingh/setup-bazel@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
version: 3.3.0
python-version: 3.8
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Install dependencies
run: |
npm install --global @bazel/bazelisk
- name: cache maven artifacts
uses: actions/cache@v1
with:
Expand Down Expand Up @@ -60,10 +67,17 @@ jobs:
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect
- name: Setup Bazel
uses: abhinavsingh/setup-bazel@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
version: 3.3.0
python-version: 3.8
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Install dependencies
run: |
npm install --global @bazel/bazelisk
- name: cache maven artifacts
uses: actions/cache@v1
with:
Expand Down Expand Up @@ -105,10 +119,20 @@ jobs:
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect
- name: Setup Bazel
uses: abhinavsingh/setup-bazel@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Set up Node
uses: actions/setup-node@v1
with:
version: 3.3.0
node-version: '12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
npm install --global typedoc
npm install --global @bazel/bazelisk
- name: cache maven artifacts
uses: actions/cache@v1
with:
Expand Down Expand Up @@ -150,10 +174,17 @@ jobs:
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect
- name: Setup Bazel
uses: abhinavsingh/setup-bazel@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Set up Node
uses: actions/setup-node@v1
with:
version: 3.3.0
node-version: '12'
- name: Install dependencies
run: |
npm install --global @bazel/bazelisk
- name: cache maven artifacts
uses: actions/cache@v1
with:
Expand Down Expand Up @@ -195,10 +226,17 @@ jobs:
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect
- name: Setup Bazel
uses: abhinavsingh/setup-bazel@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Set up Node
uses: actions/setup-node@v1
with:
version: 3.3.0
node-version: '12'
- name: Install dependencies
run: |
npm install --global @bazel/bazelisk
- name: cache maven artifacts
uses: actions/cache@v1
with:
Expand Down Expand Up @@ -244,6 +282,7 @@ jobs:
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
npm install --global typedoc
npm install --global @bazel/bazelisk
sudo apt-get install graphviz
- name: Disk Free
run: |
Expand Down Expand Up @@ -280,10 +319,6 @@ jobs:
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect
- name: Setup Bazel
uses: abhinavsingh/setup-bazel@v3
with:
version: 3.3.0
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
Expand All @@ -297,6 +332,7 @@ jobs:
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
npm install --global typedoc
npm install --global @bazel/bazelisk
sudo apt-get install graphviz
- name: cache maven artifacts
uses: actions/cache@v1
Expand Down
8 changes: 6 additions & 2 deletions README.md
Expand Up @@ -75,10 +75,14 @@ export JAVA_HOME=`/usr/libexec/java_home -v 11`
To install, follow these steps:

```
$ brew install bazel
$ brew upgrade bazel
$ npm install -g @bazel/bazelisk
```

This will install [bazelisk](https://github.com/bazelbuild/bazelisk) which is
a wrapper to the `bazel` binary. It will, when `bazel` is run on the command line,
automatically install the supported Bazel version, defined in the `.bazelversion`
file in the root of the `knora-api` repository.

### For building the documentation

See [docs/Readme.md](docs/Readme.md).
Expand Down
28 changes: 22 additions & 6 deletions WORKSPACE
Expand Up @@ -178,33 +178,47 @@ go_rules_dependencies()
go_register_toolchains()

#
# Download the rules_docker repository at release v0.12.0
# Download the rules_docker repository at release v0.14.4
#
rules_docker_version="0.13.0"
rules_docker_version_sha256="df13123c44b4a4ff2c2f337b906763879d94871d16411bf82dcfeba892b58607"
rules_docker_version="0.14.4"
rules_docker_version_sha256="4521794f0fba2e20f3bf15846ab5e01d5332e587e9ce81629c7f96c793bb7036"
http_archive(
name = "io_bazel_rules_docker",
sha256 = rules_docker_version_sha256,
strip_prefix = "rules_docker-%s" % rules_docker_version,
url = "https://github.com/bazelbuild/rules_docker/releases/download/v%s/rules_docker-v%s.tar.gz" % (rules_docker_version, rules_docker_version),
)

# load rules_docker repositories
load(
"@io_bazel_rules_docker//repositories:repositories.bzl",
container_repositories = "repositories",
)
container_repositories()

# load further dependencies of this rule
load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")

container_deps()

load("@io_bazel_rules_docker//repositories:pip_repositories.bzl", "pip_deps")

pip_deps()

# load container_pull method
load(
"@io_bazel_rules_docker//container:container.bzl",
"container_pull"
"container_pull",
)

# get distroless java
container_pull(
name = "java_base",
registry = "gcr.io",
repository = "distroless/java",
# 'tag' is also supported, but digest is encouraged for reproducibility.
digest = "sha256:deadbeef",
)

# get openjdk
container_pull(
name = "openjdk11",
registry = "docker.io",
Expand All @@ -213,6 +227,7 @@ container_pull(
digest = "sha256:0e51b455654bd162c485a6a6b5b120cc82db453d9265cc90f0c4fb5d14e2f62e",
)

# get sipi
load("//third_party:versions.bzl", "SIPI_REPOSITORY", "SIPI_TAG")
container_pull(
name = "sipi",
Expand All @@ -222,6 +237,7 @@ container_pull(
digest = "sha256:7b7abd324d0887f3ff46de7d7f066dd699b3acd96b94177f153f750f7572031c",
)

# get fuseki
load("//third_party:versions.bzl", "FUSEKI_REPOSITORY", "FUSEKI_TAG")
container_pull(
name = "jenafuseki",
Expand Down
2 changes: 1 addition & 1 deletion docker/knora-salsah1/BUILD.bazel
Expand Up @@ -34,7 +34,7 @@ container_push(
name = "push",
image = ":image",
format = "Docker",
registry = "docker.io",
registry = "index.docker.io",
repository = "daschswiss/knora-salsah1",
tag = "{BUILD_SCM_TAG}"
)
Expand Down
20 changes: 13 additions & 7 deletions docs/05-internals/development/bazel.md
Expand Up @@ -4,21 +4,27 @@ The following section discusses on how to build and run tests for Knora-API
with [Bazel](https://bazel.build).

## Prerequisites
To install Bazel on macOS, run `brew install bazel`.
To install the Bazel build tool, follow these steps:

```
$ npm install -g @bazel/bazelisk
```

This will install [bazelisk](https://github.com/bazelbuild/bazelisk) which is
a wrapper to the `bazel` binary. It will, when the `bazel` command ir run,
automatically install the supported Bazel version, defined in the `.bazelversion`
file in the root of the `knora-api` repository.

## Commands

Build `webapi`:

```
# build webapi
$ bazel build //webapi
# run api (webapi)
$ bazel run //:api
$ bazel build //webapi/...
# run all tests
$ bazel test //...
# run all webapi tests
$ bazel test //webapi//...
```

## Build Structure
Expand Down

0 comments on commit 55518d7

Please sign in to comment.