Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Sep 27, 2024
0 parents commit b6f0321
Show file tree
Hide file tree
Showing 10 changed files with 763 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: ci

on: [push, pull_request]

jobs:
rust:
name: deno_path_util-${{ matrix.os }}
if: |
(github.event_name == 'push' || !startsWith(github.event.pull_request.head.label, 'denoland:'))
&& github.ref_name != 'deno_path_util'
&& !startsWith(github.ref, 'refs/tags/deno/')
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-2019]

env:
CARGO_INCREMENTAL: 0
GH_ACTIONS: 1
RUST_BACKTRACE: full
RUSTFLAGS: -D warnings

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install Rust
uses: dsherret/rust-toolchain-file@v1

- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Format
if: contains(matrix.os, 'ubuntu')
run: |
cargo fmt -- --check
- name: Check builds Wasm
if: contains(matrix.os, 'ubuntu')
run: |
rustup target add wasm32-unknown-unknown
cargo check --all-features --target wasm32-unknown-unknown
- name: Cargo test
run: cargo test --locked --release --all-features --bins --tests --examples

- name: Lint
if: contains(matrix.os, 'ubuntu')
run: |
cargo clippy --locked --all-features --all-targets -- -D clippy::all
- name: Cargo publish
if: |
contains(matrix.os, 'ubuntu') &&
github.repository == 'denoland/deno_path_util' &&
startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish

- name: Get tag version
if: contains(matrix.os, 'ubuntu') && startsWith(github.ref, 'refs/tags/')
id: get_tag_version
run: echo TAG_VERSION=${GITHUB_REF/refs\/tags\//} >> "$GITHUB_OUTPUT"
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: release

on:
workflow_dispatch:
inputs:
releaseKind:
description: "Kind of release"
default: "minor"
type: choice
options:
- patch
- minor
required: true

jobs:
rust:
name: release
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
token: ${{ secrets.DENOBOT_PAT }}

- uses: denoland/setup-deno@v1
- uses: dsherret/rust-toolchain-file@v1

- name: Tag and release
env:
GITHUB_TOKEN: ${{ secrets.DENOBOT_PAT }}
GH_WORKFLOW_ACTOR: ${{ github.actor }}
run: |
git config user.email "[email protected]"
git config user.name "denobot"
deno run -A https://raw.githubusercontent.com/denoland/automation/0.20.0/tasks/publish_release.ts --${{github.event.inputs.releaseKind}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
.vscode
3 changes: 3 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
max_width = 80
tab_spaces = 2
edition = "2021"
156 changes: 156 additions & 0 deletions Cargo.lock

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

18 changes: 18 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "deno_path_util"
description = "Path utilities used in Deno"
version = "0.0.1"
edition = "2021"
authors = ["the Deno authors"]
license = "MIT"
repository = "https://github.com/denoland/deno_path_util"

[features]

[dependencies]
percent-encoding = "2.3.0"
thiserror = "1.0.61"
url = { version = "2.3.1" }

[dev-dependencies]
pretty_assertions = "1.4.0"
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MIT License

Copyright 2018-2024 the Deno authors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `deno_path_util`

Common path utilities used across Deno's repos.
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.81.0"
components = ["rustfmt", "clippy"]
Loading

0 comments on commit b6f0321

Please sign in to comment.