Skip to content

Commit

Permalink
first commit to get all sources from 'ecoCode' repository
Browse files Browse the repository at this point in the history
  • Loading branch information
David DE CARVALHO committed Aug 5, 2023
0 parents commit f29704e
Show file tree
Hide file tree
Showing 69 changed files with 3,073 additions and 0 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.
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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@v3
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:
java-version: 11
distribution: 'zulu' # Alternative distribution options are available.
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -e -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=green-code-initiative_ecoCode-python -Dsonar.exclusions=**/*.groovy,**/*.dummy
133 changes: 133 additions & 0 deletions .github/workflows/manual_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Manual Release
on:
workflow_dispatch:
inputs:
confirmeRelease:
description: 'Confirm manual release creation (by typing "true") ? ----- WARNING : check version (in pom.xml files) and release notes (in CHANGELOG.md file) before confirm'
default: 'false'
jobs:
checks:
name: Requirements
if: github.event.inputs.confirmeRelease == 'true'
runs-on: ubuntu-latest
steps:
- name: Check user permissions
uses: 74th/[email protected]
with:
users: dedece35,glalloue,jhertout,jules-delecour-dav,olegoaer,zippy1978
build:
name: Build And Release
needs: checks
runs-on: ubuntu-latest
permissions: write-all
outputs:
last_tag: ${{ steps.export_last_tag.outputs.last_tag }}
upload_url: ${{ steps.export_upload_url.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Change commiter
run: |
git config user.name 'github-actions[bot]'
git config user.email ''
- name: Maven release
run: mvn release:prepare -B -ff -DtagNameFormat=@{project.version}
- name: Maven release clean
run: mvn release:clean
- name: Get last TAG
run: echo "LAST_TAG=$(git tag --sort=-version:refname | head -n 1)" >> $GITHUB_ENV
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Checkout tag "${{ env.LAST_TAG }}"
uses: actions/checkout@v3
with:
ref: ${{ env.LAST_TAG }}
- 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: ${{ env.LAST_TAG }}
release_name: Release ${{ env.LAST_TAG }}
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: lib
- name: Export LAST_TAG
id: export_last_tag
run: echo "last_tag=${{ env.LAST_TAG }}" >> $GITHUB_OUTPUT
- name: Export UPLOAD_URL
id: export_upload_url
run: echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT
upload-java:
name: Upload Java 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: lib
- 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: lib/ecocode-java-plugin-${{ needs.build.outputs.last_tag }}.jar
asset_name: ecocode-java-plugin-${{ needs.build.outputs.last_tag }}.jar
asset_content_type: application/zip
upload-php:
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: lib
- name: Upload Release Asset - PHP 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: lib/ecocode-php-plugin-${{ needs.build.outputs.last_tag }}.jar
asset_name: ecocode-php-plugin-${{ needs.build.outputs.last_tag }}.jar
asset_content_type: application/zip
upload-python:
name: Upload Python 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: lib
- name: Upload Release Asset - Python 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: lib/ecocode-python-plugin-${{ needs.build.outputs.last_tag }}.jar
asset_name: ecocode-python-plugin-${{ needs.build.outputs.last_tag }}.jar
asset_content_type: application/zip
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/[email protected]
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!
71 changes: 71 additions & 0 deletions .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
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/[email protected]
with:
users: dedece35,glalloue,jhertout,jules-delecour-dav,olegoaer,zippy1978
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: lib
- name: Export UPLOAD_URL
id: export_upload_url
run: echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT
upload-python:
name: Upload Python 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: lib
- name: Upload Release Asset - Python 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: lib/ecocode-python-plugin-${{ github.ref_name }}.jar
asset_name: ecocode-python-plugin-${{ github.ref_name }}.jar
asset_content_type: application/zip
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Ignore all files and folders starting with ".", except a few exceptions
.*
!.gitignore
!.gitattributes
!.github/

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

# Ignore IDE files
*.iml
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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

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

### Changed

### Deleted

[unreleased]: https://github.com/green-code-initiative/ecoCode-python/compare/v0.0.1...HEAD
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.0.0-community
COPY --from=builder /usr/src/ecocode/lib/* /opt/sonarqube/extensions/plugins/
Loading

0 comments on commit f29704e

Please sign in to comment.