Skip to content

Commit a95e63e

Browse files
authored
Merge pull request #210 from otiai10/develop
Enable FreeBSD test on GitHub Actions
2 parents 45a1cf5 + fe7e264 commit a95e63e

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

.github/workflows/runtime.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
go: ['1.14', '1.15']
16+
name: macOS Go${{ matrix.go }}
1617
steps:
1718
- name: Checkout
1819
uses: actions/checkout@v2
@@ -26,7 +27,7 @@ jobs:
2627
run: go get -u -v -t ./...
2728
- name: Test
2829
run: go test -v -cover ./...
29-
test:
30+
docker-test:
3031
runs-on: ubuntu-latest
3132
strategy:
3233
matrix:
@@ -39,9 +40,23 @@ jobs:
3940
- fedora
4041
- mingw
4142
- quickstart
43+
name: Docker ${{ matrix.runtime }}
4244
steps:
4345
- name: checkout
4446
uses: actions/checkout@v2
4547
- name: ${{ matrix.runtime }}
4648
shell: 'script -q -e -c "bash {0}"'
4749
run: bash ./test/runtime --driver docker --build --run ${{ matrix.runtime }}
50+
51+
vagrant-test:
52+
runs-on: macos-10.15
53+
strategy:
54+
matrix:
55+
runtime:
56+
- freebsd
57+
name: Vagrant ${{ matrix.runtime }}
58+
steps:
59+
- name: checkout
60+
uses: actions/checkout@v2
61+
- name: ${{ matrix.runtime }}
62+
run: bash ./test/runtime --driver vagrant --build --run ${{ matrix.runtime }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ gosseract.iml
3535
.vagrant
3636
coverage.txt
3737
vendor
38+
test/runtimes/TESTRESULT.*.txt
3839

3940
# Editors
4041
.vscode

test/runtime

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
set -e
4-
set -o pipefail
4+
# set -o pipefail
55

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

@@ -136,12 +136,16 @@ function test_vagrant_runtimes() {
136136
echo "│ [Vagrant] Making VM up..."
137137
vboxname=gosseract-test-${testcase}
138138
VAGRANT_VAGRANTFILE=${runtime} VIRTUALBOX_NAME=${vboxname} vagrant up --provider virtualbox | sed "s/^/│ /"
139-
VAGRANT_VAGRANTFILE=${runtime} VIRTUALBOX_NAME=${vboxname} vagrant provision | sed "s/^/│ /"
139+
TESTRESULT=`cat test/runtimes/TESTRESULT.${testcase}.txt`
140140
VAGRANT_VAGRANTFILE=${runtime} vagrant halt | sed "s/^/│ /"
141141
if [ -n "${REMOVE}" ]; then
142142
echo "│ [Vagrant] Removing VM..."
143143
VAGRANT_VAGRANTFILE=${runtime} vagrant destroy -f | sed "s/^/│ /"
144144
fi
145+
if [ "${TESTRESULT}" != "0" ]; then
146+
echo "Test failed: ${TESTCASE}"
147+
exit 1
148+
fi
145149
echo "└───────────── ${testcase} [OK]"
146150
done
147151
}

test/runtimes/freebsd.Vagrantfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ Vagrant.configure("2") do |config|
1616
mv /usr/local/share/tessdata/*.traineddata /tmp
1717
mv /tmp/eng.traineddata /usr/local/share/tessdata/
1818
cd $GOPATH/src/github.com/otiai10/gosseract
19-
go get -t -v ./...
20-
go test -v -cover github.com/otiai10/gosseract
21-
', :env => {"GOPATH" => "/home/vagrant/go"}
19+
go test -v -cover ./...
20+
echo $? > /vagrant/test/runtimes/TESTRESULT.freebsd.txt
21+
', :env => {
22+
"GOPATH" => "/home/vagrant/go",
23+
"GO111MODULE" => "on",
24+
}
2225
end

0 commit comments

Comments
 (0)