diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..b3f245d --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,38 @@ +name: deploy + +on: + release: + types: [created] + +env: + CARGO_TERM_COLOR: always + +jobs: + runs-on: ubuntu-latest + steps: + - name: Faz checkout no Pull Request + uses: actions/checkout@v3 + + - name: Instala o Nix + run: | + BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \ + && SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \ + && NIX_RELEASE_VERSION='2.10.2' \ + && curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \ + && . "$HOME"/.nix-profile/etc/profile.d/nix.sh \ + && . ~/."$(basename $SHELL)"rc \ + && export TMPDIR=/tmp \ + && nix flake --version \ + && nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \ + && curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \ + && . ~/."$(basename $SHELL)"rc \ + && direnv --version + echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH + + - name: Build + run: nix develop .# --command sh -c 'cd brado && cargo build --release --verbose' + + - name: Deploy + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: nix develop .# --command sh -c 'cd brado && cargo login --registry $CARGO_REGISTRY_TOKEN && cargo publish' diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f8e7f6a..7da26d3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -69,7 +69,7 @@ jobs: run: nix develop .# --command sh -c 'cd brado && cargo build --verbose' - name: Run tests - run: nix develop .# --command sh -c 'cd brado && cargo test --verbose' + run: nix develop .# --command sh -c 'cd brado && cargo test --verbose' clippy: runs-on: ubuntu-latest diff --git a/brado/Cargo.toml b/brado/Cargo.toml index a824919..fe48864 100644 --- a/brado/Cargo.toml +++ b/brado/Cargo.toml @@ -2,7 +2,13 @@ name = "brado" version = "0.1.0" edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +license = "MIT" +readme = "../README.md" +description = "brado is a brazilian docs validator" +homepage = "https://github.com/brenomfviana/brado" +documentation = "https://docs.rs/brado" +repository = "https://github.com/brenomfviana/brado" +keywords = ["brazilian", "docs", "validator"] +authors = ["Breno Viana", "Pedro Regis"] [dependencies] diff --git a/brado/src/docs/mod.rs b/brado/src/docs/mod.rs index f6f6033..b25e00f 100644 --- a/brado/src/docs/mod.rs +++ b/brado/src/docs/mod.rs @@ -2,4 +2,3 @@ pub mod cnpj; pub mod common; pub mod cpf; pub mod doc; -pub use doc::Document; diff --git a/brado/src/lib.rs b/brado/src/lib.rs index 8bec614..5648df6 100644 --- a/brado/src/lib.rs +++ b/brado/src/lib.rs @@ -1,4 +1,15 @@ +//! # brado documentation +//! +//! brado is a brazilian docs validator. +//! +//! ## Example +//! ``` +//! use brado; +//! use brado::Document; +//! let cpf_doc: Document = Document::new("639.292.470-11"); +//! brado::cpf::validate(&cpf_doc, true, false); +//! ``` mod docs; pub use crate::docs::cnpj; pub use crate::docs::cpf; -pub use crate::docs::Document; +pub use crate::docs::doc::Document;