Skip to content

Commit

Permalink
Initial codespaces support and big bazel version bump (#72)
Browse files Browse the repository at this point in the history
* Initial codespaces support

* add missing file

* Update to a consistent bazel version and minor python update

* Add dotfiles

* A few more tweaks

* A few more updates and helpers

* Python update and rerun gazelle

* a few go fixes

* mem and cpu settings

* More ci tweaks
  • Loading branch information
jmeagher authored Sep 26, 2020
1 parent ec72ce6 commit 06f6dda
Show file tree
Hide file tree
Showing 28 changed files with 496 additions and 91 deletions.
4 changes: 1 addition & 3 deletions .bazelrc.travis
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
# This is from Bazel's former travis setup, to avoid blowing up the RAM usage.
startup --host_jvm_args=-Xmx1500m
startup --host_jvm_args=-Xms1500m
# startup --batch # we actually start many bazels in the test script, we don't want batch
test --ram_utilization_factor=10

# Just making sure that we don't OOM with parallel builds
build --local_resources 1024,.5,1.0
build --local_ram_resources=3072 --local_cpu_resources="HOST_CPUS*.5"

# This is so we understand failures better
build --verbose_failures
Expand Down
18 changes: 3 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,13 @@ jobs:
- save-caches
# - e2e-test - Leave this out for now until docker issues can be resolved

build-bazel-1-2:
build-bazel-3-4:
<<: *build-template
environment:
BAZEL_VER: "1.2.1"

build-bazel-2-2:
<<: *build-template
environment:
BAZEL_VER: "2.2.0"

build-bazel-3-0:
<<: *build-template
environment:
BAZEL_VER: "3.0.0"
BAZEL_VER: "3.4.1"

workflows:
version: 2
default_workflow:
jobs:
# - build-bazel-1-2
- build-bazel-2-2
# - build-bazel-3-0
- build-bazel-3-4
4 changes: 4 additions & 0 deletions .devcontainer/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
filegroup(
name = "srcs",
srcs = glob(["*"]),
)
30 changes: 30 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# You can pick any Debian/Ubuntu-based image. 😊
FROM mcr.microsoft.com/vscode/devcontainers/base:buster

# Options for setup script
ARG INSTALL_ZSH="true"
ARG UPGRADE_PACKAGES="false"
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
COPY library-scripts/*.sh /tmp/library-scripts/
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
&& apt-get install -y pkg-config zip g++ zlib1g-dev unzip python \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts

# Install Bazel
ARG BAZEL_VERSION=3.4.1
ARG BAZEL_DOWNLOAD_SHA=dev-mode
RUN curl -fSsL -o /tmp/bazel-installer.sh https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh \
&& ([ "${BAZEL_DOWNLOAD_SHA}" = "dev-mode" ] || echo "${BAZEL_DOWNLOAD_SHA} */tmp/bazel-installer.sh" | sha256sum --check - ) \
&& /bin/bash /tmp/bazel-installer.sh --base=/usr/local/bazel \
&& rm /tmp/bazel-installer.sh

# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
python3-distutils python3-dev python3-pip openjdk-11-jdk-headless \
jq entr tmux vim
5 changes: 5 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Codespaces setup

See https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/personalizing-codespaces-for-your-account

and example project https://github.com/microsoft/vscode-dev-containers/tree/master/containers/bazel
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

{
"name": "Bazel (Community)",
"build": {
"dockerfile": "Dockerfile",
"args": {
"BAZEL_VERSION": "3.4.1",
"BAZEL_DOWNLOAD_SHA": "9808adad931ac652e8ff5022a74507c532250c2091d21d6aebc7064573669cc5"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/usr/bin/zsh"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"devondcarew.bazel-code"
]

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"

}
4 changes: 4 additions & 0 deletions .devcontainer/library-scripts/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
filegroup(
name = "srcs",
srcs = glob(["*"]),
)
Loading

0 comments on commit 06f6dda

Please sign in to comment.