Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshowers committed Jan 31, 2024
0 parents commit 9570134
Show file tree
Hide file tree
Showing 16 changed files with 1,095 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage:
status:
project:
default:
informational: true
patch:
default:
target: 0%
8 changes: 8 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>oxidecomputer/renovate-config",
"local>oxidecomputer/renovate-config//rust/autocreate",
"local>oxidecomputer/renovate-config//actions/pin"
]
}
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
on:
push:
branches:
- main
pull_request:
branches:
- main

name: CI

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v4.1.1
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2.7.2
- name: Lint (clippy)
run: cargo clippy --all-features --all-targets
- name: Lint (rustfmt)
run: cargo xfmt --check
- name: Run rustdoc
env:
RUSTC_BOOTSTRAP: 1 # for feature(doc_cfg)
RUSTDOCFLAGS: -Dwarnings --cfg doc_cfg
run: cargo doc --all-features --workspace
- name: Check for differences
run: git diff --exit-code

build:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust-version: ["1.60", stable]
fail-fast: false
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@nextest
- name: Build
run: cargo hack build --feature-powerset
- name: Test
run: cargo hack nextest run --feature-powerset
- name: Run doctests
run: cargo test --doc --all-features
35 changes: 35 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
push:
branches:
- main
pull_request:
branches:
- main

name: Test coverage

jobs:
coverage:
name: Collect test coverage
runs-on: ubuntu-latest
# nightly rust might break from time to time
continue-on-error: true
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: dtolnay/rust-toolchain@nightly # Use nightly to get access to coverage --doc
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Collect coverage data
run: ./scripts/commands.sh coverage
- name: Upload coverage data to codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3
with:
files: lcov.info, lcov-doctest.info
33 changes: 33 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
push:
branches:
- main

name: Docs

jobs:
docs:
name: Build and deploy documentation
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build rustdoc
env:
RUSTC_BOOTSTRAP: 1 # for feature(doc_cfg)
RUSTDOCFLAGS: -Dwarnings --cfg doc_cfg
run: cargo doc --all-features --workspace
- name: Organize
run: |
rm -rf target/gh-pages
mkdir target/gh-pages
mv target/doc target/gh-pages/rustdoc
touch target/gh-pages/.nojekyll
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages
folder: target/gh-pages
single-commit: true
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# adapted from https://github.com/taiki-e/cargo-hack/blob/main/.github/workflows/release.yml

name: Publish release
on:
push:
tags:
- '*'

jobs:
create-release:
if: github.repository_owner == 'oxidecomputer'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- uses: taiki-e/create-gh-release-action@v1
with:
changelog: CHANGELOG.md
title: cancel-safe-futures $version
branch: main
prefix: cancel-safe-futures
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
182 changes: 182 additions & 0 deletions Cargo.lock

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

31 changes: 31 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[package]
name = "newtype-uuid"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/oxidecomputer/newtype-uuid"
description = "Newtype wrapper around UUIDs"
documentation = "https://docs.rs/newtype-uuid"
readme = "README.md"
keywords = ["uuid", "unique", "guid", "newtype"]
categories = ["data-structures", "uuid"]
rust-version = "1.60"
resolver = "2"
exclude = [".cargo/**/*", ".github/**/*", "scripts/**/*"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg=doc_cfg"]

[dependencies]
serde = { version = "1", optional = true, features = ["derive"] }
schemars = { version = "0.8", features = ["uuid1"], optional = true }
uuid = { version = "1.7.0", default-features = false }

[features]
default = ["uuid/default", "std"]
std = ["uuid/std", "alloc"]
alloc = []
v4 = ["uuid/v4"]
serde = ["dep:serde", "uuid/serde"]
schemars08 = ["dep:schemars", "std"]
Loading

0 comments on commit 9570134

Please sign in to comment.