-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[QA] adding sonarcloud workflow (fga-eps-mds/2024.2-ARANDU-DOC#23)
- Loading branch information
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Build for Sonar | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
sonarcloud: | ||
name: SonarCloud | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
#2 Setup Java | ||
- name: Set Up Java | ||
uses: actions/[email protected] | ||
with: | ||
distribution: 'oracle' | ||
java-version: '17' | ||
#3 Setup Flutter | ||
- name: Set Up Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '3.24.3' | ||
channel: 'stable' | ||
#4 Install Dependencies | ||
- name: Install Dependencies | ||
run: flutter pub get | ||
#5 Run flutter tests | ||
- name: Run Flutter Tests | ||
run: flutter test --coverage | ||
#6 Run Sonar cloud scan | ||
- name: SonarCloud Scan | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: | | ||
export SONAR_SCANNER_VERSION=6.2.1.4610 | ||
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64 | ||
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip | ||
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ | ||
export PATH=$SONAR_SCANNER_HOME/bin:$PATH | ||
export SONAR_SCANNER_OPTS="-server" | ||
sonar-scanner \ | ||
-Dsonar.organization=fga-eps-mds-1 \ | ||
-Dsonar.projectKey=fga-eps-mds_2024.2-ARANDU-APP\ | ||
-Dsonar.sources=./lib \ | ||
-Dsonar.host.url=https://sonarcloud.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Metrics and Release | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- dev | ||
- master | ||
- main | ||
types: [closed] | ||
|
||
|
||
jobs: | ||
release: | ||
if: github.event.pull_request.merged == true | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Cria arquivo .env | ||
run: | | ||
touch ./scripts/.env | ||
echo TOKEN=${{ secrets.API_TOKEN_GITHUB }} >> ./scripts/.env | ||
echo RELEASE_MAJOR=${{ contains(github.event.pull_request.labels.*.name, 'MAJOR RELEASE') }} >> ./scripts/.env | ||
echo RELEASE_MINOR=${{ contains(github.event.pull_request.labels.*.name, 'MINOR RELEASE') }} >> ./scripts/.env | ||
- name: Gera release e envia métricas para repositório de DOC | ||
run: | | ||
cd scripts && yarn install && node release.js | ||
git config --global user.email "${{secrets.GIT_USER_EMAIL}}" | ||
git config --global user.name "${{secrets.GIT_USER_NAME}}" | ||
git clone --single-branch --branch main "https://x-access-token:${{secrets.API_TOKEN_GITHUB}}@github.com/fga-eps-mds/${{secrets.GIT_DOC_REPO}}" ${{secrets.GIT_DOC_REPO}} | ||
mkdir -p ${{secrets.GIT_DOC_REPO}}/analytics-raw-data | ||
cp -R analytics-raw-data/*.json ${{secrets.GIT_DOC_REPO}}/analytics-raw-data | ||
cd ${{secrets.GIT_DOC_REPO}} | ||
git add . | ||
git commit -m "Adicionando métricas do repositório ${{ github.event.repository.name }} ${{ github.ref_name }}" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
sonar.projectKey=fga-eps-mds_2024.2-ARANDU-APP | ||
sonar.organization=fga-eps-mds-1 | ||
|
||
# This is the name and version displayed in the SonarCloud UI. | ||
#sonar.projectName=2024.2-ARANDU-APP | ||
#sonar.projectVersion=1.0 | ||
|
||
|
||
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. | ||
sonar.sources= ./lib | ||
|
||
# Encoding of the source code. Default is default system encoding | ||
#sonar.sourceEncoding=UTF-8 |