Skip to content

Commit

Permalink
Add CI and other stuff from rerun_template (#1)
Browse files Browse the repository at this point in the history
https://github.com/rerun-io/rerun_template/ is our new standardized (and
still work-in-progress) setup for our repositories.

This copies over a bunch of that standard  setup to `revy`.

The most important change is the addition of a CI.

Everything was copied over using `./scripts/template_update.py update
--languages rust`, which can also be run in the future to copy over new
things from the template repo (e.g. more improved CI). I broke it all up
into commits for easy review.

@teh-cmc please take a look and see if you think this makes sense.

---------

Co-authored-by: Clement Rey <[email protected]>
  • Loading branch information
emilk and teh-cmc authored Apr 18, 2024
1 parent 697d814 commit ff0ca3d
Show file tree
Hide file tree
Showing 19 changed files with 1,188 additions and 70 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copied from https://github.com/rerun-io/rerun_template

# https://github.com/marketplace/actions/require-labels
# Check for existence of labels
# See all our labels at https://github.com/rerun-io/rerun/issues/labels

name: PR Labels

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled

jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check for a "do-not-merge" label
uses: mheap/github-action-required-labels@v3
with:
mode: exactly
count: 0
labels: "do-not-merge"

- name: Require label "include in changelog" or "exclude from changelog"
uses: mheap/github-action-required-labels@v3
with:
mode: minimum
count: 1
labels: "exclude from changelog, include in changelog"
29 changes: 29 additions & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copied from https://github.com/rerun-io/rerun_template
on: [push, pull_request]

name: Link checker

jobs:
link-checker:
name: Check links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Restore link checker cache
uses: actions/cache@v3
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

# Check https://github.com/lycheeverse/lychee on how to run locally.
- name: Link Checker
id: lychee
uses: lycheeverse/[email protected]
with:
fail: true
lycheeVersion: "0.14.3"
# When given a directory, lychee checks only markdown, html and text files, everything else we have to glob in manually.
args: |
--base . --cache --max-cache-age 1d . "**/*.rs" "**/*.toml" "**/*.hpp" "**/*.cpp" "**/CMakeLists.txt" "**/*.py" "**/*.yml"
109 changes: 109 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Copied from https://github.com/rerun-io/rerun_template
on: [push, pull_request]

name: Rust

env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings

jobs:
rust-check:
name: Rust
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: 1.76.0
override: true

- name: Install packages (Linux)
uses: awalsh128/[email protected]
with:
# Random stuff required by `bevy`
packages: libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libasound2-dev libudev-dev
version: 1.0
execute_install_scripts: true

- name: Set up cargo cache
uses: Swatinem/rust-cache@v2

- name: Rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Install cargo-cranky
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-cranky

- name: check --all-features
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features --all-targets

- name: check default features
uses: actions-rs/cargo@v1
with:
command: check
args: --all-targets

- name: check --no-default-features
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --lib --all-targets

- name: Test doc-tests
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --all-features

- name: cargo doc --lib
uses: actions-rs/cargo@v1
with:
command: doc
args: --lib --no-deps --all-features

- name: cargo doc --document-private-items
uses: actions-rs/cargo@v1
with:
command: doc
args: --document-private-items --no-deps --all-features

- name: Build tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-run

- name: Run test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features

- name: Cranky
uses: actions-rs/cargo@v1
with:
command: cranky
args: --all-targets --all-features -- -D warnings

# ---------------------------------------------------------------------------

cargo-deny:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
rust-version: "1.76.0"
log-level: warn
command: check
19 changes: 19 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copied from https://github.com/rerun-io/rerun_template

# https://github.com/crate-ci/typos
# Add exceptions to `.typos.toml`
# install and run locally: cargo install typos-cli && typos

name: Spell Check
on: [pull_request]

jobs:
run:
name: Spell Check
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4

- name: Check spelling of entire workspace
uses: crate-ci/typos@master
61 changes: 7 additions & 54 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,59 +1,12 @@
# Mac stuff:
.DS_Store

# Codegen stuff:
crates/re_types/source_hash.txt
crates/re_types_builder/source_hash.txt
# Rust compile target directories:
target
target_ra
target_wasm

# C++ and CMake stuff:
*.a
*.bin
*.o
**/arrow/
**/build/
**/build-msvc/
**/CMakeFiles/
**/CMakeCache.txt
**/Makefile
**/cmake_install.cmake
_deps
**/.cache/
**/rerun_cpp/docs/html
# https://github.com/lycheeverse/lychee
.lycheecache

# Rust compile target directory:
**/target
**/target_ra
**/target_wasm

# Python virtual environment:
**/venv*
.python-version

# Python build artifacts:
__pycache__
*.pyc
*.so

# Pixi environment
.pixi

.gdb_history
perf.data*

**/dataset/

# Screenshots from samples etc.
screenshot*.png

# Saved example `.rrd` files
example_data

# Various builds
dist
wheels

# Screenshot comparison build
/compare_screenshot

.nox/
*.rrd
assets
6 changes: 6 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://github.com/crate-ci/typos
# install: cargo install typos-cli
# run: typos

[default.extend-words]
teh = "teh" # part of @teh-cmc
Loading

0 comments on commit ff0ca3d

Please sign in to comment.