Fix pre-built installation instructions #1083
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- "src/**" | |
- "test/**" | |
- "Project.toml" | |
- ".github/workflows/CI.yml" | |
pull_request: | |
paths: | |
- "src/**" | |
- "test/**" | |
- "Project.toml" | |
- ".github/workflows/CI.yml" | |
concurrency: | |
# Skip intermediate builds: always. | |
# Cancel intermediate builds: only if it is a pull request build. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | |
env: | |
build_dir: ./build | |
ray_dir: ./build/ray | |
tarballs_dir: ./build/tarballs | |
jobs: | |
test: | |
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
- "1.8" # Version used with MVP | |
- "1.9" # Latest release | |
os: | |
- ubuntu-20.04-16core | |
- macos-latest-xlarge # Apple silicon | |
arch: | |
- x64 | |
- aarch64 | |
exclude: | |
- os: ubuntu-20.04-16core | |
arch: aarch64 | |
- os: macos-latest-xlarge | |
arch: x64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Determine Ray commit | |
id: ray-commit | |
run: | | |
read -r sha < build/ray_commit | |
echo "sha=$sha" | tee -a "$GITHUB_OUTPUT" | |
- name: Clone Ray repository | |
uses: actions/checkout@v3 | |
with: | |
repository: beacon-biosignals/ray | |
path: ${{ env.ray_dir }} | |
ref: ${{ steps.ray-commit.outputs.sha }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: pip | |
cache-dependency-path: ${{ env.ray_dir }}/python/setup.py | |
- uses: julia-actions/setup-julia@v1 | |
with: | |
version: ${{ matrix.version }} | |
arch: ${{ matrix.arch }} | |
- uses: julia-actions/cache@v1 | |
with: | |
cache-name: "${{ github.workflow }}-${{ github.job }}-${{ matrix.pkg.name }}-${{ matrix.version }}-${{ matrix.os }}-${{ matrix.arch }}" | |
cache-compiled: true | |
# TODO: We shouldn't require separate caches per Julia version but allow cache restores to work | |
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key | |
# https://github.com/beacon-biosignals/Ray.jl/issues/63 | |
- name: Restore build cache | |
uses: actions/cache/restore@v3 | |
id: build-cache | |
with: | |
key: build-cache.ray-jl.${{ matrix.os }}.${{ matrix.arch }}.julia-${{ matrix.version }}.ray-${{ steps.ray-commit.outputs.sha }}.hash-${{ hashFiles('build/WORKSPACE.bazel.tpl', 'build/BUILD.bazel') }} | |
path: ~/.cache | |
restore-keys: | | |
build-cache.ray-jl.${{ matrix.os }}.${{ matrix.arch }}.julia-${{ matrix.version }}.ray-${{ steps.ray-commit.outputs.sha }}. | |
build-cache.ray-jl.${{ matrix.os }}.${{ matrix.arch }}.julia-${{ matrix.version }}. | |
# Based upon: | |
# https://docs.ray.io/en/releases-2.5.1/ray-contribute/development.html#building-ray-on-linux-macos-full | |
- name: Build Ray CLI | |
run: | | |
pip install --upgrade pip wheel | |
# Use `~/.cache/bazel` as the Bazel cache directory on macOS | |
# https://bazel.build/remote/output-directories | |
if [ "$(uname -s)" = "Darwin" ]; then | |
mkdir -p ~/.cache/bazel/_bazel_$USER | |
rm -rf /private/var/tmp/_bazel_$USER # Bazel cached data may be present from unrelated builds | |
ln -s ~/.cache/bazel/_bazel_$USER /private/var/tmp/_bazel_$USER | |
fi | |
# The Ray BUILD.bazel includes a bunch of `copy_to_workspace` rules which copy build output | |
# into the Ray worktree. When we only restore the Bazel cache then re-building causes these | |
# rules to be skipped resulting in `error: [Errno 2] No such file or directory`. By manually | |
# saving/restoring these files we can work around this. | |
RAY_GEN_CACHE_DIR=~/.cache/ray-generated | |
if [ -d "$RAY_GEN_CACHE_DIR" ]; then | |
ray_repo=$(pwd) | |
srcs=( | |
python/ray/_raylet.so \ | |
python/ray/core/generated \ | |
python/ray/serve/generated \ | |
python/ray/core/src/ray/raylet/raylet \ | |
python/ray/core/src/ray/gcs \ | |
) | |
# Reimplemented `cp --parents` as this isn't supported by macOS | |
for rel in "${srcs[@]}"; do | |
echo "Restoring $rel" >&2 | |
src="$RAY_GEN_CACHE_DIR/$rel" | |
dest=$(dirname "$ray_repo/$rel") | |
mkdir -p $dest | |
cp -rp $src $dest | |
done | |
fi | |
pushd python | |
pip install . --verbose # Fresh build takes ~50 minutes on basic GH runner | |
popd | |
# By copying the entire Ray worktree we can easily restore missing files without having to | |
# delete the cache and build from scratch. Skip copy when we don't save the cache. | |
if [ "${{ steps.build-cache.outputs.cache-hit }}" != "true" ]; then | |
mkdir -p "$RAY_GEN_CACHE_DIR" | |
cp -rfp . "$RAY_GEN_CACHE_DIR" | |
fi | |
# Verify Ray CLI works | |
echo "Verify Ray CLI works" >&2 | |
ray --version | |
working-directory: ${{ env.ray_dir }} | |
- name: Build ray_julia library | |
id: ray_julia | |
shell: julia --color=yes --project {0} | |
run: | | |
using Pkg | |
Pkg.instantiate() | |
include(joinpath(pwd(), "build_tarballs.jl")) | |
tarball_path = build_host_tarball() | |
open(ENV["GITHUB_OUTPUT"], "a") do io | |
println(io, "tarball_path=$tarball_path") | |
end | |
working-directory: ${{ env.build_dir }} | |
- uses: julia-actions/julia-buildpkg@v1 | |
- uses: julia-actions/julia-runtest@v1 | |
with: | |
annotate: true | |
- uses: julia-actions/julia-processcoverage@v1 | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: lcov.info | |
flags: Ray.jl | |
# Add the ray_julia library from each job to the same artifact | |
# https://github.com/actions/upload-artifact#uploading-to-the-same-artifact | |
- name: Save ray_julia library | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ray_julia_libraries | |
path: ${{ steps.ray_julia.outputs.tarball_path }} | |
- name: Save Ray logs | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: ray-logs.${{ matrix.os }}.${{ matrix.arch }}.julia-${{ matrix.version }}.run-${{ github.run_number }} | |
path: /tmp/ray/session_latest/logs | |
# https://github.com/actions/cache/tree/main/save#always-save-cache | |
- name: Save build cache | |
uses: actions/cache/save@v3 | |
if: always() && steps.build-cache.outputs.cache-hit != 'true' | |
with: | |
key: ${{ steps.build-cache.outputs.cache-primary-key }} | |
path: ~/.cache |