diff --git a/.github/workflows/regression_template.yml b/.github/workflows/regression_template.yml new file mode 100644 index 00000000..09bf12ad --- /dev/null +++ b/.github/workflows/regression_template.yml @@ -0,0 +1,137 @@ +# This is a basic workflow that is manually triggered + +name: regression_template + +on: + workflow_call: + inputs: + install_script: + default: './scripts/install.sh' + required: false + type: string + build_script: + default: './scripts/build.sh' + required: false + type: string + test_script: + default: './scripts/test.sh' + required: false + type: string + cmake_path: + default: './test/cmake' + required: false + type: string + deploy_url_affix: + default: '' + required: false + type: string + result_affix: + default: '' + required: false + type: string + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "linux_job" + run_tests: + permissions: + contents: read + issues: read + checks: write + pull-requests: write + + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Check out the repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install softwares + run: ${{ inputs.install_script }} + + - name: Build + run: ${{ inputs.build_script }} + + - name: Test + run: ${{ inputs.test_script }} + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2.11.0 + if: always() + with: + check_name: Test Results ${{ inputs.result_affix }} + files: | + ${{ inputs.cmake_path }}/build/*/*.xml + + - name: Upload Test Results + if: success() || failure() + uses: actions/upload-artifact@v3.1.3 + with: + name: test_reports + path: | + ${{ inputs.cmake_path }}/build/*.txt + ${{ inputs.cmake_path }}/build/*/Testing/**/*.xml + + - name: Configure GitHub Pages + uses: actions/configure-pages@v3.0.6 + + - name: Upload GitHub Pages artifact + uses: actions/upload-pages-artifact@v2.0.0 + with: + path: ${{ inputs.cmake_path }}/coverage_report/default_build_coverage + + - name: Generate Code Coverage Results Summary + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: ${{ inputs.cmake_path }}/coverage_report/default_build_coverage.xml + format: markdown + badge: true + hide_complexity: true + output: file + + - name: Write Code Coverage Summary + run: | + echo "## Coverage Report ${{ inputs.result_affix }}" >> $GITHUB_STEP_SUMMARY + cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY + + - name: Create CheckRun for Code Coverage + if: (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository) + uses: LouisBrunner/checks-action@v1.6.2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: Code Coverage ${{ inputs.result_affix }} + conclusion: ${{ job.status }} + output: | + {"summary":"Coverage Report"} + output_text_description_file: code-coverage-results.md + + - name: Add Code Coverage PR Comment + if: (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository) + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: Code Coverage ${{ inputs.result_affix }} + path: code-coverage-results.md + + deploy_code_coverage: + runs-on: ubuntu-latest + if: github.event_name == 'push' + needs: run_tests + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }}${{ inputs.deploy_url_affix }} + permissions: + pages: write + id-token: write + + steps: + - name: Deploy GitHub Pages site + id: deployment + uses: actions/deploy-pages@v1.2.9 + + - name: Write Code Coverage Report URL + run: | + echo '[Open Coverage Report](${{ steps.deployment.outputs.page_url }}${{ inputs.deploy_url_affix }})' >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml new file mode 100644 index 00000000..3da63221 --- /dev/null +++ b/.github/workflows/regression_test.yml @@ -0,0 +1,29 @@ +name: regression_test + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + workflow_dispatch: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + tx: + uses: ./.github/workflows/regression_template.yml + with: + build_script: ./scripts/build_tx.sh + test_script: ./scripts/test_tx.sh + cmake_path: ./test/tx/cmake + deploy_url_affix: tx/ + result_affix: ThreadX + tx_smp: + uses: ./.github/workflows/regression_template.yml + with: + build_script: ./scripts/build_smp.sh + test_script: ./scripts/test_smp.sh + cmake_path: ./test/smp/cmake + deploy_url_affix: smp/ + result_affix: SMP \ No newline at end of file diff --git a/.pipelines/smp.yml b/.pipelines/smp.yml deleted file mode 100644 index c5a0eb2b..00000000 --- a/.pipelines/smp.yml +++ /dev/null @@ -1,80 +0,0 @@ -trigger: -- master - -pr: - branches: - include: - - master - paths: - include: - - ".pipelines/tx.yml" - - "common_smp/**" - - "samples/**" - - "test/tx/**" - - "utility/**" - - "ports_smp/linux/gnu/**" - - -pool: - vmImage: "ubuntu-22.04" - -steps: - - task: PipAuthenticate@1 - displayName: 'Pip Authenticate' - inputs: - # Provide list of feed names which you want to authenticate. - # Project scoped feeds must include the project name in addition to the feed name. - artifactFeeds: 'X-Ware/X-Ware_PublicPackages' - - - bash: sudo $(Build.SourcesDirectory)/scripts/install.sh - displayName: 'Install softwares' - - - task: Bash@3 - displayName: 'SDL check' - inputs: - filePath: '$(Build.SourcesDirectory)/scripts/sdl_check.sh' - - - task: Bash@3 - displayName: 'Build' - inputs: - filePath: '$(Build.SourcesDirectory)/scripts/build_smp.sh' - - - task: Bash@3 - displayName: 'Test' - inputs: - filePath: '$(Build.SourcesDirectory)/scripts/test_smp.sh' - - - task: PublishTestResults@2 - condition: succeededOrFailed() - displayName: 'PublishTestResults' - inputs: - testResultsFormat: 'cTest' - testResultsFiles: '*/Testing/**/*.xml' - searchFolder: '$(Build.SourcesDirectory)/test/smp/cmake/build' - testRunTitle: 'SMP-Tests' - buildConfiguration: 'Release' - - - task: CopyFiles@2 - condition: succeededOrFailed() - displayName: 'CopyTestReports' - inputs: - SourceFolder: '$(Build.SourcesDirectory)/test/smp/cmake' - Contents: | - build/*.txt - build/*/Testing/**/*.xml - coverage_report/**/* - TargetFolder: '$(build.artifactstagingdirectory)/test_reports_SMP' - - - task: PublishBuildArtifacts@1 - condition: succeededOrFailed() - displayName: 'PublishBuildArtifacts' - inputs: - pathToPublish: $(build.artifactstagingdirectory) - - - task: PublishCodeCoverageResults@1 - condition: succeededOrFailed() - displayName: 'Test SMP (PublishCodeCoverageResults)' - inputs: - codeCoverageTool: 'Cobertura' - summaryFileLocation: '$(Build.SourcesDirectory)/test/smp/cmake/coverage_report/default_build_coverage.xml' - pathToSources: '$(Build.SourcesDirectory)/test/smp/cmake' diff --git a/.pipelines/tx.yml b/.pipelines/tx.yml deleted file mode 100644 index e9084f8b..00000000 --- a/.pipelines/tx.yml +++ /dev/null @@ -1,79 +0,0 @@ -trigger: -- master - -pr: - branches: - include: - - master - paths: - include: - - ".pipelines/tx.yml" - - "common/**" - - "samples/**" - - "test/tx/**" - - "utility/**" - - "ports/linux/gnu/**" - -pool: - vmImage: "ubuntu-22.04" - -steps: - - task: PipAuthenticate@1 - displayName: 'Pip Authenticate' - inputs: - # Provide list of feed names which you want to authenticate. - # Project scoped feeds must include the project name in addition to the feed name. - artifactFeeds: 'X-Ware/X-Ware_PublicPackages' - - - bash: sudo $(Build.SourcesDirectory)/scripts/install.sh - displayName: 'Install softwares' - - - task: Bash@3 - displayName: 'SDL check' - inputs: - filePath: '$(Build.SourcesDirectory)/scripts/sdl_check.sh' - - - task: Bash@3 - displayName: 'Build' - inputs: - filePath: '$(Build.SourcesDirectory)/scripts/build_tx.sh' - - - task: Bash@3 - displayName: 'Test' - inputs: - filePath: '$(Build.SourcesDirectory)/scripts/test_tx.sh' - - - task: PublishTestResults@2 - condition: succeededOrFailed() - displayName: 'PublishTestResults' - inputs: - testResultsFormat: 'cTest' - testResultsFiles: '*/Testing/**/*.xml' - searchFolder: '$(Build.SourcesDirectory)/test/tx/cmake/build' - testRunTitle: 'TX-Tests' - buildConfiguration: 'Release' - - - task: CopyFiles@2 - condition: succeededOrFailed() - displayName: 'CopyTestReports' - inputs: - SourceFolder: '$(Build.SourcesDirectory)/test/tx/cmake' - Contents: | - build/*.txt - build/*/Testing/**/*.xml - coverage_report/**/* - TargetFolder: '$(build.artifactstagingdirectory)/test_reports_TX' - - - task: PublishBuildArtifacts@1 - condition: succeededOrFailed() - displayName: 'PublishBuildArtifacts' - inputs: - pathToPublish: $(build.artifactstagingdirectory) - - - task: PublishCodeCoverageResults@1 - condition: succeededOrFailed() - displayName: 'Test TX (PublishCodeCoverageResults)' - inputs: - codeCoverageTool: 'Cobertura' - summaryFileLocation: '$(Build.SourcesDirectory)/test/tx/cmake/coverage_report/default_build_coverage.xml' - pathToSources: '$(Build.SourcesDirectory)/test/tx/cmake'