From 7eb393e4333d6e126a52db3172788dd259e611a0 Mon Sep 17 00:00:00 2001 From: Christoph Petrausch Date: Tue, 21 Apr 2020 22:18:14 +0200 Subject: [PATCH] Use github actions for CI --- .github/workflows/linting.yml | 10 ++++++++++ .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 20 ++++++++++++++++++++ .travis.yml | 33 --------------------------------- 4 files changed, 60 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/linting.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..6228a1c --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,10 @@ +on: [push, pull_request] +name: linting +jobs: + linting: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Run golangci-lint + uses: actions-contrib/golangci-lint@v1 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a846837 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: release + +on: + push: + tags: + - '*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Unshallow + run: git fetch --prune --unshallow + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.14.x + - name: Test + run: go test ./... + - name: Vet + run: go vet ./... + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..5eb4a04 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,20 @@ +on: [push, pull_request] +name: tests +jobs: + test: + strategy: + matrix: + go-version: [1.13.x, 1.14.x] + platform: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - name: Install Go + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Test + run: go test ./... + - name: Vet + run: go vet ./... \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5edcdd8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -language: go - -go: - - 1.10.x - -before_install: - - set -e - -script: | - GOOS=linux GOARCH=amd64 make build - for version in 5 6 7; do - GOOS=linux GOARCH=arm GOARM=${version} make build - done - -after_success: - - | - if [[ "${TRAVIS_PULL_REQUEST?}" == "false" ]] && [[ -n "${TRAVIS_TAG?}" ]]; then - go get github.com/itchio/gothub # install release cli - projectMeta="--user hikhvar --repo mqtt2prometheus --tag ${TRAVIS_TAG}" - gothub release \ - ${projectMeta} \ - --name "Version ${TRAVIS_TAG}" \ - --description "Automatic binary release of the git tag ${TRAVIS_TAG}" \ - --pre-release - - for srcFile in $(find bin/ -type f); do - gothub upload \ - ${projectMeta} \ - --name ${srcFile#bin/} \ - --file ${srcFile} - done - - fi