diff --git a/.github/workflows/runtime.yml b/.github/workflows/runtime.yml index 3e26a21..c05ca06 100644 --- a/.github/workflows/runtime.yml +++ b/.github/workflows/runtime.yml @@ -13,6 +13,7 @@ jobs: strategy: matrix: go: ['1.14', '1.15'] + name: macOS Go${{ matrix.go }} steps: - name: Checkout uses: actions/checkout@v2 @@ -26,7 +27,7 @@ jobs: run: go get -u -v -t ./... - name: Test run: go test -v -cover ./... - test: + docker-test: runs-on: ubuntu-latest strategy: matrix: @@ -39,9 +40,23 @@ jobs: - fedora - mingw - quickstart + name: Docker ${{ matrix.runtime }} steps: - name: checkout uses: actions/checkout@v2 - name: ${{ matrix.runtime }} shell: 'script -q -e -c "bash {0}"' run: bash ./test/runtime --driver docker --build --run ${{ matrix.runtime }} + + vagrant-test: + runs-on: macos-10.15 + strategy: + matrix: + runtime: + - freebsd + name: Vagrant ${{ matrix.runtime }} + steps: + - name: checkout + uses: actions/checkout@v2 + - name: ${{ matrix.runtime }} + run: bash ./test/runtime --driver vagrant --build --run ${{ matrix.runtime }} diff --git a/.gitignore b/.gitignore index 90f0292..8fdc8e7 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ gosseract.iml .vagrant coverage.txt vendor +test/runtimes/TESTRESULT.*.txt # Editors .vscode \ No newline at end of file diff --git a/test/runtime b/test/runtime index a20a41d..da0ad66 100755 --- a/test/runtime +++ b/test/runtime @@ -1,7 +1,7 @@ #!/bin/bash set -e -set -o pipefail +# set -o pipefail PROJDIR=$(dirname "$(cd "$(dirname "${0}")"; pwd -P)") @@ -136,12 +136,16 @@ function test_vagrant_runtimes() { echo "│ [Vagrant] Making VM up..." vboxname=gosseract-test-${testcase} VAGRANT_VAGRANTFILE=${runtime} VIRTUALBOX_NAME=${vboxname} vagrant up --provider virtualbox | sed "s/^/│ /" - VAGRANT_VAGRANTFILE=${runtime} VIRTUALBOX_NAME=${vboxname} vagrant provision | sed "s/^/│ /" + TESTRESULT=`cat test/runtimes/TESTRESULT.${testcase}.txt` VAGRANT_VAGRANTFILE=${runtime} vagrant halt | sed "s/^/│ /" if [ -n "${REMOVE}" ]; then echo "│ [Vagrant] Removing VM..." VAGRANT_VAGRANTFILE=${runtime} vagrant destroy -f | sed "s/^/│ /" fi + if [ "${TESTRESULT}" != "0" ]; then + echo "Test failed: ${TESTCASE}" + exit 1 + fi echo "└───────────── ${testcase} [OK]" done } diff --git a/test/runtimes/freebsd.Vagrantfile b/test/runtimes/freebsd.Vagrantfile index 0dd697e..fddc719 100644 --- a/test/runtimes/freebsd.Vagrantfile +++ b/test/runtimes/freebsd.Vagrantfile @@ -16,7 +16,10 @@ Vagrant.configure("2") do |config| mv /usr/local/share/tessdata/*.traineddata /tmp mv /tmp/eng.traineddata /usr/local/share/tessdata/ cd $GOPATH/src/github.com/otiai10/gosseract - go get -t -v ./... - go test -v -cover github.com/otiai10/gosseract - ', :env => {"GOPATH" => "/home/vagrant/go"} + go test -v -cover ./... + echo $? > /vagrant/test/runtimes/TESTRESULT.freebsd.txt + ', :env => { + "GOPATH" => "/home/vagrant/go", + "GO111MODULE" => "on", + } end