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

Update repo based on rerun_template #51

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto eol=lf
Cargo.lock linguist-generated=false
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* Do NOT open PR:s from your `main` branch, as that makes it hard for maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and it passes CI.
* When you have addressed a PR comment, mark it as resolved.

Please be patient!
-->

* Closes #ISSUE_NUMBER
17 changes: 17 additions & 0 deletions .github/workflows/cargo_machete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Cargo Machete

on:
push:
branches:
- "main"
pull_request:
types: [opened, synchronize]

jobs:
cargo-machete:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Machete
uses: bnjbvr/cargo-machete@main
7 changes: 6 additions & 1 deletion .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Copied from https://github.com/rerun-io/rerun_template
on: [push, pull_request]
on:
push:
branches:
- "main"
pull_request:
types: [ opened, synchronize ]

name: Link checker

Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Copied from https://github.com/rerun-io/rerun_template
on: [push, pull_request]
on:
push:
branches:
- "main"
pull_request:
types: [ opened, synchronize ]

name: Rust

env:
# --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: -D warnings --cfg=web_sys_unstable_apis
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings

jobs:
Expand All @@ -24,10 +26,11 @@ jobs:
override: true

- name: Install packages (Linux)
if: runner.os == 'Linux'
uses: awalsh128/[email protected]
with:
# Some deps used by eframe:
packages: libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
# some deps used by eframe, if that is part of the project
packages: libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev # libgtk-3-dev is used by rfd
version: 1.0
execute_install_scripts: true

Expand Down Expand Up @@ -107,6 +110,7 @@ jobs:
toolchain: 1.76.0
target: wasm32-unknown-unknown
override: true
components: clippy

- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -152,4 +156,4 @@ jobs:
- name: Build
run: cd example_app && ../trunk build --release --public-url $public_url --dist ../dist/
env:
public_url: "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
public_url: "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
2 changes: 1 addition & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ extend-exclude = ["docs/example_app.js"]


[default.extend-words]
teh = "teh" # part of @teh-cmc
teh = "teh" # part of @teh-cmc
32 changes: 16 additions & 16 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,9 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"

[[package]]
name = "bytemuck"
version = "1.14.3"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f"
checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d"
dependencies = [
"bytemuck_derive",
]
Expand Down Expand Up @@ -1237,19 +1237,19 @@ dependencies = [

[[package]]
name = "futures-channel"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
"futures-sink",
]

[[package]]
name = "futures-core"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"

