Run Lint #7189
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 120 | |
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 30m --build-tags $BUILD_TAGS | |
cd versiondb | |
golangci-lint run --out-format=github-actions --path-prefix=./versiondb --timeout 30m --build-tags $BUILD_TAGS | |
cd ../memiavl | |
golangci-lint run --out-format=github-actions --path-prefix=./memiavl --timeout 30m --build-tags objstore | |
cd ../store | |
golangci-lint run --out-format=github-actions --path-prefix=./store --timeout 30m --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 nixfmt-rfc-style --run "make lint-nix" | |
if: steps.changed-files.outputs.any_changed == 'true' |