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

Use pixi over setup scripts on CI + local dev #4302

Merged
merged 25 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4bbbe7e
ensure toolchain is installed on ci_docker
jprochazk Nov 21, 2023
06f16dc
remove `setup_web.sh` usage from `ci_docker`
jprochazk Nov 21, 2023
0c08660
delete `start_server.sh`
jprochazk Nov 21, 2023
b9b7931
add `binaryen` for `wasm-opt`
jprochazk Nov 21, 2023
af79d20
add `nox` (without `pipx`)
jprochazk Nov 21, 2023
1708155
remove usage of `pngcrush`
jprochazk Nov 21, 2023
bf438fd
add lib deps from `setup_dev.sh` to `troubleshooting.md`
jprochazk Nov 21, 2023
00b8e01
fix lint
jprochazk Nov 21, 2023
54667b6
remove `setup_web.sh` usage from build/upload rerun-cli
jprochazk Nov 22, 2023
8d8bccc
Merge branch 'main' into jan/obliterate-setup-scripts
jprochazk Nov 22, 2023
c72ba35
update cspell
jprochazk Nov 22, 2023
a61d65a
caching is slow
jprochazk Nov 22, 2023
b8f8350
use pixi to build rerun-cli
jprochazk Nov 22, 2023
42daff3
remove unused task
jprochazk Nov 22, 2023
f55bb22
fix get-sha jobs to use pr head ref
jprochazk Nov 22, 2023
4df2c73
use pixi to build wheel
jprochazk Nov 22, 2023
e303b48
build rerun cli by calling cargo directly via pixi
jprochazk Nov 22, 2023
0b6cc92
don't cache pixi anywhere
jprochazk Nov 22, 2023
2670bc0
i don't know bash
jprochazk Nov 22, 2023
57c9f32
test `pixi run` in `build_web_demo`
jprochazk Nov 22, 2023
a24f75a
use pixi in publish web
jprochazk Nov 22, 2023
110a569
reduce the number of dependencies installed in `build-web-demo`
jprochazk Nov 22, 2023
13f888e
remove `source_link_commit_override` in favor of `get-sha` step
jprochazk Nov 22, 2023
29d8ca5
upgrade `timm` to fix python3.11 compatibility
jprochazk Nov 22, 2023
472fd7d
Merge branch 'main' into jan/obliterate-setup-scripts
jprochazk Nov 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/contrib_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ jobs:
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.6.0
cache: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what did this do and why don't we want it anymore? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It builds a ~600 MB cache that takes 4 minutes to save. I'm not really sure why, but everything is still fast woithout it.


# TODO(emilk): make this work somehow. Right now this just results in
# > Compiler: GNU 12.3.0 (/__w/rerun/rerun/.pixi/env/bin/x86_64-conda-linux-gnu-c++)
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ jobs:
with:
CONCURRENCY: pr-${{ github.event.pull_request.number }}
WHEEL_ARTIFACT_NAME: linux-wheel-fast
SOURCE_LINK_COMMIT_OVERRIDE: ${{ github.event.pull_request.head.sha }}
secrets: inherit

track-sizes:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/reusable_build_and_upload_rerun_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ jobs:
id: get-sha
shell: bash
run: |
echo "sha=$(echo ${{ inputs.RELEASE_COMMIT || github.sha }} | cut -c1-7)" >> "$GITHUB_OUTPUT"
full_commit="${{ inputs.RELEASE_COMMIT || ((github.event_name == 'pull_request' && github.event.pull_request.head.ref) || github.sha) }}"
echo "sha=$(echo $full_commit | cut -c1-7)" >> "$GITHUB_OUTPUT"

- name: "Upload rerun_c (commit)"
uses: google-github-actions/upload-cloud-storage@v1
Expand All @@ -163,3 +164,4 @@ jobs:
path: "./target/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.LIB_NAME }}"
destination: "rerun-builds/adhoc/${{inputs.ADHOC_NAME}}/rerun_c/${{ inputs.PLATFORM }}"
parent: false

62 changes: 14 additions & 48 deletions .github/workflows/reusable_build_and_upload_rerun_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,56 +135,20 @@ jobs:
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
targets: ${{ needs.set-config.outputs.TARGET }}

# The pip-cache setup logic doesn't work in the ubuntu docker container
# That's probably fine since we bake these deps into the container already
- name: Setup python
if: ${{ inputs.PLATFORM != 'linux' }}
uses: actions/setup-python@v4
- uses: prefix-dev/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "scripts/ci/requirements.txt"

