Skip to content

Commit

Permalink
initialization of Java plugin repository
Browse files Browse the repository at this point in the history
  • Loading branch information
David DE CARVALHO committed Dec 19, 2023
1 parent 9eda0e0 commit df9c52d
Show file tree
Hide file tree
Showing 114 changed files with 7,901 additions and 18 deletions.
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Ensure all SH files are checked out with LF line endings (regardless of the
# OS they were checked out on).
*.sh text eol=lf

# Ensure BAT files will always be checked out with CRLFs (regardless of the
# OS they were checked out on).
*.bat text eol=crlf
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Software Versions**

- SonarQube Version: [e.g. Version 7.8 (build 26217)]
- Plugin Version: [e.g. 1.1.0, or custom build from master at commit 004AD34FAA]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
60 changes: 60 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build and Tests

on:
push:
branches:
- main
paths-ignore:
- '*.md'
- '.github/**/*.yml'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
types: [ opened, synchronize, reopened ]

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Verify
run: mvn -e -B verify

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17

- name: Cache SonarQube packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: SonarQube Scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -e -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=green-code-initiative_ecoCode-java
21 changes: 21 additions & 0 deletions .github/workflows/stale_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Label stale PRs"
on:
schedule:
- cron: "30 1 * * *"
workflow_dispatch:

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: -1 # We don't want to address issues
days-before-pr-stale: 30
days-before-issue-close: -1 # We don't want to close issues in this action
days-before-pr-close: -1 # We don't want to close PR in this action
stale-pr-label: stale
stale-pr-message: |
This PR has been automatically marked as stale because it has no activity for 30 days.
Please add a comment if you want to keep the issue open. Thank you for your contributions!
74 changes: 74 additions & 0 deletions .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Tag Release

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
checks:
name: Requirements
runs-on: ubuntu-latest
steps:
- name: Check user permissions
uses: 74th/workflow-permission-action@1.0.0
with:
users: dedece35,glalloue,jhertout,jules-delecour-dav,olegoaer,zippy1978,utarwyn
build:
name: Build And Release
runs-on: ubuntu-latest
needs: checks
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout tag "${{ github.ref_name }}"
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Build project
run: mvn -e -B clean package -DskipTests
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
body: ${{ steps.extract-release-notes.outputs.release_notes }}
- name: Export plugin Jar files
id: export_jar_files
uses: actions/upload-artifact@v3
with:
name: ecocode-plugins
path: target
- name: Export UPLOAD_URL
id: export_upload_url
run: echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT

upload:
name: Upload PHP Plugin
runs-on: ubuntu-latest
needs: build
steps:
- name: Import plugin JAR files
id: import_jar_files
uses: actions/download-artifact@v3
with:
name: ecocode-plugins
path: target
- name: Upload Release Asset - Java Plugin
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{needs.build.outputs.upload_url}}
asset_path: target/ecocode-java-plugin-${{ github.ref_name }}.jar
asset_name: ecocode-java-plugin-${{ github.ref_name }}.jar
asset_content_type: application/zip
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Ignore all files and folders starting with ".", except a few exceptions
.*
!.gitignore
!.gitattributes
!.github/

# Ignore generated files
target
bin
dependency-reduced-pom.xml

# Ignore IDE files
*.iml
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Java rules moved from `ecoCode` repository to current repository

### Changed

### Deleted

[unreleased]: https://github.com/green-code-initiative/ecoCode-php/compare/v1.5.0...HEAD
[1.4.0]: https://github.com/green-code-initiative/ecoCode-php/compare/v0.0.0...1.5.0
1 change: 1 addition & 0 deletions CODE_STYLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please read common [CODE_STYLE.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CODE_STYLE.md) in `ecoCode-common` repository.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please read common [CONTRIBUTING.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CONTRIBUTING.md) in `ecoCode-common` repository.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM maven:3-openjdk-11-slim AS builder

COPY . /usr/src/ecocode

WORKDIR /usr/src/ecocode
RUN ./tool_build.sh

FROM sonarqube:10.1.0-community
COPY --from=builder /usr/src/ecocode/target/ecocode-java-plugin-*.jar /opt/sonarqube/extensions/plugins/
24 changes: 24 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Common installation notes / requirements
========================================

Please read common [INSTALL.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/INSTALL.md)
in `ecoCode-common` repository. Please follow the specific guides below for additional information on installing the
desired plugins.

Special points for Standard plugins
=================================

Project structure
-----------------

Here is a preview of project tree :

```txt
ecoCode-java # Root directory
|
+--src # source directory
|
\--docker-compose.yml # Docker compose file
```

You will find more information about the plugins’ architecture in their folders
Loading

0 comments on commit df9c52d

Please sign in to comment.