Skip to content

Commit

Permalink
Add github workflow files and remove travis
Browse files Browse the repository at this point in the history
Add rebase, release-drafter and tests actions. Add codecov config.
Update README.
  • Loading branch information
matrixik committed Jul 26, 2021
1 parent 8535650 commit d66add8
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 29 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
issue_comment:
types: [created]

name: Automatic Rebase
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Automatic Rebase
uses: cirrus-actions/rebase@1.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
- main
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82 changes: 82 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
on:
push:
branches:
- master
- main
# Only run if there are changes to Go code or related configurations
paths:
- "**.go"
- "go.mod"
- "go.sum"
- "codecov.yml"
pull_request:
# Only run if there are changes to Go code or related configurations
paths:
- "**.go"
- "go.mod"
- "go.sum"
- "codecov.yml"

name: Tests
jobs:
test-cache:
name: "Run unit tests"
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.16.x, 1.x]
steps:
uses: actions/checkout@v2
with:
fetch-depth: 1
uses: WillAbides/setup-go-faster@v1
with:
go-version: ${{ matrix.go-version }}

- uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test with race and coverage
run: |
go test -race -coverprofile=coverage.out -covermode=atomic
go tool cover -func=coverage.out
- uses: codecov/codecov-action@v2
with:
files: ./coverage.out

lint:
name: "Run static analysis"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: WillAbides/setup-go-faster@v1
with:
go-version: "1.x"

- run: "GO111MODULE=on go get honnef.co/go/tools/cmd/staticcheck"

- uses: actions/cache@v2
with:
path: ~/.cache/staticcheck
key: staticcheck-${{ github.sha }}
restore-keys: |
staticcheck-
- run: "go vet ./..."
- run: "$(go env GOPATH)/bin/staticcheck ./..."
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ slug
Package `slug` generate slug from unicode string, URL-friendly slugify with
multiple languages support.

[![GoDoc](https://godoc.org/github.com/gosimple/slug?status.png)](https://godoc.org/github.com/gosimple/slug)
[![Build Status](https://travis-ci.com/gosimple/slug.svg?branch=master)](https://travis-ci.com/gosimple/slug)

[Documentation online](http://godoc.org/github.com/gosimple/slug)
[![Go Reference](https://pkg.go.dev/badge/github.com/gosimple/slug.svg)](https://pkg.go.dev/github.com/gosimple/slug)
[![Tests](https://github.com/gosimple/slug/actions/workflows/tests.yml/badge.svg)](https://github.com/gosimple/slug/actions/workflows/tests.yml)
[![codecov](https://codecov.io/gh/gosimple/slug/branch/master/graph/badge.svg?token=FT2kEZHQW7)](https://codecov.io/gh/gosimple/slug)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/gosimple/slug?logo=github&sort=semver)](https://github.com/gosimple/slug/releases)

## Example

Expand Down
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
comment:
layout: "diff, files"
behavior: default
require_changes: false # if true: only post the comment if coverage changes

0 comments on commit d66add8

Please sign in to comment.