Skip to content

Rename RangedPlayback capability to PlaybackControl (#879) #4329

Rename RangedPlayback capability to PlaybackControl (#879)

Rename RangedPlayback capability to PlaybackControl (#879) #4329

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ["**"]
pull_request: {}
jobs:
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
lfs: true
- name: Install common dependencies
uses: ./.github/actions/common-deps
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: "29.x"
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# The last-specified toolchain is the default.
toolchain: 1.83.0,nightly,stable
components: rustfmt, clippy
- name: Ensure generated protobuf schemas are up to date
run: cargo run --bin foxglove_proto_gen && git diff --exit-code
- run: cargo fmt --all --check
- run: cargo build --verbose
# Validate that we can build each example individually.
- name: Build examples individually
run: |
set -euo pipefail
cargo metadata --no-deps --format-version 1 \
| jq -r ".packages[].name" \
| grep example \
| while read package; do
echo "Building $package"
cargo build -p "$package"
done
# Validate that we can build without default features.
- run: cargo build -p foxglove --verbose --no-default-features
# Validate that we can build against the MSRV (minimum specified rust version).
- run: cargo +1.83.0 build -p foxglove --verbose
- run: cargo clippy --no-deps --all-targets --tests -- -D warnings
- run: cargo +nightly rustdoc -p foxglove --all-features -- -D warnings --cfg docsrs
- run: "[ -d ./target/doc/foxglove ] || exit 1"
- name: Check for ws-protocol references in public docs
run: '! grep -R "foxglove/ws-protocol" ./target/doc/foxglove'
- run: cargo test --all-features --verbose
timeout-minutes: 5
- run: cargo test -p foxglove --no-default-features --verbose
timeout-minutes: 5
release-rust:
if: startsWith(github.ref, 'refs/tags/sdk/v')
runs-on: ubuntu-latest
needs: rust
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- id: detect-version
name: Detect local Cargo version
run: |
version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name=="'foxglove'").version')
echo "version=$version" >> $GITHUB_OUTPUT
- name: Publish foxglove_derive
run: cargo publish --package foxglove_derive
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Wait for foxglove_derive to be published
run: until cargo info --registry=crates-io foxglove_derive@${{ steps.detect-version.outputs.version }}; do sleep 10; done
- name: Publish foxglove
run: cargo publish --package foxglove
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
release-foxglove-data-loader:
if: startsWith(github.ref, 'refs/tags/rust/foxglove_data_loader/v')
runs-on: ubuntu-latest
needs: rust
timeout-minutes: 10
env:
github_ref: ${{ github.ref }}
steps:
- uses: actions/checkout@v6
- id: detect-version
name: Detect local Cargo version
run: |
set -eu
version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name=="'foxglove_data_loader'").version')
echo "version=$version" >> $GITHUB_OUTPUT
# remove the prefix from the github ref to get the version
expected_version="${github_ref#"refs/tags/rust/foxglove_data_loader/v"}"
if [ "$version" != "$expected_version" ]; then
echo "Expected version '$expected_version' but got '$version'"
exit 1
fi
- name: Publish foxglove_data_loader
run: cargo publish --package foxglove_data_loader
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
typescript:
runs-on: ubuntu-latest
permissions:
contents: read
# https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions
id-token: write
steps:
- uses: actions/checkout@v6
- run: corepack enable
- uses: actions/setup-node@v6
with:
node-version: 22
cache: yarn
registry-url: https://registry.npmjs.org
- name: Install Flatbuffer compiler
run: |
curl -LO https://github.com/google/flatbuffers/releases/download/v23.1.21/Linux.flatc.binary.clang++-12.zip
echo "359dbbf56153cc1b022170a228adfde4199f67dc Linux.flatc.binary.clang++-12.zip" | shasum -a 1 -c
unzip Linux.flatc.binary.clang++-12.zip
rm Linux.flatc.binary.clang++-12.zip
sudo mv flatc /usr/local/bin
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: "29.x"
- run: yarn install --immutable
- run: yarn lint:ci
# must run this first because it copies the jsonschema directory
- run: yarn workspace @foxglove/schemas build
# typecheck remaining files in the repo
- run: yarn build
- run: yarn test
# Install python dependencies required to prettify generated SDK files
- uses: actions/setup-python@v6
with:
python-version: "3.10"
- uses: astral-sh/setup-uv@v7
- name: Ensure generated files are up to date
run: |
yarn generate
git add --all
changes=$(git status --porcelain)
if [ -n "$changes" ]; then
echo "::error::The following generated files need to be updated. Run 'make generate' to update them."
echo "$changes"
echo ""
git diff --cached
exit 1
else
echo "Generated schemas are up to date!"
fi
- name: Validate Flatbuffer definitions
run: |
output=$(flatc --require-explicit-ids --ts -o /dev/null ./schemas/flatbuffer/*.fbs)
if [ -n "$output" ]; then
echo "::error::Flatbuffer schema compilation had warnings or errors. Fix them to proceed:"
echo "$output"
exit 1
fi
- name: Validate protobuf definitions
run: protoc --proto_path=schemas/proto schemas/proto/**/*.proto --descriptor_set_out=/dev/null
- run: yarn workspace @foxglove/schemas pack
- name: Publish @foxglove/schemas to NPM
if: startsWith(github.ref, 'refs/tags/typescript/schemas/v')
run: npx npm@11.7.0 publish typescript/schemas/package.tgz --provenance --access public