๐พ Archived View for source.community โบ jeffdecola โบ my-go-tools โบ blob โบ develop โบ ci โบ scripts โบ unโฆ captured on 2022-01-08 at 13:44:22. Gemini links have been rewritten to link to archived content
โฌ ๏ธ Previous capture (2021-12-17)
โก๏ธ Next capture (2023-07-10)
-=-=-=-=-=-=-
. ,-. ,-. . . ,-. ,-. ,-. ,-. ,-. ,-,-. ,-,-. . . ,-. . |- . . `-. | | | | | | |-' | | | | | | | | | | | | | | | | | `-' `-' `-^ ' `-' `-' :: `-' `-' ' ' ' ' ' ' `-^ ' ' ' `' `-| /| `-'
git clone https://source.community/jeffdecola/my-go-tools.git
View raw contents of /ci/scripts/unit-tests.sh (develop)
โโโโโฎ 1โ #!/bin/sh 2โ # my-go-tools unit-test.sh 3โ 4โ echo " " 5โ 6โ if [ "$1" = "-debug" ] 7โ then 8โ echo "unit-tests.sh -debug (START)" 9โ # set -e causes the shell to exit if any subcommand or pipeline returns a non-zero status. Needed for concourse. 10โ # set -x enables a mode of the shell where all executed commands are printed to the terminal. 11โ set -e -x 12โ echo " " 13โ else 14โ echo "unit-tests.sh (START)" 15โ # set -e causes the shell to exit if any subcommand or pipeline returns a non-zero status. Needed for concourse. 16โ set -e 17โ echo " " 18โ fi 19โ 20โ echo "The goal is to set up a go src/github.com/JeffDeCola/my-go-tools directory" 21โ echo "Then tests will be run in that directory" 22โ echo "Test coverage results, text_coverage.txt, will be moved to /coverage-results directory" 23โ echo " " 24โ 25โ echo "At start, you should be in a /tmp/build/xxxxx directory with two folders:" 26โ echo " /my-go-tools" 27โ echo " /coverage-results (created in task-unit-test.yml task file)" 28โ echo " " 29โ 30โ echo "pwd is: $PWD" 31โ echo " " 32โ 33โ echo "List whats in the current directory" 34โ ls -la 35โ echo " " 36โ 37โ echo "Setup the GOPATH based on current directory" 38โ export GOPATH=$PWD 39โ echo " " 40โ 41โ echo "Now we must move our code from the current directory ./my-go-tools to" 42โ echo "$GOPATH/src/github.com/JeffDeCola/my-go-tools" 43โ mkdir -p src/github.com/JeffDeCola/ 44โ cp -R ./my-go-tools src/github.com/JeffDeCola/. 45โ echo " " 46โ 47โ echo "cd src/github.com/JeffDeCola/my-go-tools" 48โ cd src/github.com/JeffDeCola/my-go-tools 49โ echo " " 50โ 51โ echo "Check that you are set and everything is in the right place for go:" 52โ echo "gopath is: $GOPATH" 53โ echo "pwd is: $PWD" 54โ ls -la 55โ echo " " 56โ 57โ # OVERVIEW --------------------------------------------------------- 58โ echo "OVERVIEW" 59โ echo "The test_coverage.txt file will be used by the concourse pipeline to send to slack" 60โ echo " " 61โ # cd into cryptography-tools and create a test_coverage.txt file 62โ echo "cd cryptography-tools" 63โ cd cryptography-tools 64โ echo " " 65โ echo "touch \"$GOPATH/coverage-results/test_coverage.txt\"" 66โ touch "$GOPATH/coverage-results/test_coverage.txt" 67โ echo " " 68โ 69โ # encryptfile test ------------------------------------------------- 70โ echo "encryptfile Run go test -cover --------------------------------" 71โ echo "cd encryptfile" 72โ cd encryptfile 73โ echo "go test -cover ./... | tee test/test_coverage.txt" 74โ go test -cover ./... | tee test/test_coverage.txt 75โ echo "Clean test_coverage.txt file - add some whitespace to the begining of each line" 76โ echo "sed -i -e 's/^/ /' test/test_coverage.txt" 77โ sed -i -e 's/^/ /' test/test_coverage.txt 78โ echo "cat \"test/test_coverage.txt\" >> \"$GOPATH/coverage-results/test_coverage.txt\"" 79โ cat "test/test_coverage.txt" >> "$GOPATH/coverage-results/test_coverage.txt" 80โ echo " " 81โ 82โ # decryptfile test -------------------------------------------------- 83โ echo "decryptfile Run go test -cover --------------------------------" 84โ echo "cd ../decryptfile" 85โ cd ../decryptfile 86โ echo "go test -cover ./... | tee test/test_coverage.txt" 87โ go test -cover ./... | tee test/test_coverage.txt 88โ echo "Clean test_coverage.txt file - add some whitespace to the begining of each line" 89โ echo "sed -i -e 's/^/ /' test/test_coverage.txt" 90โ sed -i -e 's/^/ /' test/test_coverage.txt 91โ echo "cat \"test/test_coverage.txt\" >> \"$GOPATH/coverage-results/test_coverage.txt\"" 92โ cat "test/test_coverage.txt" >> "$GOPATH/coverage-results/test_coverage.txt" 93โ echo " " 94โ 95โ # md5-hash-file test ------------------------------------------------- 96โ echo "md5-hash-file Run go test -cover -------------------------------" 97โ echo "cd ../md5-hash-file" 98โ cd ../md5-hash-file 99โ echo "go test -cover ./... | tee test/test_coverage.txt" 100โ go test -cover ./... | tee test/test_coverage.txt 101โ echo "Clean test_coverage.txt file - add some whitespace to the begining of each line" 102โ echo "sed -i -e 's/^/ /' test/test_coverage.txt" 103โ sed -i -e 's/^/ /' test/test_coverage.txt 104โ echo "cat \"test/test_coverage.txt\" >> \"$GOPATH/coverage-results/test_coverage.txt\"" 105โ cat "test/test_coverage.txt" >> "$GOPATH/coverage-results/test_coverage.txt" 106โ echo " " 107โ 108โ # sha256-hash-file test ---------------------------------------------- 109โ echo "sha256-hash-file Run go test -cover ----------------------------" 110โ echo "cd ../sha256-hash-file" 111โ cd ../sha256-hash-file 112โ echo "go test -cover ./... | tee test/test_coverage.txt" 113โ go test -cover ./... | tee test/test_coverage.txt 114โ echo "Clean test_coverage.txt file - add some whitespace to the begining of each line" 115โ echo "sed -i -e 's/^/ /' test/test_coverage.txt" 116โ sed -i -e 's/^/ /' test/test_coverage.txt 117โ echo "cat \"test/test_coverage.txt\" >> \"$GOPATH/coverage-results/test_coverage.txt\"" 118โ cat "test/test_coverage.txt" >> "$GOPATH/coverage-results/test_coverage.txt" 119โ echo " " 120โ 121โ # cd into markdowntools ---------------------------------------------- 122โ echo "cd ../../markdown-tools" 123โ cd ../../markdown-tools 124โ echo " " 125โ 126โ # markdown-create-table-of-contents test ----------------------------- 127โ echo "markdown-create-table-of-contents Run go test -cover -----------" 128โ echo "cd markdown-create-table-of-contents" 129โ cd markdown-create-table-of-contents 130โ echo "go test -cover ./... | tee test/test_coverage.txt" 131โ go test -cover ./... | tee test/test_coverage.txt 132โ echo "Clean test_coverage.txt file - add some whitespace to the begining of each line" 133โ echo "sed -i -e 's/^/ /' test/test_coverage.txt" 134โ sed -i -e 's/^/ /' test/test_coverage.txt 135โ echo "cat \"test/test_coverage.txt\" >> \"$GOPATH/coverage-results/test_coverage.txt\"" 136โ cat "test/test_coverage.txt" >> "$GOPATH/coverage-results/test_coverage.txt" 137โ echo " " 138โ 139โ # markdown-delimiter-doer test --------------------------------------- 140โ echo "markdown-delimiter-doer Run go test -cover ---------------------" 141โ echo "cd ../markdown-delimiter-doer" 142โ cd ../markdown-delimiter-doer 143โ echo "go test -cover ./... | tee test/test_coverage.txt" 144โ go test -cover ./... | tee test/test_coverage.txt 145โ echo "Clean test_coverage.txt file - add some whitespace to the begining of each line" 146โ echo "sed -i -e 's/^/ /' test/test_coverage.txt" 147โ sed -i -e 's/^/ /' test/test_coverage.txt 148โ echo "cat \"test/test_coverage.txt\" >> \"$GOPATH/coverage-results/test_coverage.txt\"" 149โ cat "test/test_coverage.txt" >> "$GOPATH/coverage-results/test_coverage.txt" 150โ echo " " 151โ 152โ # --------------------------------------------------------------------- 153โ echo "Print out test covergage file -----------------------------------" 154โ cat "$GOPATH/coverage-results/test_coverage.txt" 155โ echo " " 156โ 157โ echo "unit-tests.sh (END)" 158โ echo " " โโโโโฏ
ยท ยท ยท
ยฉ 2022 source.community