From 7e281e833f79a131f03279e64b003f61321d2f9e Mon Sep 17 00:00:00 2001 From: vcaesar Date: Sun, 16 Sep 2018 20:17:40 -0400 Subject: [PATCH] add ci support --- appveyor.yml | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ config.yml | 19 +++++++++++++ hook.go | 2 +- 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 appveyor.yml create mode 100644 config.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..dc8f0fe --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,80 @@ +# version format +version: "{build}" + +# Operating system (build VM template) +# os: Windows Server 2012 R2 +os: Visual Studio 2017 + +# Platform. +# platform: +# - x64 +# - x86 + +clone_folder: c:\gopath\src\github.com\robotn\gohook + +# Environment variables +environment: + global: + GOPATH: C:\gopath + CC: gcc.exe + matrix: + - GOARCH: amd64 + # GOVERSION: 1.9.3 + GETH_ARCH: amd64 + MSYS2_ARCH: x86_64 + MSYS2_BITS: 64 + MSYSTEM: MINGW64 + PATH: C:\msys64\mingw64\bin\;C:\Program Files (x86)\NSIS\;%PATH% + - GOARCH: 386 + # GOVERSION: 1.9.3 + GETH_ARCH: 386 + MSYS2_ARCH: i686 + MSYS2_BITS: 32 + MSYSTEM: MINGW32 + PATH: C:\msys64\mingw32\bin\;C:\Program Files (x86)\NSIS\;%PATH% + # - COMPILER: MINGW_W64 + # ARCHITECTURE: x64 + GOVERSION: 1.10.4 + # GOPATH: c:\gopath + +# scripts that run after cloning repository +# install: +# - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% +# - go version +# - go env +# - gcc --version + # - python --version + +install: + - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% + - git submodule update --init + - rmdir C:\go /s /q + - appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-%GETH_ARCH%.zip + - 7z x go%GOVERSION%.windows-%GETH_ARCH%.zip -y -oC:\ > NUL + - go version + - go env + - gcc --version + +# To run your custom scripts instead of automatic MSBuild +build_script: + # We need to disable firewall - https://github.com/appveyor/ci/issues/1579#issuecomment-309830648 + - ps: Disable-NetFirewallRule -DisplayName 'File and Printer Sharing (SMB-Out)' + - cd c:\gopath\src\github.com\robotn\gohook + - git branch + - go get -t ./... + +# To run your custom scripts instead of automatic tests +test_script: + # Unit tests + - ps: Add-AppveyorTest "Unit Tests" -Outcome Running + - go test -u github.com/go-vgo/robotgo/... + - ps: Update-AppveyorTest "Unit Tests" -Outcome Passed + +# notifications: +# - provider: Email +# to: +# - .io +# on_build_failure: true +# on_build_status_changed: true +# to disable deployment +deploy: off diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..7570316 --- /dev/null +++ b/config.yml @@ -0,0 +1,19 @@ +version: 2 + +jobs: + build: + docker: + # using custom image, see .circleci/images/primary/Dockerfile + - image: govgo/robotgoci:1.10.3 + working_directory: /gopath/src/github.com/robotn/gohook + steps: + - checkout + # specify any bash command here prefixed with `run: ` + # override: + # './...' is a relative pattern which means all subdirectories + # - run: go get -u golang.org/x/sys/unix + - run: go get -v -t -d ./... + - run: go test -v ./... + # codecov.io + # - run: go test -v -covermode=count -coverprofile=coverage.out + # - run: bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/hook.go b/hook.go index a5b3b91..7984e5e 100644 --- a/hook.go +++ b/hook.go @@ -21,11 +21,11 @@ import( // AddEvent add event listener func AddEvent(key string) int { cs := C.CString(key) + defer C.free(unsafe.Pointer(cs)) eve := C.add_event(cs) geve := int(eve) - defer C.free(unsafe.Pointer(cs)) return geve }