Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.
Rust emailemail-validationemail-validation-apiemail-verificationemail-verification-apiemail-verifierhacktoberfest
chore: Use japaric/trust again (#217)
Amaury Martinyc5dee3e3dc14
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.ymldeleted file mode 100644index c715ce64..00000000--- a/.github/workflows/deploy.yml+++ /dev/null@@ -1,101 +0,0 @@-# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md--on:- push:- # Sequence of patterns matched against refs/tags- tags:- - v*--name: deploy--env:- BIN_NAME: check_if_email_exists- CRATE_NAME: check-if-email-exists--jobs:- # Create on Github Release first, then upload all the artifacts- release:- runs-on: ubuntu-latest-- steps:- # Get the tag name- # https://github.com/olegtarasov/get-tag- - uses: olegtarasov/get-tag@v2-- - name: Create Release- id: create_release- uses: actions/[email protected]- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- with:- tag_name: ${{ env.GIT_TAG_NAME }}- release_name: ${{ env.CRATE_NAME }} ${{ env.GIT_TAG_NAME }}-- - name: Output Release URL File- run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt-- - name: Save Release URL File for upload job- uses: actions/upload-artifact@v1- with:- name: release_url- path: release_url.txt-- upload:- needs: release- runs-on: ${{ matrix.os }}- strategy:- matrix:- os: [ubuntu-latest, macOS-latest]- include:- - os: ubuntu-latest- target: x86_64-unknown-linux-gnu- - os: ubuntu-latest- target: x86_64-unknown-linux-musl- - os: macOS-latest- target: x86_64-apple-darwin-- env:- OS: ${{ matrix.os }}- TARGET: ${{ matrix.target }}-- steps:- - uses: hecrj/setup-rust-action@v1-- - name: Checkout sources- uses: actions/checkout@v1-- - name: Build- run: cargo build --release --target $TARGET-- # Get the tag name- # https://github.com/olegtarasov/get-tag- - uses: olegtarasov/get-tag@v2-- - name: Package into tar/zip- run: |- cp target/$TARGET/release/$BIN_NAME .- tar czf $CRATE_NAME-$GIT_TAG_NAME-$TARGET.tar.gz $BIN_NAME-- # https://github.com/actions/create-release/issues/14#issuecomment-555379810- - name: Load Release URL File from release job- uses: actions/download-artifact@v1- with:- name: release_url-- - name: Get Release File Name & Upload URL- id: get_release_info- run: |- echo ::set-output name=file_name::$CRATE_NAME-$GIT_TAG_NAME- value=`cat release_url/release_url.txt`- echo ::set-output name=upload_url::$value-- - name: Upload Release Asset- id: upload-release-asset- uses: actions/[email protected]- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- with:- upload_url: ${{ steps.get_release_info.outputs.upload_url }}- asset_path: ${{ env.CRATE_NAME }}-${{ env.GIT_TAG_NAME }}-${{ env.TARGET }}.tar.gz- asset_name: ${{ env.CRATE_NAME }}-${{ env.GIT_TAG_NAME }}-${{ env.TARGET }}.tar.gz- asset_content_type: application/gzipdiff --git a/.travis.yml b/.travis.ymlnew file mode 100644index 00000000..43b22e19--- /dev/null+++ b/.travis.yml@@ -0,0 +1,131 @@+# Based on the "trust" template v0.1.2+# https://github.com/japaric/trust/tree/v0.1.2++dist: trusty+language: rust+services: docker+sudo: required++# TODO Rust builds on stable by default, this can be+# overridden on a case by case basis down below.++env:+ global:+ # TODO Update this to match the name of your project.+ - CRATE_NAME=check-if-email-exists++matrix:+ # TODO These are all the build jobs. Adjust as necessary. Comment out what you+ # don't need+ include:+ # Android+ # - env: TARGET=aarch64-linux-android DISABLE_TESTS=1+ # - env: TARGET=arm-linux-androideabi DISABLE_TESTS=1+ # - env: TARGET=armv7-linux-androideabi DISABLE_TESTS=1+ # - env: TARGET=i686-linux-android DISABLE_TESTS=1+ # - env: TARGET=x86_64-linux-android DISABLE_TESTS=1++ # iOS+ # - env: TARGET=aarch64-apple-ios DISABLE_TESTS=1+ # os: osx+ # - env: TARGET=armv7-apple-ios DISABLE_TESTS=1+ # os: osx+ # - env: TARGET=armv7s-apple-ios DISABLE_TESTS=1+ # os: osx+ # - env: TARGET=i386-apple-ios DISABLE_TESTS=1+ # os: osx+ # - env: TARGET=x86_64-apple-ios DISABLE_TESTS=1+ # os: osx++ # Linux+ # - env: TARGET=aarch64-unknown-linux-gnu+ # - env: TARGET=arm-unknown-linux-gnueabi+ # - env: TARGET=armv7-unknown-linux-gnueabihf+ # - env: TARGET=i686-unknown-linux-gnu+ # - env: TARGET=i686-unknown-linux-musl+ # - env: TARGET=mips-unknown-linux-gnu+ # - env: TARGET=mips64-unknown-linux-gnuabi64+ # - env: TARGET=mips64el-unknown-linux-gnuabi64+ # - env: TARGET=mipsel-unknown-linux-gnu+ # - env: TARGET=powerpc-unknown-linux-gnu+ # - env: TARGET=powerpc64-unknown-linux-gnu+ # - env: TARGET=powerpc64le-unknown-linux-gnu+ # - env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1+ - env: TARGET=x86_64-unknown-linux-gnu+ - env: TARGET=x86_64-unknown-linux-musl++ # OSX+ # - env: TARGET=i686-apple-darwin+ # os: osx+ - env: TARGET=x86_64-apple-darwin+ os: osx++ # *BSD+ # - env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1+ # - env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1+ # - env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1+ # Windows+ # - env: TARGET=x86_64-pc-windows-gnu+ # Bare metal+ # These targets don't support std and as such are likely not suitable for+ # most crates.+ # - env: TARGET=thumbv6m-none-eabi+ # - env: TARGET=thumbv7em-none-eabi+ # - env: TARGET=thumbv7em-none-eabihf+ # - env: TARGET=thumbv7m-none-eabi+ # Testing other channels+ # - env: TARGET=x86_64-unknown-linux-gnu+ # rust: nightly+ # - env: TARGET=x86_64-apple-darwin+ # os: osx+ # rust: nightly++before_install:+ - set -e+ - rustup self update++install:+ - sh ci/install.sh+ - source ~/.cargo/env || true++script:+ - bash ci/script.sh++after_script: set +e++before_deploy:+ - sh ci/before_deploy.sh++deploy:+ # TODO update `api_key.secure`+ # - Create a `public_repo` GitHub token. Go to: https://github.com/settings/tokens/new+ # - Encrypt it: `travis encrypt 0123456789012345678901234567890123456789+ # - Paste the output down here+ api_key:+ secure: UDYnqsGG4ded/yh4g7VBLeG2J3rWdXECvM1wFfjtSyJGNcfLijWDjJi+Iq5YFwmx1CLus93bUd1iZe4fvcS/chqWO0/5NPiXjJ85wN8CTC6JqGtDqVRFHkUJjgmWIq4nCVyILg62ASYblmSgLM8TGL++5waXYUpOs1eXhjZGD5/zHgvixBC5U5QmTOeA3/Z9CanKzw1P2oS2vtkXxGlFYcsOm9GgqIx2AaGL1ZhgutPc/2keDwySJ2rYBrUg8ql1+NT8fwoRayMLPegCtkrb/h4RwaytaF+d+8CcwRZORPzQDPPMrkOGa+KEtxNhr3o4c641Ya/6F8m7qeGqyrMaomxq0sOcNQyiDTj4Cy0trmoO0Bv8YCWxGVcwu4nrzrOGZV6Ty84n2rcjgr/iQ5L5WjfHBqFuSX/jhbCFVYyugC96Ya96yf474nYSvCmA8XWPStDUtt38F4dpAT50pwtCrDQMw6OO6eRa/zEiwQlGR6gEXpztK0zo/rmFzcE+laSLtGZwPeQJR6LqvX5qE/lOyVBEiFFExRztGxozfPKPJKV7TbKt4eX9bRvykMmAhQELiSWXiRd8uSO1jaARdQPsXWqve3hbv2A9yCnLdKw/aeJJLv9kQQpO3NsLkTrlo1He6FkUNN3jaUymsrZYtg80IMzTangJ7rn0PSHakH7Cc5o=+ file_glob: true+ file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*+ on:+ # TODO Here you can pick which targets will generate binary releases+ # In this example, there are some targets that are tested using the stable+ # and nightly channels. This condition makes sure there is only one release+ # for such targets and that's generated using the stable channel+ condition: $TRAVIS_RUST_VERSION = stable+ tags: true+ provider: releases+ skip_cleanup: true++cache: cargo+before_cache:+ # Travis can't cache files that are not readable by "others"+ - chmod -R a+r $HOME/.cargo++branches:+ only:+ # release tags+ - /^v\d+\.\d+\.\d+.*$/+ - master++notifications:+ email:+ on_success: neverdiff --git a/ci/before_deploy.sh b/ci/before_deploy.shnew file mode 100755index 00000000..e897710d--- /dev/null+++ b/ci/before_deploy.sh@@ -0,0 +1,33 @@+# This script takes care of building your crate and packaging it for release++set -ex++main() {+ local src=$(pwd) \+ stage=++ case $TRAVIS_OS_NAME in+ linux)+ stage=$(mktemp -d)+ ;;+ osx)+ stage=$(mktemp -d -t tmp)+ ;;+ esac++ test -f Cargo.lock || cargo generate-lockfile++ # TODO Update this to build the artifacts that matter to you+ cross rustc --bin check_if_email_exists --target $TARGET --release -- -C lto++ # TODO Update this to package the right artifacts+ cp target/$TARGET/release/check_if_email_exists $stage/++ cd $stage+ tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *+ cd $src++ rm -rf $stage+}++maindiff --git a/ci/install.sh b/ci/install.shnew file mode 100755index 00000000..557d3f03--- /dev/null+++ b/ci/install.sh@@ -0,0 +1,49 @@+set -ex++main() {+ local target=+ if [ $TRAVIS_OS_NAME = linux ]; then+ target=x86_64-unknown-linux-musl+ sort=sort+ else+ target=x86_64-apple-darwin+ sort=gsort # for `sort --sort-version`, from brew's coreutils.+ fi++ # Builds for iOS are done on OSX, but require the specific target to be+ # installed.+ case $TARGET in+ aarch64-apple-ios)+ rustup target install aarch64-apple-ios+ ;;+ armv7-apple-ios)+ rustup target install armv7-apple-ios+ ;;+ armv7s-apple-ios)+ rustup target install armv7s-apple-ios+ ;;+ i386-apple-ios)+ rustup target install i386-apple-ios+ ;;+ x86_64-apple-ios)+ rustup target install x86_64-apple-ios+ ;;+ esac++ # This fetches latest stable release+ local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \+ | cut -d/ -f3 \+ | grep -E '^v[0.1.0-9.]+$' \+ | $sort --version-sort \+ | tail -n1)+ # We use v0.1.9 specifically: starting from v0.2.0, Travis errors.+ # https://github.com/amaurymartiny/check-if-email-exists/issues/211+ curl -LSfs https://japaric.github.io/trust/install.sh | \+ sh -s -- \+ --force \+ --git japaric/cross \+ --tag v0.1.9 \+ --target $target+}++maindiff --git a/ci/script.sh b/ci/script.shnew file mode 100755index 00000000..6318df94--- /dev/null+++ b/ci/script.sh@@ -0,0 +1,29 @@+# This script takes care of testing your crate++set -ex++# TODO This is the "test phase", tweak it as you see fit+main() {+ cross build --target $TARGET+ cross build --target $TARGET --release++ if [ ! -z $DISABLE_TESTS ]; then+ return+ fi++ cross test --all --target $TARGET+ cross test --all --target $TARGET --release++ # Run the binary with a $TEST_EMAIL, to test that the tool actually works.+ # aka some quick e2e test on the binary itself+ # TODO This only works on osx now, see #11+ if [ $TRAVIS_OS_NAME = osx ]; then+ cross run --target $TARGET $TEST_EMAIL | grep "\"is_deliverable\": true"+ cross run --target $TARGET --release $TEST_EMAIL | grep "\"is_deliverable\": true"+ fi+}++# we don't run the "test phase" when doing deploys+if [ -z $TRAVIS_TAG ]; then+ main+fi