Skip to content

Run tests on Appveyor #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tasks:
protoc:
desc: Compile protobuf definitions
cmds:
- protoc --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/commands/*.proto
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/commands/*.proto'

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

test-legacy:
desc: Run tests for the `legacy` package
Expand Down
49 changes: 49 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
build: off
deploy: off

clone_folder: C:\arduino-cli
shallow_clone: true

skip_tags: true
skip_branch_with_pr: true

environment:
GOPATH: c:\gopath
PROTOC_PATH: c:\protoc
PROTOC_BINARY: protoc.exe
# add protoc, gopath and override default Python 2.7
PATH: $(PROTOC_PATH);$(PROTOC_PATH)\bin;$(GOPATH)\bin;C:\Python37;C:\Python37\Scripts;$(PATH)

stack: go 1.12

install:
# install the task executor
- curl -o task.zip -LO https://github.com/go-task/task/releases/download/v2.6.0/task_windows_amd64.zip
- 7z e task.zip -o%GOPATH%\bin
# golang dependencies needed at test time
- go get github.com/golangci/govet
- go get golang.org/x/lint/golint
# Python dependencies needed at test time
- python -V
- pip install -r test\requirements.txt
# protobuf tooling needed at test time. We use a very old version of the compiler
# because of this: https://github.com/protocolbuffers/protobuf/issues/3957
- go get github.com/golang/protobuf/protoc-gen-go
- curl -o protoc.zip -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.4.0/protoc-3.4.0-win32.zip
- 7z e protoc.zip -o%PROTOC_PATH%

test_script:
# Check if the Go code is properly formatted and run the linter
- task.exe check
# Ensure protobufs compile
- task.exe protoc
# re-enable after fixing go tests
# - task.exe test-integration
# build the binary
- task.exe build
# run e2e tests
- pytest test

# uncomment to debug builds
# on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
3 changes: 1 addition & 2 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def data_dir(tmpdir_factory):
A tmp folder will be created before running
the tests and deleted at the end.
"""
fn = tmpdir_factory.mktemp('ArduinoTest')
return fn
return str(tmpdir_factory.mktemp('ArduinoTest'))


@pytest.fixture(scope="session")
Expand Down
4 changes: 4 additions & 0 deletions test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def test_command_lib_search(run_command):
assert number_of_libs == number_of_libs_from_json


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


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