From 3ad9df9e7943eb75a723fd14148e3c5403757967 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Tue, 23 Jul 2019 14:52:49 +0200 Subject: [PATCH 1/7] add Appveyor configuration --- Taskfile.yml | 2 +- appveyor.yml | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 appveyor.yml diff --git a/Taskfile.yml b/Taskfile.yml index 04c4c2f9ac2..94da72fc939 100755 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -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..7bc5260fca5 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,38 @@ +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 + # add protoc, gopath and override default Python 2.7 + 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 + - go get github.com/golang/protobuf/protoc-gen-go + - curl -o protoc.zip -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.8.0/protoc-3.8.0-win64.zip + - 7z e protoc.zip -o%PROTOC_PATH% + +test_script: + - task.exe test-integration + +# 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 From c15b23e59ae34e04478cc9a909c4896ded38dedc Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Tue, 23 Jul 2019 16:50:53 +0200 Subject: [PATCH 2/7] only run python tests convert py.path to string --- appveyor.yml | 4 +++- test/conftest.py | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7bc5260fca5..e7e66e6a2ad 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,7 +31,9 @@ install: - 7z e protoc.zip -o%PROTOC_PATH% test_script: - - task.exe test-integration + # re-enable after fixing go tests + # - task.exe test-integration + - pytest test # uncomment to debug builds on_finish: 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") From e8b13d952419429df0dcee80e5e899b5f587fe0e Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Tue, 23 Jul 2019 17:17:40 +0200 Subject: [PATCH 3/7] build the binary, enable the linters --- appveyor.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index e7e66e6a2ad..4e5f792211f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,8 +31,15 @@ install: - 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 From 63f5447f5ef0354862f2a027a2de46b64a8dfec1 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Tue, 23 Jul 2019 17:30:57 +0200 Subject: [PATCH 4/7] allow task to get protoc bin name from env --- Taskfile.yml | 2 +- appveyor.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index 94da72fc939..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 diff --git a/appveyor.yml b/appveyor.yml index 4e5f792211f..3556106ac62 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,6 +10,7 @@ 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)\bin;$(GOPATH)\bin;C:\Python37;C:\Python37\Scripts;$(PATH) From 742d63888051fd930da2b2e232b484d83288feb8 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Tue, 23 Jul 2019 17:56:53 +0200 Subject: [PATCH 5/7] use an ancient protoc version to expand globs document the reason --- appveyor.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 3556106ac62..c6bb944dcb9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,7 +12,7 @@ environment: PROTOC_PATH: c:\protoc PROTOC_BINARY: protoc.exe # add protoc, gopath and override default Python 2.7 - PATH: $(PROTOC_PATH)\bin;$(GOPATH)\bin;C:\Python37;C:\Python37\Scripts;$(PATH) + PATH: $(PROTOC_PATH);$(PROTOC_PATH)\bin;$(GOPATH)\bin;C:\Python37;C:\Python37\Scripts;$(PATH) stack: go 1.12 @@ -26,9 +26,10 @@ install: # Python dependencies needed at test time - python -V - pip install -r test\requirements.txt - # protobuf tooling needed at test time + # 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.8.0/protoc-3.8.0-win64.zip + - 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: From 3cc24e2d37d2b8edf761b6b2fbbf3a5be07a1062 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Tue, 23 Jul 2019 18:17:54 +0200 Subject: [PATCH 6/7] update core index before running board list --- test/test_main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_main.py b/test/test_main.py index aa3a1cb5115..9d1c8db2dba 100644 --- a/test/test_main.py +++ b/test/test_main.py @@ -63,6 +63,8 @@ def test_command_lib_search(run_command): 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 From fec3a5dab7df6001b6a6e55c8442ce78d50ddb37 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Wed, 24 Jul 2019 16:56:20 +0200 Subject: [PATCH 7/7] skip serial test on appveyor same --- appveyor.yml | 4 ++-- test/test_main.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c6bb944dcb9..966d3076697 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -45,5 +45,5 @@ test_script: - 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 +# 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/test_main.py b/test/test_main.py index 9d1c8db2dba..228a5071514 100644 --- a/test/test_main.py +++ b/test/test_main.py @@ -62,6 +62,7 @@ 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 @@ -75,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