diff --git a/Taskfile.yml b/Taskfile.yml index 04c4c2f9ac2..605041cd535 100755 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -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 @@ -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 diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000000..966d3076697 --- /dev/null +++ b/appveyor.yml @@ -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')) \ No newline at end of file diff --git a/test/conftest.py b/test/conftest.py index afc1d5e2695..d8cd4a51534 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -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") diff --git a/test/test_main.py b/test/test_main.py index aa3a1cb5115..228a5071514 100644 --- a/test/test_main.py +++ b/test/test_main.py @@ -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 @@ -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