Skip to content

Commit

Permalink
Merge pull request #210 from otiai10/develop
Browse files Browse the repository at this point in the history
Enable FreeBSD test on GitHub Actions
  • Loading branch information
otiai10 authored Jan 4, 2021
2 parents 45a1cf5 + fe7e264 commit a95e63e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
strategy:
matrix:
go: ['1.14', '1.15']
name: macOS Go${{ matrix.go }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -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:
Expand All @@ -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 }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ gosseract.iml
.vagrant
coverage.txt
vendor
test/runtimes/TESTRESULT.*.txt

# Editors
.vscode
8 changes: 6 additions & 2 deletions test/runtime
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

set -e
set -o pipefail
# set -o pipefail

PROJDIR=$(dirname "$(cd "$(dirname "${0}")"; pwd -P)")

Expand Down Expand Up @@ -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
}
Expand Down
9 changes: 6 additions & 3 deletions test/runtimes/freebsd.Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a95e63e

Please sign in to comment.