From 56ee039e1a9e9ec0660ad4dbff40317c6af1105a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=20G=C3=B3mez?= Date: Tue, 7 Nov 2023 10:20:53 +0100 Subject: [PATCH] ci: add linter --- .github/workflows/ci.yml | 19 +++++++++++++------ Makefile | 16 +++++----------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca7ca075..8dcdf5b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ name: CI -on: [push] +on: + push: + branches: + - main + pull_request: jobs: build: @@ -8,17 +12,20 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - - name: Start all the environment - run: docker-compose up -d + - name: 🐳 Start all the environment + run: make start - - name: Wait for the environment to get up + - name: 🔦 Lint + run: make lint + + - name: 🦭 Wait for the environment to get up run: | while ! make ping-mysql &>/dev/null; do echo "Waiting for database connection..." sleep 2 done - - name: Run the tests + - name: ✅ Run the tests run: make test diff --git a/Makefile b/Makefile index 0f7981e5..959d60c7 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,29 @@ -.PHONY: all all: build -.PHONY: up -up: - @docker-compose up -d +start: + @docker compose up -d -.PHONY: build build: @./gradlew build --warning-mode all -.PHONY: run-tests +lint: + @docker exec codelytv-ddd_example-java ./gradlew spotlessCheck + run-tests: @./gradlew test --warning-mode all -.PHONY: test test: @docker exec codelytv-ddd_example-java ./gradlew test --warning-mode all -.PHONY: run run: @./gradlew :run -.PHONY: ping-mysql ping-mysql: @docker exec codelytv-java_ddd_example-mysql mysqladmin --user=root --password= --host "127.0.0.1" ping --silent # Start the app -.PHONY: start-mooc_backend start-mooc_backend: @./gradlew bootRun --args='mooc_backend server' -.PHONY: start-backoffice_frontend start-backoffice_frontend: @./gradlew bootRun --args='backoffice_frontend server'