From d3bdbe53c8b543b58a569a2d2bca4ccdcfbe9cd4 Mon Sep 17 00:00:00 2001 From: Sebastian Zagrodzki Date: Tue, 2 Nov 2021 09:18:09 +0100 Subject: [PATCH] Migrate from Travis/Appveyor combo to GitHub actions (#104) * Add a github actions workflow config (linux + windows build) * Remove Travis config, migrated to Github Actions * Remove AppVeyor configs, migrated to Github Actions --- .appveyor/install.sh | 17 -------------- .appveyor/upgrade_pacman.sh | 8 ------- .github/test-coverage.sh | 4 ++++ .github/workflows/build-and-test.yaml | 34 +++++++++++++++++++++++++++ .travis.yml | 32 ------------------------- README.md | 7 ++---- appveyor.yml | 10 -------- 7 files changed, 40 insertions(+), 72 deletions(-) delete mode 100644 .appveyor/install.sh delete mode 100755 .appveyor/upgrade_pacman.sh create mode 100644 .github/test-coverage.sh create mode 100644 .github/workflows/build-and-test.yaml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.appveyor/install.sh b/.appveyor/install.sh deleted file mode 100644 index 44e645c..0000000 --- a/.appveyor/install.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -export PATH="/mingw64/bin:${PATH}" -export PKG_CONFIG_PATH="/mingw64/lib/pkgconfig:${PKG_CONFIG_PATH}" -export GOROOT=/mingw64/lib/go -export GOPATH=/go -export CGO_ENABLED=1 - -set -x - -pacman --noconfirm -S \ - mingw-w64-x86_64-go \ - mingw-w64-x86_64-libusb - -go version -go get -t github.com/google/gousb/... -go test github.com/google/gousb/... diff --git a/.appveyor/upgrade_pacman.sh b/.appveyor/upgrade_pacman.sh deleted file mode 100755 index f6bd879..0000000 --- a/.appveyor/upgrade_pacman.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -export PATH="/mingw64/bin:${PATH}" -set -x -curl -O https://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz -curl -O https://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig -pacman-key --verify msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig &&\ -pacman --noconfirm -U msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz -pacman --noconfirm -Syy pacman diff --git a/.github/test-coverage.sh b/.github/test-coverage.sh new file mode 100644 index 0000000..79019dc --- /dev/null +++ b/.github/test-coverage.sh @@ -0,0 +1,4 @@ +#!/bin/sh +echo 'mode: count' > coverage.merged &&\ + go list -f '{{.Dir}}' ./... | xargs -n1 -I'{}' sh -c ': > coverage.tmp; go test -v -covermode=count -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.merged' &&\ + rm coverage.tmp diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml new file mode 100644 index 0000000..39e826e --- /dev/null +++ b/.github/workflows/build-and-test.yaml @@ -0,0 +1,34 @@ +name: build-and-test +on: [pull_request, push] +jobs: + linux: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.17 + - run: sudo apt-get install libusb-1.0-0-dev + - run: go install golang.org/x/tools/cmd/cover@latest + - run: go install golang.org/x/lint/golint@latest + - run: $HOME/go/bin/golint ./... + - run: sh ./.github/test-coverage.sh + - uses: shogo82148/actions-goveralls@v1 + with: + path-to-profile: coverage.merged + ignore: libusb.go,error.go + windows: + runs-on: windows-2022 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.17 + - uses: msys2/setup-msys2@v2 + with: + install: |- + mingw64/mingw-w64-x86_64-libusb + mingw64/mingw-w64-x86_64-pkg-config + - run: echo "D:\a\_temp\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - run: go test ./... + - run: go run ./lsusb diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index aa107ee..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: go -dist: bionic - -go: - - 1.10.x - - 1.11.x - - 1.12.x - - 1.13.x - - 1.14.x - - 1.15.x - - tip - -addons: - apt: - packages: - libusb-1.0-0-dev - -install: - - go get golang.org/x/tools/cmd/cover - # Golint requires Go 1.9 or later. - - if ! [[ "$TRAVIS_GO_VERSION" =~ ^1\.7\.([0-9]+|x)$ || "$TRAVIS_GO_VERSION" =~ ^1\.8\.([0-9]+|x)$ ]]; then go get golang.org/x/lint/golint; fi - - go get github.com/mattn/goveralls - -script: - # a workaround for go test not supporting coverage for multiple packages in a single invocation. - # If goveralls upload fails, ignore the result. - # Golint requires Go 1.9 or later. - - if ! [[ "$TRAVIS_GO_VERSION" =~ ^1\.7\.([0-9]+|x)+$ || "$TRAVIS_GO_VERSION" =~ ^1\.8\.([0-9]+|x)$ ]]; then $HOME/gopath/bin/golint ./...; fi - - |- - echo 'mode: count' > coverage.merged && go list ./... | xargs -n1 -I{} sh -c ': > coverage.tmp; go test -v -covermode=count -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.merged' && rm coverage.tmp - - |- - $HOME/gopath/bin/goveralls -coverprofile=coverage.merged -service=travis-ci -ignore libusb.go,error.go || true diff --git a/README.md b/README.md index 289b27a..847669b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ Introduction [![Build Status][ciimg]][ci] [![GoDoc][docimg]][doc] [![Coverage Status][coverimg]][cover] -[![Build status][appveimg]][appveyor] The gousb package is an attempt at wrapping the libusb library into a Go-like binding. @@ -21,12 +20,10 @@ As of 2017-07-13 the 2.0 API is considered stable and 1.0 is deprecated. [coverimg]: https://coveralls.io/repos/github/google/gousb/badge.svg [cover]: https://coveralls.io/github/google/gousb -[ciimg]: https://travis-ci.org/google/gousb.svg -[ci]: https://travis-ci.org/google/gousb +[ciimg]: https://github.com/google/gousb/actions/workflows/build-and-test.yaml/badge.svg +[ci]: https://github.com/google/gousb/actions/workflows/build-and-test.yaml [docimg]: https://godoc.org/github.com/google/gousb?status.svg [doc]: https://godoc.org/github.com/google/gousb -[appveimg]: https://ci.appveyor.com/api/projects/status/661qp7x33o3wqe4o?svg=true -[appveyor]: https://ci.appveyor.com/project/zagrodzki/gousb Documentation ============= diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b91725e..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,10 +0,0 @@ -platform: x64 -image: Visual Studio 2019 - -clone_folder: C:\msys64\go\src\github.com\google\gousb - -install: - - C:\msys64\usr\bin\bash.exe -l /go/src/github.com/google/gousb/.appveyor/upgrade_pacman.sh - - C:\msys64\usr\bin\bash.exe -lc "cd /go/src/github.com/google/gousb/ && .appveyor/install.sh" - -build: off