# These should already be in the docker container, but run for good measure. A no-op install
# should be fast, and this way things don't break if we add new packages without rebuilding
# docker
- run: pip install -r scripts/ci/requirements.txt

# We have a nice script for that: ./scripts/setup_web.sh
# Unfortunately, we can't run that on Windows, because Windows doesn't come with
# a package manager like grown-up OSes do (at least not the CI version of Windows).
# Also we can't run it on linux because the 20.04 Docker container will install
# an old version of binaryen/wasm-opt that barfs on the `--fast-math` flag
# So we only run the script on macos, and then on Windows we do the parts of the script manually.
# On ubuntu, the correct packages are pre-installed in our docker container.

- name: Install prerequisites for building the web-viewer Wasm (non-Windows)
if: (inputs.PLATFORM == 'macos-intel') || (inputs.PLATFORM == 'macos-arm')
shell: bash
run: ./scripts/setup_web.sh
pixi-version: v0.6.0

# The first steps of setup_web.sh, for Windows:
- name: Install wasm32 cargo target for building the web-viewer Wasm on windows
if: inputs.PLATFORM == 'windows'
- name: Build rerun-cli
shell: bash
run: rustup target add wasm32-unknown-unknown

# The last step of setup_web.sh, for Windows.
# Since 'winget' is not available within the GitHub runner, we download the package directly:
# See: https://github.com/marketplace/actions/engineerd-configurator
- name: Install binaryen for building the web-viewer Wasm on windows
if: inputs.PLATFORM == 'windows'
uses: engineerd/[email protected]
with:
name: "wasm-opt.exe"
url: "https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-windows.tar.gz"
pathInArchive: "binaryen-version_111/bin/wasm-opt.exe"

- name: Build rerun-cli (release)
uses: actions-rs/cargo@v1
with:
command: build
args: --locked -p rerun-cli --no-default-features --features native_viewer,web_viewer --release --target ${{ needs.set-config.outputs.TARGET }}
run: |
pixi run cargo build \
--locked \
-p rerun-cli \
--no-default-features \
--features native_viewer,web_viewer \
--release \
--target ${{ needs.set-config.outputs.TARGET }}

- id: "auth"
uses: google-github-actions/auth@v1
Expand All @@ -196,7 +160,8 @@ jobs:
id: get-sha
shell: bash
run: |
echo "sha=$(echo ${{ inputs.RELEASE_COMMIT || github.sha }} | cut -c1-7)" >> "$GITHUB_OUTPUT"
full_commit="${{ inputs.RELEASE_COMMIT || ((github.event_name == 'pull_request' && github.event.pull_request.head.ref) || github.sha) }}"
echo "sha=$(echo $full_commit | cut -c1-7)" >> "$GITHUB_OUTPUT"

- name: "Upload rerun-cli (commit)"
uses: google-github-actions/upload-cloud-storage@v1
Expand All @@ -212,3 +177,4 @@ jobs:
path: "./target/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.BIN_NAME }}"
destination: "rerun-builds/adhoc/${{inputs.ADHOC_NAME}}/rerun-cli/${{ inputs.PLATFORM }}"
parent: false

44 changes: 18 additions & 26 deletions .github/workflows/reusable_build_web_demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ on:
WHEEL_ARTIFACT_NAME:
required: true
type: string
# Each example in the built app contains a link to its source code.
# This determines the target commit to link to, and by default
# it is the current commit (github.sha)
SOURCE_LINK_COMMIT_OVERRIDE:
required: false
type: string

concurrency:
group: ${{ inputs.CONCURRENCY }}-build-web-demo
Expand Down Expand Up @@ -59,39 +53,37 @@ jobs:
name: ${{ inputs.WHEEL_ARTIFACT_NAME }}
path: wheel

- name: Install dependencies for examples/python
run: |
pip install -r scripts/ci/requirements.txt
pip install -r scripts/ci/requirements-web-demo.txt
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.6.0

- name: Install built wheel
- name: Install Python dependencies and wheel
shell: bash
run: |
pip uninstall rerun-sdk -y
pip install deprecated numpy>=1.23 pyarrow==10.0.1 pytest==7.1.2
pip install rerun-sdk --no-index --find-links wheel
pixi run pip install -r scripts/ci/requirements-web-demo.txt
pixi run pip uninstall rerun-sdk -y
pixi run pip install deprecated numpy>=1.23 pyarrow==10.0.1 pytest==7.1.2
pixi run pip install rerun-sdk --no-index --find-links wheel

- name: Verify built wheel version
shell: bash
run: |
python3 -m rerun --version
which rerun
rerun --version
pixi run python3 -m rerun --version
pixi run which rerun
pixi run rerun --version

