Skip to content

Commit

Permalink
Merge pull request #6 from fastfailures/repository_upgrade
Browse files Browse the repository at this point in the history
Repository upgrade
  • Loading branch information
fastfailures authored Jan 29, 2025
2 parents f30a71b + 58ed477 commit 3459c1c
Show file tree
Hide file tree
Showing 14 changed files with 442 additions and 38 deletions.
4 changes: 4 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
context = 1
skip = ./target,.git,.mypy_cache,*.lock,./mutants.out*
ignore-words-list = crate,FO
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# https://EditorConfig.org

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.{yaml,yml,nix,html,json}]
indent_size = 2

[*.{md,lock}]
indent_size = unset
4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
source_url "https://raw.githubusercontent.com/cachix/devenv/82c0147677e510b247d8b9165c54f73d32dfd899/direnvrc" "sha256-7u4iDd1nZpxL4tCzmPG0dQgC5V+/44Ba+tHkPob1v2k="

use devenv
42 changes: 42 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI checks & tests

on:
push:
pull_request:

env:
CARGO_TERM_COLOR: always
CI: "true" # https://insta.rs/docs/quickstart/#continuous-integration

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup component add rustfmt
- run: cargo fmt -- --check

test:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: rustup component add clippy
- run: cargo build --verbose
- run: cargo clippy --all-features -- --deny warnings --forbid unsafe_code
- run: cargo test --verbose

semver-checks:
# https://github.com/obi1kenobi/cargo-semver-checks-action
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
20 changes: 12 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Compiled files
*.o
*.so
*.rlib
*.dll

# Executables
*.exe
/target
.*.swp
/mutants.out*

# Generated by Cargo
/target/
Cargo.lock
# Devenv
.devenv*
devenv.local.nix

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml
1 change: 1 addition & 0 deletions .semver-baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10a8aea
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "e164-phones-countries"
version = "0.1.2"
authors = ["<visualjeff@linux.com>"]
description = "A small utility which maps E.164 international phone numbers to ISO 3166 country codes as well as the ISO 3166 country codes to country phone codes."
documentation = "https://github.com/visualjeff/e164-phones-countries"
homepage = "https://github.com/visualjeff/e164-phones-countries"
repository = "https://github.com/visualjeff/e164-phones-countries.git"
version = "0.2.0-alpha.1"
authors = ["visualjeff <visualjeff@linux.com>", "A248", "Xandre Ibuquil"]
description = "A small Rust library which maps E.164 international phone numbers to ISO 3166 country codes as well as the ISO 3166 country codes to country phone codes."
documentation = "https://github.com/fastfailures/e164-phones-countries"
homepage = "https://github.com/fastfailures/e164-phones-countries"
repository = "https://github.com/fastfailures/e164-phones-countries"
readme = "README.md"
keywords = ["e164", "ISO3166"]
keywords = ["E.164", "ISO3166"]
license = "MIT"
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ 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.

27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# e164-phones-countries
A small utility which maps E.164 international phone numbers to ISO 3166 country codes as well as the ISO 3166 country codes to country phone codes.

Add e164-phones-countries dependency to your project Cargo.toml file:
```json
[dependencies]
e164-phones-countries = "0.1.1"
```
A small utility which maps [E.164](http://en.wikipedia.org/wiki/E.164)
international phone numbers to
[ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1)
[country codes](http://en.wikipedia.org/wiki/List_of_country_calling_codes) as
well as the ISO 3166 country codes to country phone codes.

Add e164-phones-countries to your project's source code:
```rust
extern crate e164-phones-countries;
Inspired by <https://github.com/geneh/e164-phones-countries>.

use e164-phones-countries::find_iso_3166;
use e164-phones-countries::find_phone_cc;
```

Methods signatures:
```rust
fn find_iso_3166(phone:&str) -> &'static str
fn find_phone_cc(code:&str) -> &'static str
## Credits

Thanks to [visualjeff](https://github.com/visualjeff), who originally launched
the project (and kindly handled it over) and to [A248](https://github.com/A248)
who revived it.
137 changes: 137 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1738095186,
"owner": "cachix",
"repo": "devenv",
"rev": "87439ffe45de40f9029b0ba178ad923b3f8fc538",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1738045985,
"owner": "nix-community",
"repo": "fenix",
"rev": "4745897c4574c0c92c58e7517b92e3a946555223",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1733477122,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1737465171,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"fenix": "fenix",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1738009017,
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "a995319633b82a69fcde588652d12da209862570",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
69 changes: 69 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# https://devenv.sh/getting-started
{pkgs, ...}: {
# https://devenv.sh/languages/
languages.rust = {
enable = true;
channel = "stable";
targets = ["wasm32-unknown-unknown"];
};

# https://devenv.sh/packages/
packages = with pkgs; [
cargo-audit
cargo-auditable
cargo-insta # https://github.com/mitsuhiko/insta
cargo-machete
cargo-mutants
cargo-outdated
cargo-semver-checks
cargo-tarpaulin
codespell
git
just
onefetch
];

# https://devenv.sh/pre-commit-hooks/
# https://devenv.sh/reference/options/#pre-commit
pre-commit.hooks = {
# Files
check-symlinks.enable = true;
# Rust
rustfmt.enable = true;
# Nix
alejandra.enable = true;
deadnix.enable = true;
statix.enable = true;
# Shell
shellcheck.enable = true;
shfmt.enable = true; # alternative: beautysh
# Misc. formats
check-json.enable = true;
check-toml.enable = true;
check-yaml.enable = true;
denofmt.enable = true;
markdownlint.enable = true; # alternative: mdl
# Security
# ripsecrets.enable = true;
detect-private-keys.enable = true;
# Hyperlinks
# lychee.enable = true;
check-vcs-permalinks.enable = true;
# EditorConfig
editorconfig-checker.enable = true; # https://EditorConfig.org
end-of-file-fixer.enable = true;
trim-trailing-whitespace.enable = true;
# Git
commitizen.enable = true; # https://www.conventionalcommits.org/en/v1.0.0/#summary
check-merge-conflicts.enable = true;
check-added-large-files.enable = true;
};

enterShell = ''
# set -x # for debugging
onefetch --no-color-palette --no-art --no-title
echo "Run 'just' often, to prevent CI failures."
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'';
}
20 changes: 20 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
fenix:
url: github:nix-community/fenix
inputs:
nixpkgs:
follows: nixpkgs
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling

# If you're using non-OSS software, you can set allowUnfree to true.
# allowUnfree: true

# If you're willing to use a package that's vulnerable
# permittedInsecurePackages:
# - "openssl-1.1.1w"

# If you have more than one devenv you can merge them
#imports:
# - ./backend
Loading

0 comments on commit 3459c1c

Please sign in to comment.