Skip to content

Commit

Permalink
Интеграция с SonarCloud
Browse files Browse the repository at this point in the history
  • Loading branch information
marmyshev committed Dec 30, 2020
1 parent 5538a5e commit 82a554e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on: [push, pull_request]

jobs:
build:

name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up JDK 11
uses: actions/setup-java@v1
Expand All @@ -19,6 +21,13 @@ jobs:
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN

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

- name: Cache maven repo
uses: actions/cache@v1
if: github.event_name == 'push' || github.event_name == 'pull_request'
Expand All @@ -32,11 +41,13 @@ jobs:
env:
MAVEN_USERNAME: ${{ secrets.P2_USER }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.P2_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
working-directory: ./
run: |
Xvfb :5 -screen 0 1280x1024x8 -fbdir /tmp &
export DISPLAY=:5
mvn clean verify -PSDK,find-bugs -Dtycho.localArtifacts=ignore -B -V
mvn clean verify -PSDK,find-bugs -Dtycho.localArtifacts=ignore -B -V org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
- name: Publish Test Report
uses: scacap/action-surefire-report@v1
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
![Build](https://github.com/1C-Company/dt-example-plugins/workflows/CI/badge.svg)
![Build](https://github.com/1C-Company/dt-example-plugins/workflows/CI/badge.svg) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=1c-company_dt-example-plugins&metric=alert_status)](https://sonarcloud.io/dashboard?id=1c-company_dt-example-plugins) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=1c-company_dt-example-plugins&metric=coverage)](https://sonarcloud.io/dashboard?id=1c-company_dt-example-plugins) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=1c-company_dt-example-plugins&metric=ncloc)](https://sonarcloud.io/dashboard?id=1c-company_dt-example-plugins)

Пример реализации плагина для "1C: Enterprise Development Tools".

Данный плагин представляет собой плагин, который добавляет в 1C:EDT команду для создания обработчика проведения документа через специальный диалог, а также пример расширения проверок модуля. В плагине продемонстрированы следующие приемы:

* расширение контекстного меню редактора встроенного языка,
* генерация кода модуля,
* работа с объектами конфигурации,
* расширение проверки модуля.
* Сборка проекта в CI:
* Сборка и тестирование с использованием Maven на GitHub Actions
* Интеграция стат-анализа SonarQube/Cloud
* Снятие покрытия кода тестами
* Публикация P2-репозитория

Для изучения и запуска демонстрационного плагина выполните следующие шаги:
* [Настройте](https://edt.1c.ru/dev/ru/docs/plugins/project/env-setup/) необходимое программное обеспечение,
Expand Down
7 changes: 7 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@

<p2repo.archive.skip>false</p2repo.archive.skip>
<org.jacoco.version>0.8.6</org.jacoco.version>
<!-- SonarQube Settings -->
<sonar.projectKey>1c-company_dt-example-plugins</sonar.projectKey>
<sonar.organization>1c-company</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.moduleKey>${project.groupId}:${project.artifactId}</sonar.moduleKey>
<!-- JaCoCo code coverage, pass to SonarQube -->
<sonar.coverage.jacoco.xmlReportPaths>../../**/target/site/jacoco*/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</properties>

<build>
Expand Down

0 comments on commit 82a554e

Please sign in to comment.