- name: Resolve source link commit hash
- name: Get sha
id: get-sha
shell: bash
run: |
if [ -z "${{ inputs.SOURCE_LINK_COMMIT_OVERRIDE }}" ]; then
USED_SHA=${{ github.sha }}
else
USED_SHA=${{ inputs.SOURCE_LINK_COMMIT_OVERRIDE }}
fi
echo "SHORT_SHA=$(echo $USED_SHA | cut -c1-7)" >> $GITHUB_ENV
full_commit="${{ (github.event_name == 'pull_request' && github.event.pull_request.head.ref) || github.sha }}"
echo "sha=$(echo $full_commit | cut -c1-7)" >> "$GITHUB_OUTPUT"

- name: Build web demo
env:
COMMIT_HASH: ${{ env.SHORT_SHA }}
COMMIT_HASH: ${{ steps.get-sha.outputs.sha }}
run: |
python3 scripts/ci/build_demo_app.py --skip-build
pixi run python3 scripts/ci/build_demo_app.py --skip-build

- name: Upload web demo assets
uses: actions/upload-artifact@v3
Expand Down
64 changes: 10 additions & 54 deletions .github/workflows/reusable_build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,64 +123,20 @@ jobs:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}

# The pip-cache setup logic doesn't work in the ubuntu docker container
# That's probably fine since we bake these deps into the container already
- name: Setup python
if: ${{ inputs.PLATFORM != 'linux' }}
uses: actions/setup-python@v4
- uses: prefix-dev/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "scripts/ci/requirements.txt"

# These should already be in the docker container, but run for good measure. A no-op install
# should be fast, and this way things don't break if we add new packages without rebuilding
# docker
- run: pip install -r scripts/ci/requirements.txt

# We have a nice script for that: ./scripts/setup_web.sh
# Unfortunately, we can't run that on Windows, because Windows doesn't come with
# a package manager like grown-up OSes do (at least not the CI version of Windows).
# Also we can't run it on linux because the 20.04 Docker container will install
# an old version of binaryen/wasm-opt that barfs on the `--fast-math` flag
# So we only run the script on macos, and then on Windows we do the parts of the script manually.
# On ubuntu, the correct packages are pre-installed in our docker container.

- name: Install prerequisites for building the web-viewer Wasm (non-Windows)
if: (inputs.PLATFORM == 'macos-intel') || (inputs.PLATFORM == 'macos-arm')
shell: bash
run: ./scripts/setup_web.sh

# The first steps of setup_web.sh, for Windows:
- name: Install wasm32 cargo target for building the web-viewer Wasm on windows
if: inputs.PLATFORM == 'windows'
shell: bash
run: rustup target add wasm32-unknown-unknown

# The last step of setup_web.sh, for Windows.
# Since 'winget' is not available within the GitHub runner, we download the package directly:
# See: https://github.com/marketplace/actions/engineerd-configurator
- name: Install binaryen for building the web-viewer Wasm on windows
if: inputs.PLATFORM == 'windows'
uses: engineerd/[email protected]
with:
name: "wasm-opt.exe"
url: "https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-windows.tar.gz"
pathInArchive: "binaryen-version_111/bin/wasm-opt.exe"
pixi-version: v0.6.0

- name: Build Wheel
uses: PyO3/maturin-action@v1
with:
maturin-version: "0.14.17"
manylinux: manylinux_2_31
container: off
command: build
args: |
--manifest-path rerun_py/Cargo.toml
--release
--target ${{ needs.set-config.outputs.TARGET }}
run: |
pixi run pip install -r rerun_py/requirements-build.txt
pixi run maturin build \
--manylinux 2_31 \
--release \
--manifest-path rerun_py/Cargo.toml \
--target ${{ needs.set-config.outputs.TARGET }} \
--out dist \
${{ inputs.MATURIN_FEATURE_FLAGS }}
--out dist

