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
This commit is contained in:
Sebastian Zagrodzki
2021-11-02 09:18:09 +01:00
committed by GitHub
parent 0ce3a07f8e
commit d3bdbe53c8
7 changed files with 40 additions and 72 deletions

View File

@@ -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/...

View File

@@ -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

4
.github/test-coverage.sh vendored Normal file
View File

@@ -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

34
.github/workflows/build-and-test.yaml vendored Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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
=============

View File

@@ -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