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

build: Lock GitHub runners' OS #1765

Merged
merged 5 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
121 changes: 69 additions & 52 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
python-version: ["3.9", "3.10"]
target: ["dataplane", "model-repository"]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -36,8 +36,10 @@ jobs:
lint:
strategy:
matrix:
python-version: ["3.9", "3.10"]
runs-on: ubuntu-latest
python-version:
- "3.9"
- "3.10"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -57,33 +59,30 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os:
- ubuntu-22.04
- macos-13
# NOTE: There's no pre-built `grpcio` wheel for Python 3.11 yet
# https://github.com/grpc/grpc/issues/32454
python-version: ["3.9", "3.10"]
python-version:
- "3.9"
- "3.10"
is-pr:
- ${{ github.event_name == 'pull_request' }}
exclude:
# MacOS tests take a lot of time, so we will run them only on merge
# From https://github.com/orgs/community/discussions/26253
- is-pr: true
os: macos-latest
os: macos-13
runs-on: ${{ matrix.os }}
steps:
- name: Setup docker (missing on MacOS)
if: runner.os == 'macos'
run: |
# From https://github.com/actions/runner-images/issues/17#issuecomment-1537238473
# From https://github.com/abiosoft/colima/discussions/273#discussioncomment-4959736
# NOTE: Use the `slirp` driver rather than the default to avoid
# random connection errors.
# From https://github.com/abiosoft/colima/issues/577
brew install docker docker-buildx
mkdir -p $HOME/.docker/cli-plugins
ln -sfn $(which docker-buildx) $HOME/.docker/cli-plugins/docker-buildx
colima start --memory 5 --network-driver slirp
jesse-c marked this conversation as resolved.
Show resolved Hide resolved
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- uses: actions/checkout@v4
- name: Setup Docker (missing on MacOS)
if: runner.os == 'macos'
run: ./hack/install-docker-macos.sh
- name: Install OpenMP (in MacOS)
if: runner.os == 'macOS'
run: brew install libomp
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -97,16 +96,28 @@ jobs:
with:
virtualenvs-create: false
- name: Install Dependencies
run: poetry install --sync --only dev
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
poetry install --sync --only dev
- name: Test
run: tox -e mlserver
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
tox -e mlserver

runtimes:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10"]
os:
- ubuntu-22.04
- macos-13
python-version:
- "3.9"
- "3.10"
tox-environment:
- sklearn
- xgboost
Expand All @@ -122,10 +133,13 @@ jobs:
# MacOS tests take a lot of time, so we will run them only on merge
# From https://github.com/orgs/community/discussions/26253
- is-pr: true
os: macos-latest
os: macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install OpenMP (in MacOS)
if: runner.os == 'macOS'
run: brew install libomp
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -139,18 +153,30 @@ jobs:
with:
virtualenvs-create: false
- name: Install Dependencies
run: poetry install --sync --only dev
run: |
jesse-c marked this conversation as resolved.
Show resolved Hide resolved
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
poetry install --sync --only dev
- name: Test
run: tox -c ./runtimes/${{ matrix.tox-environment }}
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
tox -c ./runtimes/${{ matrix.tox-environment }}

# Ensure that having all the runtimes installed together works
all-runtimes:
if: github.event_name == 'push'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10"]
os:
- ubuntu-22.04
- macos-13
python-version:
- "3.9"
- "3.10"
runs-on: ${{ matrix.os }}
steps:
- name: Maximize build space
Expand All @@ -164,30 +190,13 @@ jobs:
remove-docker-images: 'true'
overprovision-lvm: 'true'
swap-size-mb: 1024
- name: Setup docker (missing on MacOS)
- uses: actions/checkout@v4
- name: Setup Docker (missing on MacOS)
if: runner.os == 'macOS'
run: |
# From https://github.com/actions/runner-images/issues/17#issuecomment-1537238473
# From https://github.com/abiosoft/colima/discussions/273#discussioncomment-4959736
# NOTE: Use the `slirp` driver rather than the default to avoid
# random connection errors.
# From https://github.com/abiosoft/colima/issues/577
brew install docker docker-buildx
mkdir -p $HOME/.docker/cli-plugins
ln -sfn $(which docker-buildx) $HOME/.docker/cli-plugins/docker-buildx
colima start --memory 5 --network-driver slirp
jesse-c marked this conversation as resolved.
Show resolved Hide resolved
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- name: Downgrade OpenMP (in MacOS)
run: ./hack/install-docker-macos.sh
- name: Install OpenMP (in MacOS)
if: runner.os == 'macOS'
run: |
# Recent versions of OpenMP cause segfaults in MacOS when training
# LightGBM / XGBoost models (but only when Torch is present)
# https://github.com/microsoft/LightGBM/issues/4229
# https://github.com/autogluon/autogluon/issues/1442
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/fb8323f2b170bd4ae97e1bac9bf3e2983af3fdb0/Formula/libomp.rb
brew unlink libomp
brew install libomp.rb
- uses: actions/checkout@v4
run: brew install libomp
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -201,6 +210,14 @@ jobs:
with:
virtualenvs-create: false
- name: Install Dependencies
run: poetry install --sync --only dev
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
poetry install --sync --only dev
- name: Test
run: tox -e all-runtimes
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
tox -e all-runtimes
6 changes: 6 additions & 0 deletions hack/activate-libomp-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -Eeuo pipefail

export LDFLAGS="-L/usr/local/opt/libomp/lib"
export CPPFLAGS="-I/usr/local/opt/libomp/include"
24 changes: 24 additions & 0 deletions hack/install-docker-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -Eeuo pipefail

# Install Docker
# From https://github.com/actions/runner-images/issues/17#issuecomment-1537238473
# From https://github.com/abiosoft/colima/discussions/273#discussioncomment-4959736
brew install docker docker-buildx
mkdir -p $HOME/.docker/cli-plugins
ln -sfn $(which docker-buildx) $HOME/.docker/cli-plugins/docker-buildx

# Install Lima
brew install lima
# Don't explicitly start Lima here (e.g. with `limactl start`).
# Let Colina do that, otherwise, # Colima seems to hang
# waiting for the SSH requirement to be met.

# Install Colima
sudo mkdir -p /usr/local/bin
sudo curl -L -o /usr/local/bin/colima https://github.com/abiosoft/colima/releases/download/v0.6.9/colima-Darwin-x86_64 && sudo chmod +x /usr/local/bin/colima
colima start --memory 5 --runtime docker

# Link Colima and Docker
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock