Files
fheroes2/.github/workflows/pull_request.yml
T

106 lines
2.7 KiB
YAML

name: Pull Request
on:
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
dispatcher:
name: Job dispatcher
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
outputs:
runCxxAnalyzers: ${{ steps.dispatch.outputs.runCxxAnalyzers }}
runSonarAnalyzer: ${{ steps.dispatch.outputs.runSonarAnalyzer }}
steps:
- uses: actions/github-script@v8
id: dispatch
with:
script: |
for await (const modifiedFiles of github.paginate.iterator(
github.rest.pulls.listFiles, {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.number }},
}
)) {
if (modifiedFiles.data.some((fileMetadata) =>
[/\.c$/, /\.cpp$/, /\.h$/, /CMakeLists\.txt$/].some((pattern) => pattern.test(fileMetadata.filename))
)) {
core.setOutput("runCxxAnalyzers", "YES");
core.setOutput("runSonarAnalyzer", "YES");
break;
}
if (!modifiedFiles.data.every((fileMetadata) =>
[/files\/lang\/[^/]*\.po$/, /docs\/json\/[^/]*\.json$/].some((pattern) => pattern.test(fileMetadata.filename))
)) {
core.setOutput("runSonarAnalyzer", "YES");
}
}
style:
name: Code style check
needs:
- dispatcher
uses: ./.github/workflows/code_style_check.yml
codechecker:
name: CodeChecker
needs:
- dispatcher
- style
uses: ./.github/workflows/codechecker.yml
with:
run: ${{ needs.dispatcher.outputs.runCxxAnalyzers == 'YES' }}
iwyu:
name: IWYU
needs:
- dispatcher
- style
uses: ./.github/workflows/iwyu.yml
with:
run: ${{ needs.dispatcher.outputs.runCxxAnalyzers == 'YES' }}
msvc:
name: MSVC
needs:
- style
uses: ./.github/workflows/msvc.yml
sonarcloud:
name: SonarCloud Analyzer
needs:
- dispatcher
- style
uses: ./.github/workflows/sonarcloud.yml
with:
run: ${{ needs.dispatcher.outputs.runSonarAnalyzer == 'YES' }}
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
android:
name: Android
needs:
- msvc
uses: ./.github/workflows/android.yml
cmake:
name: CMake
needs:
- msvc
uses: ./.github/workflows/cmake.yml
make:
name: Make
needs:
- msvc
uses: ./.github/workflows/make.yml
ios:
name: iOS
needs:
- msvc
uses: ./.github/workflows/ios.yml