Compare commits

...

7 Commits

Author SHA1 Message Date
Denis Isaev 1778ebaefa dev: shorten description 2020-05-05 18:17:02 +03:00
Denis Isaev 1dd9e0522b dev: improve description 2020-05-05 18:11:57 +03:00
Denis Isaev 66883b5fcf dev: change icon and color on GitHub marketplace 2020-05-05 17:57:46 +03:00
Denis Isaev 8ea3043ee4 docs: improve info about performance 2020-05-05 17:51:32 +03:00
Denis Isaev 95f6eefffa docs: add perf stat into README.md 2020-05-05 17:36:44 +03:00
Isaev Denis 977a01f96c Merge pull request #8 from golangci/fix-go.mod-hash
fix go.mod hashsum
2020-05-05 17:20:28 +03:00
Denis Isaev 13e2c1f984 fix go.mod hashsum 2020-05-05 17:17:46 +03:00
6 changed files with 19 additions and 8 deletions
+10 -2
View File
@@ -2,9 +2,10 @@
[![Build Status](https://github.com/golangci/golangci-lint-action/workflows/build-and-test/badge.svg)](https://github.com/golangci/golangci-lint-action/actions) [![Build Status](https://github.com/golangci/golangci-lint-action/workflows/build-and-test/badge.svg)](https://github.com/golangci/golangci-lint-action/actions)
![GitHub Annotations](./static/annotations.png) It's the official GitHub action for [golangci-lint](https://github.com/golangci/golangci-lint) from it's authors.
The action runs [golangci-lint](https://github.com/golangci/golangci-lint) and reports issues from linters.
The action that runs [golangci-lint](https://github.com/golangci/golangci-lint) and reports issues from linters. ![GitHub Annotations](./static/annotations.png)
## How to use ## How to use
@@ -57,6 +58,13 @@ The action was implemented with performance in mind:
2. We don't use Docker because image pulling is slow. 2. We don't use Docker because image pulling is slow.
3. We do as much as we can in parallel, e.g. we download cache, go and golangci-lint binary in parallel. 3. We do as much as we can in parallel, e.g. we download cache, go and golangci-lint binary in parallel.
For example, in a repository of [golangci-lint](https://github.com/golangci/golangci-lint) running this action without the cache takes 50s, but with cache takes 14s:
* in parallel:
* 13s to download Go
* 4s to restore 50 MB of cache
* 1s to find and install `golangci-lint`
* 1s to run `golangci-lint` (it takes 35s without cache)
## Internals ## Internals
We use JavaScript-based action. We don't use Docker-based action because: We use JavaScript-based action. We don't use Docker-based action because:
+3 -3
View File
@@ -1,6 +1,6 @@
--- ---
name: 'Run golangci-lint' name: 'Run golangci-lint'
description: 'Run golangci-lint (WIP)' description: 'Official golangci-lint action with line-attached annotations for found issues, caching and parallel execution. Beta version.'
author: 'golangci' author: 'golangci'
inputs: inputs:
version: version:
@@ -19,5 +19,5 @@ runs:
main: 'dist/run/index.js' main: 'dist/run/index.js'
post: 'dist/post_run/index.js' post: 'dist/post_run/index.js'
branding: branding:
icon: 'check-circle' icon: 'shield'
color: 'blue' color: 'yellow'
+1 -1
View File
@@ -27904,7 +27904,7 @@ function buildCacheKeys() {
keys.push(cacheKey); keys.push(cacheKey);
if (yield pathExists(`go.mod`)) { if (yield pathExists(`go.mod`)) {
// Add checksum to key to invalidate a cache when dependencies change. // Add checksum to key to invalidate a cache when dependencies change.
cacheKey += yield checksumFile(`cache-key`, `go.mod`); cacheKey += yield checksumFile(`sha1`, `go.mod`);
} }
else { else {
cacheKey += `nogomod`; cacheKey += `nogomod`;
+1 -1
View File
@@ -27916,7 +27916,7 @@ function buildCacheKeys() {
keys.push(cacheKey); keys.push(cacheKey);
if (yield pathExists(`go.mod`)) { if (yield pathExists(`go.mod`)) {
// Add checksum to key to invalidate a cache when dependencies change. // Add checksum to key to invalidate a cache when dependencies change.
cacheKey += yield checksumFile(`cache-key`, `go.mod`); cacheKey += yield checksumFile(`sha1`, `go.mod`);
} }
else { else {
cacheKey += `nogomod`; cacheKey += `nogomod`;
+3
View File
@@ -0,0 +1,3 @@
module github.com/golangci/golangci-lint-action
go 1.14
+1 -1
View File
@@ -42,7 +42,7 @@ async function buildCacheKeys(): Promise<string[]> {
if (await pathExists(`go.mod`)) { if (await pathExists(`go.mod`)) {
// Add checksum to key to invalidate a cache when dependencies change. // Add checksum to key to invalidate a cache when dependencies change.
cacheKey += await checksumFile(`cache-key`, `go.mod`) cacheKey += await checksumFile(`sha1`, `go.mod`)
} else { } else {
cacheKey += `nogomod` cacheKey += `nogomod`
} }