Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-103: Added github workflows for build and release.yml. #104

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build

on:
push:
branches:
- develop
- master
pull_request:

jobs:

go-legacy-test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.20', '1.21' ]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Go get
run: go get -t ./...
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.4'
- name: Go get
run: go get -t ./...
- name: Build
run: go build -v ./...
- name: Test
run: go test -v -covermode=atomic -coverprofile=cover.out -coverpkg=. ./...
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=cover.out -service=github

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.4'
- name: Install checks
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
go install github.com/client9/misspell/cmd/misspell@latest
- name: Go get
run: go get -t ./...
- name: Go vet
run: go vet $(go list ./... | grep -v /vendor/)
- name: Go mod
run: go mod tidy; git diff --exit-code go.mod go.sum
- name: Go fmt
run: go fmt $(go list ./... | grep -v /vendor/); git diff --exit-code
- name: Staticcheck
run: staticcheck -checks all,-ST1000 ./...
- name: Misspell
run: misspell -error -locale US .
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release

on:
push:
tags:
- '*'

# Make sure the GITHUB_TOKEN has permission to upload to our releases
permissions:
contents: write

jobs:

create_release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Create release draft
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref_name }}
body: |
A new release
draft: true
prerelease: false
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<p align="center"><a href="https://resgate.io" target="_blank" rel="noopener noreferrer"><img width="100" src="https://resgate.io/img/resgate-logo.png" alt="Resgate logo"></a></p>
<h2 align="center"><b>RES Service for Go</b><br/>Synchronize Your Clients</h2>
<p align="center">
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
<a href="http://goreportcard.com/report/jirenius/go-res"><img src="http://goreportcard.com/badge/github.com/jirenius/go-res" alt="Report Card"></a>
<a href="https://travis-ci.com/jirenius/go-res"><img src="https://travis-ci.com/jirenius/go-res.svg?branch=master" alt="Build Status"></a>
<a href="https://github.com/jirenius/go-res/actions/workflows/build.yml?query=branch%3Amaster"><img src="https://img.shields.io/github/actions/workflow/status/jirenius/go-res/build.yml?branch=master" alt="Build Status"></a>
<a href="https://coveralls.io/github/jirenius/go-res?branch=master"><img src="https://coveralls.io/repos/github/jirenius/go-res/badge.svg?branch=master" alt="Coverage"></a>
<a href="https://pkg.go.dev/github.com/jirenius/go-res"><img src="https://img.shields.io/static/v1?label=reference&message=go.dev&color=5673ae" alt="Reference"></a>
</p>
Expand Down
1 change: 0 additions & 1 deletion request.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ func (r *Request) IsHTTP() bool {
// See: https://resgate.io/docs/specification/res-service-protocol/#status-codes
//
// Only valid for auth, access, and call requests.

func (r *Request) SetResponseStatus(code int) {
if !r.isHTTP {
panic("call to SetResponseStatus when IsHTTP is false")
Expand Down
4 changes: 1 addition & 3 deletions scripts/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ fi
echo "Checking with go vet..."
go vet ./...
echo "Checking with staticcheck..."
staticcheck ./...
echo "Checking with golint..."
golint -set_exit_status ./...
staticcheck -checks all,-ST1000 ./...
echo "Checking with misspell..."
misspell -error -locale US .
11 changes: 2 additions & 9 deletions scripts/cover.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#!/bin/bash -e
# Run from directory above via ./scripts/cover.sh

go test -covermode=atomic -coverprofile=./cover.out -coverpkg=. ./...

# If we have an arg, assume travis run and push to coveralls. Otherwise launch browser results
if [[ -n $1 ]]; then
$HOME/gopath/bin/goveralls -coverprofile=cover.out -service travis-ci
rm -rf ./cover.out
else
go tool cover -html=cover.out
fi
go test -v -covermode=atomic -coverprofile=./cover.out -coverpkg=. ./...
go tool cover -html=cover.out
8 changes: 2 additions & 6 deletions scripts/install-checks.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/bin/bash -e

pushd /tmp > /dev/null
go get -u github.com/mattn/goveralls
go get -u honnef.co/go/tools/cmd/staticcheck
go get -u golang.org/x/lint/golint
go get -u github.com/client9/misspell/cmd/misspell
popd > /dev/null
go install honnef.co/go/tools/cmd/staticcheck@latest
go install github.com/client9/misspell/cmd/misspell@latest
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Run from directory above via ./scripts/lint.sh

$(exit $(go fmt ./... | wc -l))
go mod tidy
go vet ./...
golint ./...
misspell -error -locale US ./...