From b745a68b3f067fac0e73fa4a96d4058b2c2db8a0 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Fri, 28 Jan 2022 05:19:25 -0800 Subject: [PATCH] Add github actions (#43) * Add github actions * More platforms * Try upgrading goreleaser. * Add badge --- .github/workflows/go.yml | 63 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 30 +++++++++++++++++ .goreleaser.yml | 6 ++++ .travis.yml | 44 ------------------------ README.md | 4 +-- appveyor.yml | 18 ---------- 6 files changed, 100 insertions(+), 65 deletions(-) create mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..a19bfc2 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,63 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + + +jobs: + build: + strategy: + matrix: + go-version: [1.15.x, 1.16.x, 1.17.x,] + os: [ubuntu-latest, macos-latest, windows-latest] + env: + CGO_ENABLED: 0 + runs-on: ${{ matrix.os }} + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Vet + run: go vet ./... + + - name: Test + run: go test ./... + + - name: Test Race + env: + CGO_ENABLED: 1 + run: go test -cpu="1,4" -short -race -v ./... + + build-special: + env: + CGO_ENABLED: 0 + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17.x + + - name: Checkout code + uses: actions/checkout@v2 + + - name: fmt + run: diff <(gofmt -d .) <(printf "") + + - name: Test 386 + run: GOOS=linux GOARCH=386 go test ./... + + - name: goreleaser deprecation + run: curl -sfL https://git.io/goreleaser | VERSION=v1.4.1 sh -s -- check + + - name: goreleaser snapshot + run: curl -sL https://git.io/goreleaser | VERSION=v1.4.1 sh -s -- --snapshot --skip-publish --rm-dist + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..befab01 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: goreleaser + +on: + push: + tags: + - 'v*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17.x + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: 1.4.1 + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CGO_ENABLED: 0 diff --git a/.goreleaser.yml b/.goreleaser.yml index 2ef2cb9..1ce056a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -7,6 +7,7 @@ builds: - CGO_ENABLED=0 flags: - -ldflags=-s -w + - -trimpath goos: - aix - linux @@ -17,7 +18,12 @@ builds: goarch: - 386 - amd64 + - arm - arm64 + - ppc64 + - ppc64le + - mips64 + - mips64le goarm: - 7 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bc7f93f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -language: go - -os: - - linux - - osx - -go: - - 1.14.x - - 1.15.x - - 1.16.x - - master - -script: - - go test -v -cpu=2 ./... - - go test -v -cpu=1,2,4 -short -race ./... - -matrix: - allow_failures: - - go: 'master' - fast_finish: true - include: - - stage: other - go: 1.16.x - os: linux - arch: amd64 - script: - - go vet ./... - - diff <(gofmt -d .) <(printf "") - - diff <(gofmt -d ./private) <(printf "") - - curl -sfL https://git.io/goreleaser | VERSION=v0.157.0 sh -s -- check # check goreleaser config for deprecations - - curl -sL https://git.io/goreleaser | VERSION=v0.157.0 sh -s -- --snapshot --skip-publish --rm-dist - -deploy: - - provider: script - skip_cleanup: true - script: curl -sL https://git.io/goreleaser | VERSION=v0.157.0 bash || true - on: - tags: true - condition: ($TRAVIS_OS_NAME = linux) && ($TRAVIS_CPU_ARCH = amd64) - go: 1.16.x -branches: - only: - - master - - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ diff --git a/README.md b/README.md index 8fd754d..f81f4a5 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,8 @@ This will format your assembler code in a similar way that `gofmt` formats your Read Introduction: [asmfmt: Go Assembler Formatter](https://blog.klauspost.com/asmfmt-assembler-formatter/) -[![Build Status](https://travis-ci.com/klauspost/asmfmt.svg?branch=master)](https://travis-ci.com/klauspost/asmfmt) -[![Windows Build](https://ci.appveyor.com/api/projects/status/s729ayhkqkjf0ye6/branch/master?svg=true)](https://ci.appveyor.com/project/klauspost/asmfmt/branch/master) [![Go Reference](https://pkg.go.dev/badge/klauspost/asmfmt.svg)](https://pkg.go.dev/klauspost/asmfmt) - +[![Go](https://github.com/klauspost/asmfmt/actions/workflows/go.yml/badge.svg)](https://github.com/klauspost/asmfmt/actions/workflows/go.yml) See [Example 1](https://files.klauspost.com/diff.html), [Example 2](https://files.klauspost.com/diff2.html), [Example 3](https://files.klauspost.com/diff3.html), or compare files in the [testdata folder](https://github.com/klauspost/asmfmt/tree/master/testdata). diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index e788e85..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: "{build}" - -os: Windows Server 2012 R2 - -clone_folder: c:\gopath\src\github.com\klauspost\asmfmt - -environment: - GOPATH: c:\gopath - -install: - - echo %PATH% - - echo %GOPATH% - - go version - - go env - - go get -d ./... - -build_script: - - go test -v ./...