Skip to content

Commit

Permalink
ci: setup matrix (#618)
Browse files Browse the repository at this point in the history
* ci: setup matrix

* ci: add names and comments

* ci: clarify namings

* ci: fix workflow using strategy matrix

* fix(sonar): use diamond operator

* fix(sonar): use diamond operator

* ci: disable fail-fast in job strategy

* fix(sonar): use diamond operator

* fix(sonar): make use of diamond operator

* fix(sonar): make use of diamond operator

* ci: get head commit for PR

* fix(sonar): use diamond operator

* ci: get diff for push events

* ci: remove .github directory from analysis

* docs: add badges

Co-authored-by: Mohammad Abudayyeh <47318409+moabu@users.noreply.github.com>
  • Loading branch information
ossdhaval and moabu authored Jan 20, 2022
1 parent 878bd69 commit b35d5e6
Show file tree
Hide file tree
Showing 29 changed files with 334 additions and 69 deletions.
8 changes: 0 additions & 8 deletions .github/JANNSEN_CODEOWNERS/docs_CODEOWNERS

This file was deleted.

8 changes: 0 additions & 8 deletions .github/JANNSEN_CODEOWNERS/home_CODEOWNERS

This file was deleted.

72 changes: 55 additions & 17 deletions .github/workflows/central_code_quality_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,64 @@ on:
- 'jans-pycloudlib/jans/pycloudlib/version.py'
- '**.md'
workflow_dispatch:

jobs:
build:
sonar-scan:
name: sonar scan
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: [jans-auth-server, jans-config-api, jans-core, jans-setup, jans-cli, jans-client-api, jans-fido2, jans-notify, jans-orm, jans-scim, jans-eleven]
env:
JVM_PROJECTS: |
JanssenProject/jans-auth-server
JanssenProject/jans-config-api
JanssenProject/jans-core
jans-auth-server
jans-orm
jans-config-api
jans-client-api
jans-scim
jans-core
jans-notify
jans-fido2
jans-eleven
NON_JVM_PROJECTS: |
JanssenProject/jans-setup
JanssenProject/jans-cli
JanssenProject/jans-cloud-native
jans-setup
jans-cli
steps:
- uses: actions/checkout@v2
- name: check out code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of sonarqube analysis

- name: find changed directories
run: |
if [ $GITHUB_BASE_REF ]; then
# Pull Request
git fetch origin $GITHUB_BASE_REF --depth=1
echo "CHANGED_DIR=$( git diff --name-only ${{ github.event.before }} ${{ github.event.pull_request.head.sha }} | cut -d/ -f1 | sort -u | sed -z 's/\n/,/g;s/^/[/;s/,$/]/;s/$/\n/')" >> ${GITHUB_ENV}
else
# Push
git fetch origin ${{ github.event.before }} --depth=1
echo "CHANGED_DIR=$( git diff --name-only ${{ github.event.before }} $GITHUB_SHA | cut -d/ -f1 | sort -u | sed -z 's/\n/,/g;s/^/[/;s/,$/]/;s/$/\n/')" >> ${GITHUB_ENV}
fi
- name: check env
run: |
echo ${{ env.CHANGED_DIR }}
echo ${{ matrix.module }}
- name: Set up JDK 11
# JanssenProject/jans-cli is too similar to JanssenProject/jans-client-api as the contains function is returning it belonging to the JVM_PROJECT
if: contains(env.JVM_PROJECTS, github.repository) && github.repository != 'JanssenProject/jans-cli'
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.JVM_PROJECTS, matrix.module) && matrix.module != 'jans-cli'
uses: actions/setup-java@v2.5.0
with:
java-version: '11'
distribution: 'adopt'

- name: Cache SonarCloud packages for JVM based project
# JanssenProject/jans-cli is too similar to JanssenProject/jans-client-api as the contains function is returning it belonging to the JVM_PROJECT
if: contains(env.JVM_PROJECTS, github.repository) && github.repository != 'JanssenProject/jans-cli'
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.JVM_PROJECTS, matrix.module) && matrix.module != 'jans-cli'
uses: actions/cache@v2.1.7
with:
path: ~/.sonar/cache
Expand All @@ -64,15 +94,22 @@ jobs:

- name: Build and analyze JVM based project
# JanssenProject/jans-cli is too similar to JanssenProject/jans-client-api as the contains function is returning it belonging to the JVM_PROJECT
if: contains(env.JVM_PROJECTS, github.repository) && github.repository != 'JanssenProject/jans-cli'
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.JVM_PROJECTS, matrix.module) && matrix.module != 'jans-cli'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
case "$GITHUB_REPOSITORY" in
"JanssenProject/jans-auth-server")
cd ${{ matrix.module }}
case ${{ matrix.module }} in
"jans-auth-server")
;&
"jans-client-api")
;&
"jans-scim")
;&
"jans-eleven")
;&
"JanssenProject/jans-config-api")
"jans-config-api")
echo "Run Sonar analysis without test execution"
mvn -B -DskipTests=true install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
;;
Expand All @@ -84,19 +121,20 @@ jobs:
- name: Convert repo org name to lowercase for non JVM projects
if: contains(env.NON_JVM_PROJECTS, github.repository)
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.NON_JVM_PROJECTS, matrix.module)
env:
REPO_OWNER: ${{ github.repository_owner }}
run: |
echo "REPO_ORG=${REPO_OWNER,,}" >>${GITHUB_ENV}
- name: SonarCloud Scan for non-JVM project
if: contains(env.NON_JVM_PROJECTS, github.repository)
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.NON_JVM_PROJECTS, matrix.module)
uses: SonarSource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=${{ env.REPO_ORG }}
-Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }}
-Dsonar.projectKey=${{ github.repository_owner }}_${{ matrix.module }}
projectBaseDir: ${{ matrix.module }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
55 changes: 50 additions & 5 deletions README.md

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion docker-jans-auth-server/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/0bcee00d656b4533ab1e32c36e32a17d)](https://www.codacy.com/gh/JanssenProject/docker-jans-auth-server/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=JanssenProject/docker-jans-auth-server&amp;utm_campaign=Badge_Grade)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=bugs)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=code_smells)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=code_smells)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=ncloc)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=alert_status)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=security_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=sqale_index)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-auth-server&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-auth-server)

## Overview

Expand Down
12 changes: 11 additions & 1 deletion docker-jans-certmanager/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/b6e9b72a8c484d13a22b315de52a68c5)](https://www.codacy.com/gh/JanssenProject/docker-jans-certmanager/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=JanssenProject/docker-jans-certmanager&amp;utm_campaign=Badge_Grade)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=bugs)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=code_smells)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=coverage)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=ncloc)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=alert_status)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=security_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=sqale_index)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-certmanager&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-certmanager)

## Overview

Expand Down
12 changes: 11 additions & 1 deletion docker-jans-client-api/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/fd081124d7f548bbbccc2610fee8e636)](https://www.codacy.com/gh/JanssenProject/docker-jans-client-api/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=JanssenProject/docker-jans-client-api&amp;utm_campaign=Badge_Grade)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=bugs)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=code_smells)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=coverage)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=ncloc)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=alert_status)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=security_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=sqale_index)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-client-api&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-client-api)

# Overview

Expand Down
12 changes: 11 additions & 1 deletion docker-jans-config-api/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/1694ddea481146ab979fcfb66b9e8522)](https://www.codacy.com/gh/JanssenProject/docker-jans-config-api/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=JanssenProject/docker-jans-config-api&amp;utm_campaign=Badge_Grade)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=bugs)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=code_smells)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=coverage)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=ncloc)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=alert_status)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=security_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=sqale_index)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-config-api&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-config-api)

# Overview

Expand Down
12 changes: 11 additions & 1 deletion docker-jans-configurator/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/482d45faeed647d4a2a9a48adb400441)](https://www.codacy.com/gh/JanssenProject/docker-jans-configurator/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=JanssenProject/docker-jans-configurator&amp;utm_campaign=Badge_Grade)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=bugs)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=code_smells)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=coverage)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=ncloc)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=alert_status)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=security_rating)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=sqale_index)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=JanssenProject_docker-jans-configurator&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=JanssenProject_docker-jans-configurator)

## Overview

Expand Down
Loading

0 comments on commit b35d5e6

Please sign in to comment.