Skip to content

Commit 7797e69

Browse files
test(ci): improve CI caching; cancel concurrent runs to prioritize latest; add .cursorignore (#89)
test(ci): improve CI caching; cancel concurrent runs to prioritize latest; add `.cursorignore`
1 parent 2ae5712 commit 7797e69

File tree

6 files changed

+149
-102
lines changed

6 files changed

+149
-102
lines changed

.cursorignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# .cursorignore
2+
#
3+
# ## .cursorignore Syntax Exmaple
4+
# It's generally close to .gitignore syntax with. Examples:
5+
# config.json # Specific file
6+
# dist/ # Directory
7+
# *.log # File extension
8+
# **/logs # Nested directories
9+
# !app/ # Exclude from ignore (negate)
10+
#
11+
# -----------------------------------------------------------------
12+
# Files in the .gitignore are ignored by default.
13+
# To intentionally NOT ignore patterns from .gitignore, uncomment the following:
14+
# !.gitignore
15+
16+
# Additional patterns specific to Cursor
17+
.env*
18+
**/credentials/*
19+
**/secrets/*
20+
private/
21+
confidential/
22+
23+
# Large binary files and datasets
24+
*.bin
25+
*.dat
26+
*.db
27+
*.sqlite
28+
*.sqlite3
29+
30+
# Temporary files
31+
*.tmp
32+
*~
33+
34+
# This is git ignored, so it needs to be explicitly negated for your agent to see it.
35+
!out.txt

.github/workflows/golangcli-lint.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/pr-tittle-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
- uses: seferov/pr-lint-action@v1.2.0
1212
with:
1313
# taken from https://gist.github.com/marcojahn/482410b728c31b221b70ea6d2c433f0c
14-
title-regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)'
14+
title-regex: '^(evm|build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.\/]+\))?(!)?: ([\w ])+([\s\S]*)'
1515
# title-regex-flags (Optional)
16-
title-regex-flags: "g"
16+
title-regex-flags: "g"
1717
# error-message (Optional)
18-
error-message: "Please follow conventional commit style: https://www.conventionalcommits.org/en/v1.0.0/"
18+
error-message: "Please follow conventional commit style: https://www.conventionalcommits.org/en/v1.0.0/"

.github/workflows/skip-golangci-lint.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 97 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,132 @@ name: Tests
22

33
on:
44
pull_request:
5-
paths: ["**.go", "go.mod", "go.sum"]
65
push:
7-
branches:
8-
- main
6+
branches: ["main"]
7+
workflow_dispatch:
8+
9+
# Allow concurrent runs on main/release branches but isolates other branches
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
12+
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }}
913

1014
jobs:
1115
unit-tests:
1216
runs-on: ubuntu-latest
1317
steps:
1418
- uses: actions/checkout@v3
1519

20+
- name: "Check for Go-related changes"
21+
id: check_go
22+
uses: dorny/paths-filter@v3
23+
with:
24+
filters: |
25+
check_go:
26+
- "**/*.go"
27+
- "go.mod"
28+
- "go.sum"
29+
- "justfile"
30+
1631
- name: Set up Go
32+
if: steps.check_go.outputs.check_go == 'true'
1733
uses: actions/setup-go@v5
1834
with:
1935
go-version-file: go.mod
36+
# cache: "The action has a built-in functionality for caching and
37+
# restoring go modules and build outputs. It uses [actions/cache@v4]."
38+
# - Handles go module cache (go env GOMODCACHE).
39+
# - Handles go build cache (go env GOCACHE).
2040
cache: true
2141

2242
- name: "Install just"
43+
if: steps.check_go.outputs.check_go == 'true'
2344
# casey/just: https://just.systems/man/en/chapter_6.html
2445
# taiki-e/install-action: https://github.com/taiki-e/install-action
2546
uses: taiki-e/install-action@just
2647

27-
- name: Run all tests.
28-
run: just test
48+
- run: just test
49+
if: steps.check_go.outputs.check_go == 'true'
2950

3051
build:
3152
runs-on: ubuntu-latest
3253
steps:
3354
- uses: actions/checkout@v3
3455

56+
- name: "Check for Go-related changes"
57+
id: check_go
58+
uses: dorny/paths-filter@v3
59+
with:
60+
filters: |
61+
check_go:
62+
- "**/*.go"
63+
- "go.mod"
64+
- "go.sum"
65+
- "justfile"
66+
3567
- name: Set up Go
68+
if: steps.check_go.outputs.check_go == 'true'
3669
uses: actions/setup-go@v5
3770
with:
3871
go-version-file: go.mod
72+
# cache: "The action has a built-in functionality for caching and
73+
# restoring go modules and build outputs. It uses [actions/cache@v4]."
74+
# - Handles go module cache (go env GOMODCACHE).
75+
# - Handles go build cache (go env GOCACHE).
3976
cache: true
4077

41-
- name: Run all tests.
78+
- if: steps.check_go.outputs.check_go == 'true'
4279
run: make build
80+
81+
golangci:
82+
name: lint
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v4
86+
87+
- name: "Check for Go-related changes"
88+
id: check_go
89+
uses: dorny/paths-filter@v3
90+
with:
91+
filters: |
92+
check_go:
93+
- "**/*.go"
94+
- "go.mod"
95+
- "go.sum"
96+
- "justfile"
97+
98+
- uses: actions/setup-go@v5
99+
if: steps.check_go.outputs.check_go == 'true'
100+
with:
101+
go-version-file: go.mod
102+
# cache: "The action has a built-in functionality for caching and
103+
# restoring go modules and build outputs. It uses [actions/cache@v4]."
104+
# - Handles go module cache (go env GOMODCACHE).
105+
# - Handles go build cache (go env GOCACHE).
106+
cache: true # Note that golangci-lint action already caches for us (https://github.com/golangci/golangci-lint-action#performance)
107+
108+
- name: golangci-lint
109+
if: steps.check_go.outputs.check_go == 'true'
110+
uses: golangci/golangci-lint-action@v8
111+
with:
112+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
113+
version: v2.6.1
114+
115+
# Optional: working directory, useful for monorepos
116+
# working-directory: somedir
117+
118+
# Optional: golangci-lint command line arguments.
119+
args: --fix=false
120+
121+
# Optional: show only new issues if it's a pull request. The default
122+
# value is `false`.
123+
# only-new-issues: true
124+
125+
# Optional: if set to true then the all caching functionality will be
126+
# completely disabled. Takes precedence over all other caching options.
127+
skip-cache: false
128+
129+
# Optional: if set to true then the action won't cache or restore ~/go/pkg.
130+
# skip-pkg-cache: true
131+
132+
# Optional: if set to true then the action won't cache or restore ~/.cache/go-build.
133+
# skip-build-cache: true

justfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test *ARGS:
2424
echo "Note that you can pass args to augment the test command."
2525
echo "For example: just test ./feeder/... -run TestFeeder"
2626
echo " becomes -> go test ./feeder/... -run TestFeeder 2>&1 | tee out.txt"
27-
echo -e "\nThis takes a few minutes to run. The '.' getting printed signifies 2 seconds have passed."
27+
echo -e "\nThis takes a ~4 minutes to run. The '.' getting printed signifies 2 seconds have passed."
2828

2929
args="{{ARGS}}"
3030
args="${args:-./...}"
@@ -77,6 +77,18 @@ install:
7777
# Alias for both build and install
7878
build-install: build install
7979

80-
# Runs golang formatter (gofumpt)
80+
# Run golang formatter (gofumpt)
8181
fmt:
8282
gofumpt -w .
83+
84+
# Run `golangci-lint` with docker
85+
lint:
86+
#!/usr/bin/env bash
87+
echo "Running golangci-lint with docker!"
88+
image_version="v2.6.1"
89+
docker run --rm \
90+
-v "$(pwd)":/app \
91+
-v ~/.cache/golangci-lint/$image_version:/root/.cache \
92+
-w /app \
93+
golangci/golangci-lint:$image_version \
94+
golangci-lint run -v --fix 2>&1

0 commit comments

Comments
 (0)