[[package]]
name = "futures-executor"
Expand All @@ -1264,9 +1264,9 @@ dependencies = [

[[package]]
name = "futures-io"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"

[[package]]
name = "futures-lite"
Expand All @@ -1283,9 +1283,9 @@ dependencies = [

[[package]]
name = "futures-macro"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -1294,21 +1294,21 @@ dependencies = [

[[package]]
name = "futures-sink"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"

[[package]]
name = "futures-task"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"

[[package]]
name = "futures-util"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
dependencies = [
"futures-channel",
"futures-core",
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ members = ["ewebsock", "example_app", "echo_server"]


[workspace.dependencies]
ewebsock = { version = "0.7.0", path = "ewebsock", default-features = false }

async-stream = "0.3"
document-features = "0.2"
eframe = "0.29.1"
Expand Down
9 changes: 9 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Release Checklist

* [ ] Update `CHANGELOG.md` using `./scripts/generate_changelog.py --version 0.NEW.VERSION`
* [ ] Bump version numbers in `Cargo.toml` and run `cargo check`.
* [ ] `git commit -m 'Release 0.x.0 - summary'`
* [ ] `cargo publish --quiet -p ewebsock`
* [ ] `git tag -a 0.x.0 -m 'Release 0.x.0 - summary'`
* [ ] `git pull --tags && git tag -d latest && git tag -a latest -m 'Latest release' && git push --tags origin latest --force && git push origin main ; git push --tags`
* [ ] Do a GitHub release: https://github.com/rerun-io/ewebsock/releases/new
4 changes: 2 additions & 2 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ignore = []

[bans]
multiple-versions = "deny"
wildcards = "allow" # We use them for examples
wildcards = "deny"
deny = [
{ name = "openssl", reason = "Use rustls" },
{ name = "openssl-sys", reason = "Use rustls" },
Expand All @@ -58,7 +58,7 @@ allow = [
"BSL-1.0", # https://tldrlegal.com/license/boost-software-license-1.0-explained
"CC0-1.0", # https://creativecommons.org/publicdomain/zero/1.0/
"ISC", # https://www.tldrlegal.com/license/isc-license
"LicenseRef-UFL-1.0", # See https://github.com/emilk/egui/issues/2321
"LicenseRef-UFL-1.0", # no official SPDX, see https://github.com/emilk/egui/issues/2321
"MIT-0", # https://choosealicense.com/licenses/mit-0/
"MIT", # https://tldrlegal.com/license/mit-license
"MPL-2.0", # https://www.mozilla.org/en-US/MPL/2.0/FAQ/ - see Q11. Used by webpki-roots on Linux.
Expand Down
2 changes: 1 addition & 1 deletion example_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tokio = ["ewebsock/tokio", "dep:tokio"]


[dependencies]
ewebsock = { path = "../ewebsock", features = ["tls"] }
ewebsock = { workspace = true, features = ["tls"] }

eframe.workspace = true
log.workspace = true
Expand Down
11 changes: 0 additions & 11 deletions release_checklist.md

This file was deleted.

2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".

[toolchain]
channel = "1.76.0"
channel = "1.76" # Avoid specifying a patch version here; see https://github.com/emilk/eframe_template/issues/145
components = ["rustfmt", "clippy"]
targets = ["wasm32-unknown-unknown"]
48 changes: 34 additions & 14 deletions scripts/generate_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import re
import sys
from dataclasses import dataclass
from datetime import date
from typing import Any, Optional

import requests
Expand All @@ -25,15 +26,6 @@
OWNER = "rerun-io"
REPO = "ewebsock"
INCLUDE_LABELS = False # It adds quite a bit of visual noise
OFFICIAL_RERUN_DEVS = [
"abey79",
"emilk",
"jleibs",
"jprochazk",
"nikolausWest",
"teh-cmc",
"Wumpf",
]


@dataclass
Expand Down Expand Up @@ -119,13 +111,41 @@ def print_section(crate: str, items: list[str]) -> None:
print()


def commit_range(new_version: str) -> str:
parts = new_version.split(".")
assert len(parts) == 3, "Expected version to be on the format X.Y.Z"
major = int(parts[0])
minor = int(parts[1])
patch = int(parts[2])

if 0 < patch:
# A patch release.
# Include changes since last patch release.
# This assumes we've cherry-picked stuff for this release.
diff_since_version = f"0.{minor}.{patch - 1}"
elif 0 < minor:
# A minor release
# The diff should span everything since the last minor release.
# The script later excludes duplicated automatically, so we don't include stuff that
# was part of intervening patch releases.
diff_since_version = f"{major}.{minor - 1}.0"
else:
# A major release
# The diff should span everything since the last major release.
# The script later excludes duplicated automatically, so we don't include stuff that
# was part of intervening minor/patch releases.
diff_since_version = f"{major - 1}.{minor}.0"

return f"{diff_since_version}..HEAD"


def main() -> None:
parser = argparse.ArgumentParser(description="Generate a changelog.")
parser.add_argument("--commit-range", help="e.g. 0.1.0..HEAD", required=True)
parser.add_argument("--version", required=True, help="The version of the new release, e.g. 0.42.0")
args = parser.parse_args()

repo = Repo(".")
commits = list(repo.iter_commits(args.commit_range))
commits = list(repo.iter_commits(commit_range(args.version)))
commits.reverse() # Most recent last
commit_infos = list(map(get_commit_info, commits))

Expand Down Expand Up @@ -169,8 +189,7 @@ def main() -> None:

if pr_info is not None:
gh_user_name = pr_info.gh_user_name
if gh_user_name not in OFFICIAL_RERUN_DEVS:
summary += f" (thanks [@{gh_user_name}](https://github.com/{gh_user_name})!)"
summary += f" by [@{gh_user_name}](https://github.com/{gh_user_name})"

prs.append(summary)

Expand All @@ -180,8 +199,9 @@ def main() -> None:
line = line[0].upper() + line[1:] # Upper-case first letter
prs[i] = line

print(f"## {args.version} - {date.today()}")
print()
print(f"Full diff at https://github.com/rerun-io/{REPO}/compare/{args.commit_range}")
print(f"Full diff at https://github.com/{OWNER}/{REPO}/compare/{args.commit_range}")
print()
print_section("PRs", prs)
print_section("Unsorted commits", unsorted_commits)
Expand Down
13 changes: 11 additions & 2 deletions scripts/template_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

# Files required by Rust, but not by _both_ C++ and Python
RUST_FILES = {
".github/workflows/cargo_machete.yml",
".github/workflows/rust.yml",
"bacon.toml",
"Cargo.lock",
Expand All @@ -67,6 +68,7 @@
"clippy.toml",
"Cranky.toml",
"deny.toml",
"RELEASES.md",
"rust-toolchain",
"scripts/clippy_wasm/",
"scripts/clippy_wasm/clippy.toml",
Expand Down Expand Up @@ -105,6 +107,13 @@ def init(languages: set[str], dry_run: bool) -> None:
delete_files_and_folder(files_to_delete, dry_run)


def remove_file(filepath: str) -> None:
try:
os.remove(filepath)
except FileNotFoundError:
pass


def delete_files_and_folder(paths: set[str], dry_run: bool) -> None:
repo_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
for path in paths:
Expand All @@ -113,7 +122,7 @@ def delete_files_and_folder(paths: set[str], dry_run: bool) -> None:
if os.path.isfile(full_path):
print(f"Removing file {full_path}…")
if not dry_run:
os.remove(full_path)
remove_file(full_path)
elif os.path.isdir(full_path):
print(f"Removing folder {full_path}…")
if not dry_run:
Expand All @@ -124,7 +133,7 @@ def update(languages: set[str], dry_run: bool) -> None:
for file in DEAD_FILES:
print(f"Removing dead file {file}…")
if not dry_run:
os.remove(file)
remove_file(file)

files_to_ignore = calc_deny_set(languages) | DO_NOT_OVERWRITE
repo_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
Expand Down
Loading