From 16dda9a8c7bad9539193443f0c1d9dafa5be701a Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Mon, 23 Nov 2020 23:46:31 -0500 Subject: [PATCH] Update readme, add ci builds --- .ci/Jenkinsfile | 42 ++++++++++++++++++++++++++++++++++++++++++ .ci/build.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ readme.md | 6 +++++- 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 .ci/Jenkinsfile create mode 100755 .ci/build.sh diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile new file mode 100644 index 0000000..e283bab --- /dev/null +++ b/.ci/Jenkinsfile @@ -0,0 +1,42 @@ +properties( + [ + disableConcurrentBuilds() + ] +) + +node('linux && docker') { + try { + stage('Checkout') { + //branch name from Jenkins environment variables + echo "My branch is: ${env.BRANCH_NAME}" + + // this doesn't grab tags pointing to this branch + //checkout scm + // this hack does... https://issues.jenkins.io/browse/JENKINS-45164 + checkout([ + $class: 'GitSCM', + branches: [[name: 'refs/heads/'+env.BRANCH_NAME]], + extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']], + userRemoteConfigs: scm.userRemoteConfigs, + ]) + sh ''' + set -euxo pipefail + git checkout "$BRANCH_NAME" -- + git reset --hard "origin/$BRANCH_NAME" + ''' + } + + stage('Build + Deploy') { + sh 'curl --compressed -sL https://code.moparisthebest.com/moparisthebest/self-ci/raw/branch/master/build-ci.sh | bash' + } + + currentBuild.result = 'SUCCESS' + } catch (Exception err) { + currentBuild.result = 'FAILURE' + } finally { + stage('Email') { + step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'admin.jenkins@moparisthebest.com', sendToIndividuals: true]) + } + deleteDir() + } +} diff --git a/.ci/build.sh b/.ci/build.sh new file mode 100755 index 0000000..b375497 --- /dev/null +++ b/.ci/build.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -exo pipefail + +echo "starting build for TARGET $TARGET" + +export CRATE_NAME=phone-mnemonic + +# cross doesn't actually support stdin/stdout pipes for some reason, skip it for now +DISABLE_TESTS=1 + +SUFFIX="" + +echo "$TARGET" | grep -E '^x86_64-pc-windows-gnu$' >/dev/null && SUFFIX=".exe" + +cross rustc --bin phone-mnemonic --target $TARGET --release + +# to check how they are built +file "target/$TARGET/release/phone-mnemonic$SUFFIX" + +if [ $DISABLE_TESTS -ne 1 ] +then + + test_num='1234567890' + # first make sure it outputs the right number of numbers + num_perms="$(echo "$test_num" | cross run --target $TARGET --release --bin phone-mnemonic)" + if [ "$num_perms" != "102400" ] + then + echo "num_perms expected 102400, was: $num_perms" + exit 1 + fi + + out_num="$(echo "$test_num" | cross run --target $TARGET --release --bin phone-mnemonic | cross run --target $TARGET --release --bin phone-mnemonic -- -r | sort -u)" + if [ "$out_num" != "$test_num" ] + then + echo "out_num expected $test_num, was: $out_num" + exit 1 + fi +fi + +# if this commit has a tag, upload artifact to release +strip "target/$TARGET/release/phone-mnemonic$SUFFIX" || true # if strip fails, it's fine +mkdir -p release +mv "target/$TARGET/release/phone-mnemonic$SUFFIX" "release/phone-mnemonic-$TARGET$SUFFIX" + +echo 'build success!' +exit 0 diff --git a/readme.md b/readme.md index 62680fe..4cf3c66 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,8 @@ phone-mnemonic -------------- +[![Build Status](https://ci.moparisthe.best/job/moparisthebest/job/phone-mnemonic/job/master/badge/icon%3Fstyle=plastic)](https://ci.moparisthe.best/job/moparisthebest/job/phone-mnemonic/job/master/) + ``` $ phone-mnemonic -h usage: phone-mnemonic [options...] @@ -17,4 +19,6 @@ Examples: for one containing the string COOLNUM phone-mnemonic -r -o < coolnums.txt > nums_to_get.txt; reverse but keep original into a file for easy lookup/number finding -``` \ No newline at end of file +``` + +Additionally a script in jmp/jmp.sh will download all available numbers in the USA that [jmp.chat](https://jmp.chat) has available, combined with phone-mnemonic you can easily grep the phone number of your dreams.