Skip to content

Commit 38e831c

Browse files
authored
Run tests on Appveyor (#303)
1 parent b257549 commit 38e831c

File tree

4 files changed

+56
-4
lines changed

4 files changed

+56
-4
lines changed

Diff for: Taskfile.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tasks:
44
protoc:
55
desc: Compile protobuf definitions
66
cmds:
7-
- protoc --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/commands/*.proto
7+
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/commands/*.proto'
88

99
build:
1010
desc: Build the project
@@ -26,7 +26,7 @@ tasks:
2626
desc: Run integration tests only
2727
cmds:
2828
- go test -run Integration {{ default "-v" .GOFLAGS }} -coverprofile=coverage_integ.txt {{ default .DEFAULT_TARGETS .TARGETS }} {{.TEST_LDFLAGS}}
29-
- pytest test/
29+
- pytest test
3030

3131
test-legacy:
3232
desc: Run tests for the `legacy` package

Diff for: appveyor.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
build: off
2+
deploy: off
3+
4+
clone_folder: C:\arduino-cli
5+
shallow_clone: true
6+
7+
skip_tags: true
8+
skip_branch_with_pr: true
9+
10+
environment:
11+
GOPATH: c:\gopath
12+
PROTOC_PATH: c:\protoc
13+
PROTOC_BINARY: protoc.exe
14+
# add protoc, gopath and override default Python 2.7
15+
PATH: $(PROTOC_PATH);$(PROTOC_PATH)\bin;$(GOPATH)\bin;C:\Python37;C:\Python37\Scripts;$(PATH)
16+
17+
stack: go 1.12
18+
19+
install:
20+
# install the task executor
21+
- curl -o task.zip -LO https://github.com/go-task/task/releases/download/v2.6.0/task_windows_amd64.zip
22+
- 7z e task.zip -o%GOPATH%\bin
23+
# golang dependencies needed at test time
24+
- go get github.com/golangci/govet
25+
- go get golang.org/x/lint/golint
26+
# Python dependencies needed at test time
27+
- python -V
28+
- pip install -r test\requirements.txt
29+
# protobuf tooling needed at test time. We use a very old version of the compiler
30+
# because of this: https://github.com/protocolbuffers/protobuf/issues/3957
31+
- go get github.com/golang/protobuf/protoc-gen-go
32+
- curl -o protoc.zip -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.4.0/protoc-3.4.0-win32.zip
33+
- 7z e protoc.zip -o%PROTOC_PATH%
34+
35+
test_script:
36+
# Check if the Go code is properly formatted and run the linter
37+
- task.exe check
38+
# Ensure protobufs compile
39+
- task.exe protoc
40+
# re-enable after fixing go tests
41+
# - task.exe test-integration
42+
# build the binary
43+
- task.exe build
44+
# run e2e tests
45+
- pytest test
46+
47+
# uncomment to debug builds
48+
# on_finish:
49+
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

Diff for: test/conftest.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ def data_dir(tmpdir_factory):
2424
A tmp folder will be created before running
2525
the tests and deleted at the end.
2626
"""
27-
fn = tmpdir_factory.mktemp('ArduinoTest')
28-
return fn
27+
return str(tmpdir_factory.mktemp('ArduinoTest'))
2928

3029

3130
@pytest.fixture(scope="session")

Diff for: test/test_main.py

+4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ def test_command_lib_search(run_command):
6262
assert number_of_libs == number_of_libs_from_json
6363

6464

65+
@pytest.mark.skipif(os.getenv('APPVEYOR'), reason="Appveyor VMs have no serial ports")
6566
def test_command_board_list(run_command):
67+
result = run_command('core update-index')
68+
assert result.ok
6669
result = run_command('board list --format json')
6770
assert result.ok
6871
# check is a valid json and contains a list of ports
@@ -73,6 +76,7 @@ def test_command_board_list(run_command):
7376
assert 'protocol_label' in port
7477

7578

79+
@pytest.mark.skipif(os.getenv('APPVEYOR'), reason="Appveyor VMs have no serial ports")
7680
def test_command_board_listall(run_command):
7781
result = run_command('board listall')
7882
assert result.ok

0 commit comments

Comments
 (0)