From 8024fba4aae17bbc9fa87fc140ac18ee14b50bc8 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Mon, 10 Nov 2025 16:06:05 +0100 Subject: [PATCH] Add linter actions --- .../smart-clinic-compile-backend.yml | 23 ++++++++++++++++ .../workflows/smart-clinic-lint-backend.yml | 24 +++++++++++++++++ .gitea/workflows/smart-clinic-lint-docker.yml | 18 +++++++++++++ .../workflows/smart-clinic-lint-frontend.yml | 27 +++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 .gitea/workflows/smart-clinic-compile-backend.yml create mode 100644 .gitea/workflows/smart-clinic-lint-backend.yml create mode 100644 .gitea/workflows/smart-clinic-lint-docker.yml create mode 100644 .gitea/workflows/smart-clinic-lint-frontend.yml diff --git a/.gitea/workflows/smart-clinic-compile-backend.yml b/.gitea/workflows/smart-clinic-compile-backend.yml new file mode 100644 index 0000000..e374f7c --- /dev/null +++ b/.gitea/workflows/smart-clinic-compile-backend.yml @@ -0,0 +1,23 @@ +name: Compile Java Backend +on: + pull_request: + paths: + - SmartClinicManagementSystem/** + push: + paths: + - SmartClinicManagementSystem/** +jobs: + compile-backend: + runs-on: node20 + name: Compile Backend Code + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Compile with Gradle + run: | + cd SmartClinicManagementSystem/app + ../../gradlew clean build \ No newline at end of file diff --git a/.gitea/workflows/smart-clinic-lint-backend.yml b/.gitea/workflows/smart-clinic-lint-backend.yml new file mode 100644 index 0000000..dc0bc04 --- /dev/null +++ b/.gitea/workflows/smart-clinic-lint-backend.yml @@ -0,0 +1,24 @@ +name: Lint Java Backend +on: + pull_request: + paths: + - SmartClinicManagementSystem/** + push: + paths: + - SmartClinicManagementSystem/** +jobs: + lint-java: + runs-on: node20 + name: Checkstyle Java Linting + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Download Checkstyle + run: curl -L -o checkstyle.jar https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.12.1/checkstyle-10.12.1-all.jar + - name: Run Checkstyle + run: | + java -jar checkstyle.jar -c /google_checks.xml app/src/main/java/com/project/back_end || true \ No newline at end of file diff --git a/.gitea/workflows/smart-clinic-lint-docker.yml b/.gitea/workflows/smart-clinic-lint-docker.yml new file mode 100644 index 0000000..76b1505 --- /dev/null +++ b/.gitea/workflows/smart-clinic-lint-docker.yml @@ -0,0 +1,18 @@ +name: Lint Dockerfiles +on: + pull_request: + paths: + - SmartClinicManagementSystem/** + push: + paths: + - SmartClinicManagementSystem/** +jobs: + dockerlint: + runs-on: node20 + name: Lint Dockerfiles + steps: + - uses: actions/checkout@v3 + - name: Run hadolint + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: ./SmartClinicManagementSystem/app/Dockerfile \ No newline at end of file diff --git a/.gitea/workflows/smart-clinic-lint-frontend.yml b/.gitea/workflows/smart-clinic-lint-frontend.yml new file mode 100644 index 0000000..5519b16 --- /dev/null +++ b/.gitea/workflows/smart-clinic-lint-frontend.yml @@ -0,0 +1,27 @@ +name: Lint Frontend +on: + pull_request: + paths: + - SmartClinicManagementSystem/** + push: + paths: + - SmartClinicManagementSystem/** +jobs: + lint-frontend: + runs-on: node20 + name: Lint HTML, CSS, and JS + steps: + - uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + - name: Install linters + run: | + npm install -g htmlhint stylelint eslint + - name: Lint HTML + run: htmlhint SmartClinicManagementSystem/app/src/main/resources/static/assets/pages//*.html || true + - name: Lint CSS + run: stylelint "SmartClinicManagementSystem/app/src/main/resources/static/assets/css//*.css" || true + - name: Lint JS + run: eslint SmartClinicManagementSystem/app/src/main/resources/static/assets/js//*.js || true \ No newline at end of file