-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from rtdip/develop
v0.2.2
- Loading branch information
Showing
62 changed files
with
1,081 additions
and
253 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
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
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
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
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
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,78 @@ | ||
# Copyright 2022 RTDIP | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: 'Sonarcloud Scan' | ||
|
||
run-name: ${{ github.event.workflow_run.display_title }} | ||
|
||
on: | ||
workflow_run: | ||
workflows: [PR] | ||
types: [requested] | ||
branches-ignore: | ||
- "develop" | ||
- "main" | ||
- "release/**" | ||
|
||
jobs: | ||
job_download_pr_artifact: | ||
outputs: | ||
pr_info: ${{ steps.pr.outputs.result }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Download Artifact' | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.payload.workflow_run.id, | ||
}); | ||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "pr_number" | ||
})[0]; | ||
let download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
let fs = require('fs'); | ||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data)); | ||
- name: 'Unzip Artifact' | ||
run: unzip pr_number.zip | ||
|
||
- name: 'Read Artifact' | ||
id: pr | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
let fs = require('fs'); | ||
return fs.readFileSync('./pr_number'); | ||
result-encoding: string | ||
|
||
job_run_unit_tests_and_sonarqube: | ||
needs: job_download_pr_artifact | ||
uses: rtdip/core/.github/workflows/sonarcloud_reusable.yml@develop | ||
with: | ||
REPO_NAME: ${{ github.event.workflow_run.head_repository.full_name }} | ||
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} | ||
HEAD_SHA: ${{ github.event.workflow_run.head_sha }} | ||
PR_NUMBER: ${{ fromJSON(needs.job_download_pr_artifact.outputs.pr_info).pr_number }} | ||
PR_HEAD_REF: ${{ fromJSON(needs.job_download_pr_artifact.outputs.pr_info).pr_head_ref }} | ||
PR_BASE_REF: ${{ fromJSON(needs.job_download_pr_artifact.outputs.pr_info).pr_base_ref }} | ||
secrets: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
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,108 @@ | ||
# Copyright 2022 RTDIP | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: 'Reusable Sonarcloud Scan' | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
REPO_NAME: | ||
required: true | ||
type: string | ||
HEAD_BRANCH: | ||
required: true | ||
type: string | ||
HEAD_SHA: | ||
required: true | ||
type: string | ||
PR_NUMBER: | ||
required: true | ||
type: string | ||
PR_HEAD_REF: | ||
required: true | ||
type: string | ||
PR_BASE_REF: | ||
required: true | ||
type: string | ||
secrets: | ||
SONAR_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
job_test_python_latest_version: | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ inputs.REPO_NAME }} | ||
ref: ${{ inputs.HEAD_BRANCH }} | ||
fetch-depth: 0 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install Boost | ||
run: | | ||
sudo apt update | ||
sudo apt install -y libboost-all-dev | ||
- name: Add conda to system path | ||
run: | | ||
# $CONDA is an environment variable pointing to the root of the miniconda directory | ||
echo $CONDA/bin >> $GITHUB_PATH | ||
- name: Install Conda environment with Micromamba | ||
uses: mamba-org/provision-with-micromamba@main | ||
with: | ||
environment-file: environment.yml | ||
cache-env: true | ||
|
||
- name: Test | ||
run: | | ||
mkdir -p coverage-reports | ||
coverage run -m pytest --junitxml=xunit-reports/xunit-result-unitttests.xml tests && tests_ok=true | ||
coverage xml --omit "venv/**,maintenance/**,xunit-reports/**" -i -o coverage-reports/coverage-unittests.xml | ||
echo Coverage `coverage report --omit "venv/**" | grep TOTAL | tr -s ' ' | cut -d" " -f4` | ||
- name: Mkdocs Test | ||
run: | | ||
mkdocs build --strict | ||
- name: Override Coverage Source Path for Sonar | ||
run: | | ||
sed -i "s/<source>\/home\/runner\/work\/core\/core<\/source>/<source>\/github\/workspace<\/source>/g" /home/runner/work/core/core/coverage-reports/coverage-unittests.xml | ||
- name: SonarCloud Scan | ||
uses: SonarSource/sonarcloud-github-action@master | ||
with: | ||
args: > | ||
-Dsonar.organization=rtdip | ||
-Dsonar.projectKey=rtdip_core | ||
-Dsonar.python.coverage.reportPaths=coverage-reports/coverage-unittests.xml | ||
-Dsoner.python.version=3.11 | ||
-Dsonar.scm.revision=${{ inputs.HEAD_SHA }} | ||
-Dsonar.pullrequest.key=${{ inputs.PR_NUMBER }} | ||
-Dsonar.pullrequest.branch=${{ inputs.PR_HEAD_REF }} | ||
-Dsonar.pullrequest.base=${{ inputs.PR_BASE_REF }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
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
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
Oops, something went wrong.