-
Notifications
You must be signed in to change notification settings - Fork 240
106 lines (101 loc) · 3.58 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Run Lint
# Lint runs golangci-lint over the entire cronos repository This workflow is
# run on every pull request and push to main The `golangci` will pass without
# running if no *.{go, mod, sum} files have been changed.
on:
merge_group:
pull_request:
push:
branches:
- main
- release/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
golangci:
name: Run golangci-lint
runs-on: macos-latest
timeout-minutes: 60
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.22.7'
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
**/*.go
*.mod
*.sum
- name: run golangci-lint
run: |
nix profile install -f ./nix golangci-lint
nix profile install -f ./nix rocksdb
export PKG_CONFIG_PATH=$HOME/.nix-profile/lib/pkgconfig
export CGO_CFLAGS="$(pkg-config --cflags rocksdb)" CGO_LDFLAGS="$(pkg-config --libs rocksdb)"
golangci-lint version
BUILD_TAGS=rocksdb,grocksdb_clean_link,objstore
go build -tags $BUILD_TAGS ./cmd/cronosd
golangci-lint run --out-format=github-actions --path-prefix=./ --timeout 10m --build-tags $BUILD_TAGS
cd versiondb
golangci-lint run --out-format=github-actions --path-prefix=./versiondb --timeout 10m --build-tags $BUILD_TAGS
cd ../memiavl
golangci-lint run --out-format=github-actions --path-prefix=./memiavl --timeout 10m --build-tags objstore
cd ../store
golangci-lint run --out-format=github-actions --path-prefix=./store --timeout 10m --build-tags objstore
# Check only if there are differences in the source code
if: steps.changed-files.outputs.any_changed == 'true'
lint-python:
name: Lint python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
**/poetry.lock
**/pyproject.toml
**/*.py
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
if: steps.changed-files.outputs.any_changed == 'true'
- uses: cachix/cachix-action@v12
if: steps.changed-files.outputs.any_changed == 'true'
with:
name: cronos
- run: nix-shell -I nixpkgs=./nix -p test-env --run "make lint-py"
if: steps.changed-files.outputs.any_changed == 'true'
lint-nix:
name: Lint nix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
*.nix
**/*.nix
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
if: steps.changed-files.outputs.any_changed == 'true'
- run: nix-shell -I nixpkgs=./nix -p nixpkgs-fmt --run "make lint-nix"
if: steps.changed-files.outputs.any_changed == 'true'