Skip to content

Commit

Permalink
Merge pull request #14 from green-code-initiative/feature-12-sonar-pl…
Browse files Browse the repository at this point in the history
…ugin

Standalone SonarQube plugin
  • Loading branch information
utarwyn authored Jul 18, 2023
2 parents 179df33 + 1e2b4c8 commit 17fc83d
Show file tree
Hide file tree
Showing 77 changed files with 3,119 additions and 2,411 deletions.
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Bug report
about: Report a way in which ecoCode-javascript is not working as intended
title: ''
labels: '💉 bug: unconfirmed'
assignees: ''

---

### Describe the bug

A clear and concise description of what the bug is.

### To Reproduce

Steps to reproduce the behavior:

1. ...
2. ...

### Expected behavior

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

### Versions

> Please ensure you are running up to date software before making a bug report. Deprecated versions will not receive
> support.
- ecoCode-javascript version:
- SonarQube version (if applicable):

### Screenshots

If applicable, add screenshots to help explain your problem.

### 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 ecoCode-javascript
title: ''
labels: '🚀 enhancement'
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.

### Additional context

Add any other context or screenshots about the feature request here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Question
about: You need information about something on the plugin
title: ''
labels: '❔ question'
assignees: ''

---

Ask your question in this textfield. Please be as precise as possible. Duplicate questions will not be answered.
36 changes: 22 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,44 @@ jobs:
strategy:
matrix:
node-version: [ 16.x, 18.x ]
java-version: [ 11 ]

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Use JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java-version }}

- name: Install dependencies
run: yarn install --immutable
- name: Lint
working-directory: eslint-plugin

- name: Lint eslint-plugin
run: yarn lint
- name: Test
working-directory: eslint-plugin

- name: Test eslint-plugin
run: yarn test:cov
working-directory: eslint-plugin

sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
- name: Verify SonarQube plugin
run: mvn -e -B verify
working-directory: sonar-plugin

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: yarn install --immutable
- name: Test
run: yarn test:cov
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && matrix.node-version == '18.x'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
24 changes: 0 additions & 24 deletions .github/workflows/check_version.yml

This file was deleted.

79 changes: 79 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Publish

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

permissions:
packages: write

env:
NODE_VERSION: 18.x

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout tag "${{ github.ref_name }}"
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: yarn install --immutable
working-directory: eslint-plugin

- name: Copy LICENSE
run: cp LICENSE.md eslint-plugin/

- name: Publish package on NPM
run: npm publish --access public
working-directory: eslint-plugin
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-github:
runs-on: ubuntu-latest
steps:
- name: Checkout tag "${{ github.ref_name }}"
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: yarn install --immutable
working-directory: eslint-plugin

- name: Copy LICENSE
run: cp LICENSE.md eslint-plugin/

- name: Add scope to package name
run: npx --yes change-package-name @${{ github.repository_owner }}/ecocode-eslint-plugin
working-directory: eslint-plugin

- name: Configure GitHub Packages registry
uses: bduff9/[email protected]
with:
working-directory: eslint-plugin
dot-npmrc: |
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
@${{ github.repository_owner }}:registry=https://npm.pkg.github.com
always-auth=true
- name: Publish package on GitHub Packages
run: npm publish
working-directory: eslint-plugin
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 17fc83d

Please sign in to comment.