From 0b84f8cff5ab51af43169d087777361a5076a313 Mon Sep 17 00:00:00 2001 From: Hiromu OCHIAI Date: Mon, 4 Jan 2021 18:06:58 +0900 Subject: [PATCH 1/3] Fix FreeBSD test script --- .gitignore | 1 + test/runtime | 8 ++++++-- test/runtimes/freebsd.Vagrantfile | 9 ++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) 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 From 18a7feec4886d8834deab921d569717e8eda9182 Mon Sep 17 00:00:00 2001 From: Hiromu OCHIAI Date: Mon, 4 Jan 2021 18:09:11 +0900 Subject: [PATCH 2/3] Enable FreeBSD test on CI workflow --- .github/workflows/runtime.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/runtime.yml b/.github/workflows/runtime.yml index 3e26a21..efab069 100644 --- a/.github/workflows/runtime.yml +++ b/.github/workflows/runtime.yml @@ -44,4 +44,16 @@ jobs: uses: actions/checkout@v2 - name: ${{ matrix.runtime }} shell: 'script -q -e -c "bash {0}"' - run: bash ./test/runtime --driver docker --build --run ${{ matrix.runtime }} + run: bash ./test/runtime --build --run ${{ matrix.runtime }} + + vagrant-test: + runs-on: macos-10.15 + strategy: + matrix: + runtime: + - freebsd + steps: + - name: checkout + uses: actions/checkout@v2 + - name: ${{ matrix.runtime }} + run: bash ./test/runtime --build --run ${{ matrix.runtime }} From fe7e264c0f3f4ad12c2c9e438304e49e3f8ef195 Mon Sep 17 00:00:00 2001 From: Hiromu OCHIAI Date: Mon, 4 Jan 2021 18:22:55 +0900 Subject: [PATCH 3/3] Fix wording for tests --- .github/workflows/runtime.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/runtime.yml b/.github/workflows/runtime.yml index efab069..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,12 +40,13 @@ 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 --build --run ${{ matrix.runtime }} + run: bash ./test/runtime --driver docker --build --run ${{ matrix.runtime }} vagrant-test: runs-on: macos-10.15 @@ -52,8 +54,9 @@ jobs: matrix: runtime: - freebsd + name: Vagrant ${{ matrix.runtime }} steps: - name: checkout uses: actions/checkout@v2 - name: ${{ matrix.runtime }} - run: bash ./test/runtime --build --run ${{ matrix.runtime }} + run: bash ./test/runtime --driver vagrant --build --run ${{ matrix.runtime }}