Skip to content

Commit

Permalink
feat: more ci updates
Browse files Browse the repository at this point in the history
  • Loading branch information
matoous committed May 16, 2024
1 parent e49a925 commit b55fea2
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 49 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
GOLANGCI_LINT_VERSION: v1.58

jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
version: ["1.20", "1.21", "1.22"]
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
go-version: ${{ matrix.version }}
- name: Test
run: make test

benchmark:
name: Benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
- uses: actions/setup-go@v2
with:
go-version-file: './go.mod'
- name: Benchmark
run: make bench

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: golangci-lint
uses: golangci/[email protected]
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
- name: tidy
run: |
make download
git diff-index HEAD
git diff --minimal --color=always --compact-summary --exit-code HEAD || FAILED=true ;
if [[ $FAILED ]];
then echo "❗️please run \"go mod tidy\" locally and commit the changes"
exit 1
fi
12 changes: 0 additions & 12 deletions .github/workflows/lint.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/test.yml

This file was deleted.

21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# Make this makefile self-documented with target `help`
.PHONY: help

help: ## Show help/documentation for the Makefile
.DEFAULT_GOAL := help
help: ## Show help
@grep -Eh '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

configure: ## Download dependencies
go mod download

lint: configure ## Lint the repository with golang-ci lint
.PHONY: lint
lint: download ## Lint the repository with golang-ci lint
golangci-lint run --max-same-issues 0 --max-issues-per-linter 0 $(if $(CI),--out-format code-climate > gl-code-quality-report.json 2>golangci-stderr-output)

test: configure ## Run all tests
.PHONY: test
test: download ## Run all tests
go test -v

bench: configure ## Run all benchmarks
.PHONY: bench
bench: download ## Run all benchmarks
go test -bench=.

.PHONY: download
download: ## Download dependencies
go mod download
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
[![GitHub issues](https://img.shields.io/github/issues/matoous/go-nanoid.svg)](https://github.com/matoous/go-nanoid/issues)
[![License](https://img.shields.io/badge/license-MIT%20License-blue.svg)](https://github.com/matoous/go-nanoid/LICENSE)


This package is Go implementation of [ai's](https://github.com/ai) [nanoid](https://github.com/ai/nanoid)!

**Safe.** It uses cryptographically strong random generator.
Expand Down

0 comments on commit b55fea2

Please sign in to comment.