Skip to content

Commit

Permalink
Support local CI on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Rempel authored and mvines committed Jun 20, 2022
1 parent 611d2ec commit 1ee4b41
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 13 deletions.
32 changes: 32 additions & 0 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@
Our CI infrastructure is built around [BuildKite](https://buildkite.com) with some
additional GitHub integration provided by https://github.com/mvines/ci-gate

# Running Locally

To run the CI suite locally, you can run the `run-local.sh` script.

Before you do, there are a few dependencies that need to be installed:

```bash
cargo install grcov cargo-audit
```

## macOS

On macOS, you will need to install coreutils:

```bash
brew install coreutils
```

Make sure to update your PATH environment variable:

```bash
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
```

If you notice the error `UnableToSetOpenFileDescriptorLimit` you may need to
increase the number of available file descriptors:

```bash
sudo launchctl limit maxfiles 100000
ulimit -n 1000000
```

# Agent Queues

We define two [Agent Queues](https://buildkite.com/docs/agent/v3/queues):
Expand Down
10 changes: 0 additions & 10 deletions ci/run-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ export CI_LOCAL_RUN=true

set -e

case $(uname -o) in
*/Linux)
export CI_OS_NAME=linux
;;
*)
echo "local CI runs are only supported on Linux" 1>&2
exit 1
;;
esac

steps=()
steps+=(test-sanity)
steps+=(shellcheck)
Expand Down
7 changes: 6 additions & 1 deletion ci/test-stable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export RUSTFLAGS="-D warnings"
source scripts/ulimit-n.sh

# limit jobs to 4gb/thread
JOBS=$(grep MemTotal /proc/meminfo | awk '{printf "%.0f", ($2 / (4 * 1024 * 1024))}')
if [[ -f "/proc/meminfo" ]]; then
JOBS=$(grep MemTotal /proc/meminfo | awk '{printf "%.0f", ($2 / (4 * 1024 * 1024))}')
else
JOBS=$(sysctl hw.memsize | awk '{printf "%.0f", ($2 / (4 * 1024**3))}')
fi

NPROC=$(nproc)
JOBS=$((JOBS>NPROC ? NPROC : JOBS))

Expand Down
7 changes: 6 additions & 1 deletion scripts/coverage-in-disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ if [[ -n $CI || -z $1 ]]; then
fi

# limit jobs to 4gb/thread
JOBS=$(grep MemTotal /proc/meminfo | awk '{printf "%.0f", ($2 / (4 * 1024 * 1024))}')
if [[ -f "/proc/meminfo" ]]; then
JOBS=$(grep MemTotal /proc/meminfo | awk '{printf "%.0f", ($2 / (4 * 1024 * 1024))}')
else
JOBS=$(sysctl hw.memsize | awk '{printf "%.0f", ($2 / (4 * 1024**3))}')
fi

NPROC=$(nproc)
JOBS=$((JOBS>NPROC ? NPROC : JOBS))

Expand Down
7 changes: 6 additions & 1 deletion scripts/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ if [[ -n $CI || -z $1 ]]; then
fi

# limit jobs to 4gb/thread
JOBS=$(grep MemTotal /proc/meminfo | awk '{printf "%.0f", ($2 / (4 * 1024 * 1024))}')
if [[ -f "/proc/meminfo" ]]; then
JOBS=$(grep MemTotal /proc/meminfo | awk '{printf "%.0f", ($2 / (4 * 1024 * 1024))}')
else
JOBS=$(sysctl hw.memsize | awk '{printf "%.0f", ($2 / (4 * 1024**3))}')
fi

NPROC=$(nproc)
JOBS=$((JOBS>NPROC ? NPROC : JOBS))

Expand Down

0 comments on commit 1ee4b41

Please sign in to comment.