- name: Save wheel artifact
if: ${{ inputs.WHEEL_ARTIFACT_NAME != '' }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/reusable_bundle_and_upload_rerun_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ jobs:
id: get-sha
shell: bash
run: |
echo "sha=$(echo ${{ inputs.RELEASE_COMMIT || github.sha }} | cut -c1-7)" >> "$GITHUB_OUTPUT"
full_commit="${{ inputs.RELEASE_COMMIT || ((github.event_name == 'pull_request' && github.event.pull_request.head.ref) || github.sha) }}"
echo "sha=$(echo $full_commit | cut -c1-7)" >> "$GITHUB_OUTPUT"

- name: "Bundle and upload rerun_cpp_sdk.zip"
run: python3 ./scripts/ci/bundle_and_upload_rerun_cpp.py --git-hash ${{ steps.get-sha.outputs.sha }} --platform-filter=${{ inputs.PLATFORM_FILTER }}

1 change: 0 additions & 1 deletion .github/workflows/reusable_checks_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ jobs:
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.6.0
cache: true

- name: Set up Rust
uses: ./.github/actions/setup-rust
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/reusable_deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ jobs:
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.6.0
cache: true

- name: Doxygen C++ docs
run: pixi run cpp-docs
Expand Down
38 changes: 15 additions & 23 deletions .github/workflows/reusable_publish_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ jobs:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}

- name: Install Python CI dependencies
run: pip install -r scripts/ci/requirements.txt
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.6.0

# built by `reusable_build_and_publish_wheels`
- name: Download Wheel
Expand All @@ -90,40 +91,31 @@ jobs:
name: ${{ inputs.rrd-artifact-name }}
path: rrd

- name: Install dependencies for examples/python
run: |
pip install -r scripts/ci/requirements.txt
pip install -r scripts/ci/requirements-web-demo.txt

- name: Install built wheel
- name: Install Python dependencies and wheel
shell: bash
run: |
pip uninstall rerun-sdk -y
pip install deprecated numpy>=1.23 pyarrow==10.0.1 pytest==7.1.2
pip install rerun-sdk --no-index --find-links wheel
pixi run pip install -r scripts/ci/requirements.txt
pixi run pip install -r scripts/ci/requirements-web-demo.txt
pixi run pip uninstall rerun-sdk -y
pixi run pip install deprecated numpy>=1.23 pyarrow==10.0.1 pytest==7.1.2
pixi run pip install rerun-sdk --no-index --find-links wheel

- name: Installed wheel version
shell: bash
run: |
python3 -m rerun --version
which rerun
rerun --version

- name: Install Wasm tools
shell: bash
run: ./scripts/setup_web.sh
pixi run python3 -m rerun --version
pixi run which rerun
pixi run rerun --version

- name: Build app.rerun.io
uses: actions-rs/cargo@v1
with:
command: run
args: --locked -p re_build_web_viewer -- --release
run: |
pixi run cargo run --locked -p re_build_web_viewer -- --release

- name: Build web demo
env:
COMMIT_HASH: ${{ needs.get-commit-sha.outputs.short-sha }}
run: |
python3 scripts/ci/build_demo_app.py --skip-build
pixi run python3 scripts/ci/build_demo_app.py --skip-build

- name: Upload .rrd for app.rerun.io
uses: google-github-actions/upload-cloud-storage@v1
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/reusable_upload_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ jobs:
id: get-sha
shell: bash
run: |
echo "sha=$(echo ${{ inputs.RELEASE_COMMIT || github.sha }} | cut -c1-7)" >> "$GITHUB_OUTPUT"
full_commit="${{ inputs.RELEASE_COMMIT || ((github.event_name == 'pull_request' && github.event.pull_request.head.ref) || github.sha) }}"
echo "sha=$(echo $full_commit | cut -c1-7)" >> "$GITHUB_OUTPUT"

- name: "Upload Wheel"
uses: google-github-actions/upload-cloud-storage@v1
Expand Down
10 changes: 6 additions & 4 deletions ci_docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ RUN set -eux; \
cargo --version; \
rustc --version;

# Install stuff from `rust-toolchain`
ADD rust-toolchain rust-toolchain
# `show` is currently the only way to install whatever is in `rust-toolchain`
# This is subject to change, but there is no alternative: https://github.com/rust-lang/rustup/issues/1397
RUN rustup show

# Install some cargo tools we know we'll always need
# We can't do this until after we've installed rust / cargo above
# Latest cargo-deny requires a rust update!
Expand All @@ -97,10 +103,6 @@ RUN pip install -r requirements-build.txt
ADD rerun_py/requirements-lint.txt requirements-lint.txt
RUN pip install -r requirements-lint.txt

# Install tools from setup_web.sh
ADD scripts/setup_web.sh setup_web.sh
# Installing binaryen is going to cause this script to fail, but that's ok -- we install it manually
RUN ./setup_web.sh || true
# Note: We need a more modern binaryen than ships on ubuntu-20.4, so we pull it from github
RUN curl -L https://github.com/WebAssembly/binaryen/releases/download/version_112/binaryen-version_112-x86_64-linux.tar.gz | tar xzk --strip-components 1

Expand Down
Loading
Loading