Skip to content

Commit

Permalink
chore: use submodule nph in CI to check lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fryorcraken committed Sep 6, 2024
1 parent 45319f0 commit 59f2e62
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
export MAKEFLAGS="-j1"
export NIMFLAGS="--colors:off -d:chronicles_colors:none"
make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 POSTGRES=$postgres_enabled test testwakunode2
build-docker-image:
Expand All @@ -141,25 +141,31 @@ jobs:
nim_wakunode_image: ${{ needs.build-docker-image.outputs.image }}
test_type: node-optional
debug: waku*

lint:
name: "Lint"
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v3

- name: Get submodules hash
id: submodules
run: |
echo "hash=$(git submodule status | awk '{print $1}' | sort | shasum -a 256 | sed 's/[ -]*//g')" >> $GITHUB_OUTPUT
- name: Cache submodules
uses: actions/cache@v3
with:
fetch-depth: 2 # In PR, has extra merge commit: ^1 = PR, ^2 = base
path: |
vendor/
.git/modules
key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }}

- name: Check nph formatting
# Pin nph to a specific version to avoid sudden style differences.
# Updating nph version should be accompanied with running the new
# version on the fluffy directory.
run: |
VERSION="v0.5.1"
ARCHIVE="nph-linux_x64.tar.gz"
curl -L "https://github.com/arnetheduck/nph/releases/download/${VERSION}/${ARCHIVE}" -o ${ARCHIVE}
tar -xzf ${ARCHIVE}
shopt -s extglob # Enable extended globbing
./nph examples waku tests tools apps *.@(nim|nims|nimble)
NPH=$(make print-nph-path)
"${NPH}" examples waku tests tools apps *.@(nim|nims|nimble)
git diff --exit-code
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ networkmonitor: | build deps librln
############
## Format ##
############
.PHONY: build-nph clean-nph install-nph
.PHONY: build-nph clean-nph install-nph print-nph-path

build-nph:
ifeq ("$(wildcard $(NPH))","")
Expand All @@ -294,6 +294,10 @@ nph/%: build-nph
clean-nph:
rm -f $(NPH)

# To avoid hardcoding nph binary location in several places
print-nph-path:
echo "$(NPH)"

clean: | clean-nph

###################
Expand Down

0 comments on commit 59f2e62

Please sign in to comment.