Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…#34)

* CI: Add link checker

* Improve .gitignore

* CI: check for typos

* Add bacon.toml

* Update crate `mio`

* Update deny.toml

* Small formatting changes

* Add script to generate chagelog

* Add script to update repository from template

* CI: check for labels

* Unify Rust CI

* More agressive clippy

* Fix doclink

* Remove dead link

* Only check libraries for wasm32 support

* Fix some Wasm clippy lints

* Web: Add error handling when failing to read binary blob

* another clippy lint fix

* Same rust-version everywhere
  • Loading branch information
emilk committed Apr 18, 2024
1 parent 8dbce61 commit 8d99d31
Show file tree
Hide file tree
Showing 27 changed files with 966 additions and 111 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/lychee-action@v1.9.0
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"
101 changes: 67 additions & 34 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,111 @@
# Copied from https://github.com/rerun-io/rerun_template
on: [push, pull_request]

name: CI
name: Rust

env:
# This is required to enable the web_sys clipboard API which egui_web uses
# --cfg=web_sys_unstable_apis is required to enable the web_sys clipboard API which egui_web uses
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
RUSTFLAGS: --cfg=web_sys_unstable_apis
RUSTFLAGS: -D warnings --cfg=web_sys_unstable_apis
RUSTDOCFLAGS: -D warnings

jobs:
check:
name: Rust format, cranky, check, test, doc
rust-check:
name: Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
profile: minimal
profile: default
toolchain: 1.73.0
override: true
components: rustfmt, clippy

- run: |
sudo apt-get update
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
- name: Install packages (Linux)
uses: awalsh128/cache-apt-pkgs-action@v1.3.0
with:
# Some deps used by eframe:
packages: libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
version: 1.0
execute_install_scripts: true

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

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

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

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

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

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

- name: Check --all-features
- name: check --no-default-features
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features
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
- name: cargo doc --lib
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --all-features
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: Test
- name: Build tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --lib
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

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

check_wasm:
name: Check wasm32
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -95,19 +116,31 @@ jobs:
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2

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

- name: Check wasm32
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features --lib --target wasm32-unknown-unknown
args: --target wasm32-unknown-unknown --lib

- name: Cranky wasm32
env:
CLIPPY_CONF_DIR: "scripts/clippy_wasm" # Use scripts/clippy_wasm/clippy.toml
run: cargo cranky --target wasm32-unknown-unknown --lib -- -D warnings

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

cargo-deny:
name: Check Rust dependencies (cargo-deny)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: EmbarkStudios/cargo-deny-action@v1
with:
rust-version: "1.73.0"
log-level: error
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
rust-version: "1.73.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
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
/target
# Mac stuff:
.DS_Store

# Rust compile target directories:
target
target_ra
target_wasm

# https://github.com/lycheeverse/lychee
.lycheecache
3 changes: 2 additions & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# run: typos

[files]
extend-exclude = [".typos.toml", "docs/example_app.js"]
extend-exclude = ["docs/example_app.js"]


[default.extend-words]
teh = "teh" # part of @teh-cmc
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Fix: On web, close connection when dropping `WsSender` (#8)


## [0.2.0](https://github.com/rerun-io/ewebsock/compare/0.1.0...0.2.0) - 2022-04-08
## 0.2.0 - 2022-04-08
* Support WSS (WebSocket Secure) / TLS.
* Improve error reporting.
* `EventHandler` no longer needs to be `Sync`.
Expand Down
1 change: 0 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,3 @@ For answers to common questions about this code of conduct, see the FAQ at
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8d99d31

Please sign in to comment.