Skip to content

Commit

Permalink
Add CI, license, contributing, CoC, etc etc
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jul 15, 2024
1 parent 429e8d3 commit 2adefc8
Show file tree
Hide file tree
Showing 34 changed files with 2,340 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# clipboard api is still unstable, so web-sys requires the below flag to be passed for copy (ctrl + c) to work
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
# check status at https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
# we don't use `[build]` because of rust analyzer's build cache invalidation https://github.com/emilk/eframe_template/issues/93
[target.wasm32-unknown-unknown]
rustflags = ["--cfg=web_sys_unstable_apis"]
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"
48 changes: 48 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Github Pages

# By default, runs if you push to main. keeps your deployed app in sync with main branch.
on:
push:
branches:
- main
# to only run when you do a new github release, comment out above part and uncomment the below trigger.
# on:
# release:
# types:
# - published

permissions:
contents: write # for committing to gh-pages branch.

jobs:
build-github-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # repo checkout
- name: Setup toolchain for wasm
run: |
rustup update stable
rustup default stable
rustup set profile minimal
rustup target add wasm32-unknown-unknown
- name: Rust Cache # cache the rust build artefacts
uses: Swatinem/rust-cache@v2
- name: Download and install Trunk binary
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
- name: Build # build
# Environment $public_url resolves to the github project page.
# If using a user/organization page, remove the `${{ github.event.repository.name }}` part.
# using --public-url something will allow trunk to modify all the href paths like from favicon.ico to repo_name/favicon.ico .
# this is necessary for github pages where the site is deployed to username.github.io/repo_name and all files must be requested
# relatively as eframe_template/favicon.ico. if we skip public-url option, the href paths will instead request username.github.io/favicon.ico which
# will obviously return error 404 not found.
run: ./trunk build --release --public-url $public_url
env:
public_url: "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist
# this option will not maintain any history of your previous pages deployment
# set to false if you want all page build to be committed to your gh-pages branch history
single-commit: true
154 changes: 154 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# 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-latest
steps:
- uses: actions/checkout@v4

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

- name: Install packages (Linux)
if: runner.os == 'Linux'
uses: awalsh128/[email protected]
with:
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: Rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Lint vertical spacing
run: ./scripts/lint.py

- 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: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features -- -D warnings

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

check_wasm:
name: Check wasm32
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.76.0
target: wasm32-unknown-unknown
override: true

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

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

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

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

cargo-deny:
name: Check Rust dependencies (cargo-deny)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
rust-version: "1.76.0"
log-level: warn
command: check

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

trunk:
name: trunk
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.76.0
target: wasm32-unknown-unknown
override: true
- name: Download and install Trunk binary
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
- name: Build
run: ./trunk build
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
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Mac stuff:
.DS_Store

# trunk output folder
dist

# Rust compile target directories:
target
target_ra
target_wasm

# https://github.com/lycheeverse/lychee
.lycheecache
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]
egui = "egui" # Example for how to ignore a false positive
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
All notable changes to the `egui_plot` integration will be noted in this file.

This file is updated upon each release.
Changes since the last release can be found at <https://github.com/emilk/egui/compare/latest...HEAD> or by running the `scripts/generate_changelog.py` script.
Changes since the last release can be found at <https://github.com/emilk/egui_plot/compare/latest...HEAD> or by running the `scripts/generate_changelog.py` script.


## 0.28.1 - 2024-07-05
Expand Down
Loading

0 comments on commit 2adefc8

Please sign in to comment.