Upgrade to v1.0.15 #8
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: | |
pull_request: | |
push: | |
branches: | |
- main | |
- release/** | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
golangci: | |
name: Run golangci-lint | |
runs-on: ubuntu-latest | |
timeout-minutes: 40 | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '^1.20.0' | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v22 | |
with: | |
# pin to nix-2.13 to workaround compability issue of 2.14, | |
# see: https://github.com/cachix/install-nix-action/issues/161 | |
install_url: https://releases.nixos.org/nix/nix-2.13.3/install | |
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@v34 | |
with: | |
files: | | |
**/*.go | |
*.mod | |
*.sum | |
- name: run golangci-lint | |
run: | | |
nix profile install nixpkgs#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 | |
echo "go build" | |
go build -tags $BUILD_TAGS ./cmd/cronosd | |
echo "golangci-lint ." | |
golangci-lint run --out-format=github-actions --path-prefix=./ --timeout 10m --build-tags $BUILD_TAGS | |
# 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@v34 | |
with: | |
files: | | |
**/poetry.lock | |
**/pyproject.toml | |
**/*.py | |
- uses: cachix/install-nix-action@v22 | |
with: | |
# pin to nix-2.13 to workaround compability issue of 2.14, | |
# see: https://github.com/cachix/install-nix-action/issues/161 | |
install_url: https://releases.nixos.org/nix/nix-2.13.3/install | |
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@v34 | |
with: | |
files: | | |
*.nix | |
**/*.nix | |
- uses: cachix/install-nix-action@v22 | |
with: | |
# pin to nix-2.13 to workaround compability issue of 2.14, | |
# see: https://github.com/cachix/install-nix-action/issues/161 | |
install_url: https://releases.nixos.org/nix/nix-2.13.3/install | |
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' |