Skip to content

Merge pull request #51 from Universite-Gustave-Eiffel/dev #95

Merge pull request #51 from Universite-Gustave-Eiffel/dev

Merge pull request #51 from Universite-Gustave-Eiffel/dev #95

Workflow file for this run

name: Code review
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
on:
workflow_dispatch:
push:
branches:
- main
- dev
pull_request:
types: [ opened, reopened, labeled, unlabeled, ready_for_review, synchronize ]
branches:
- main
- dev
jobs:
SetUp:
runs-on: ubuntu-latest
steps:
- id: setVariables
name: Set variables
run: |
isFromMain=${{ github.ref == 'refs/heads/main' }}
isManual=${{ github.event_name == 'workflow_dispatch' }}
hasKmpLabel=${{ contains(github.event.pull_request.labels.*.name, 'KMP') }}
shouldRunKmp=false
if $isFromMain || $isManual || $hasKmpLabel ; then
shouldRunKmp=true
fi
echo "shouldRunKmp=$shouldRunKmp" >> "$GITHUB_OUTPUT"
echo "shouldRunAndroid=${{ contains(github.event.pull_request.labels.*.name, 'Android') }}" >> "$GITHUB_OUTPUT"
echo "shouldRunIos=${{ contains(github.event.pull_request.labels.*.name, 'iOS') }}" >> "$GITHUB_OUTPUT"
if [ ${{ github.event_name }} == workflow_dispatch ] || [ ${{ github.event_name }} == push ] || ([ ${{ github.event_name }} == pull_request ] && [ ${{ github.event.pull_request.draft }} == false ]); then
exit 0
else
exit 1
fi
outputs:
shouldRunKmp: ${{ steps.setVariables.outputs.shouldRunKmp }}
shouldRunAndroid: ${{ steps.setVariables.outputs.shouldRunAndroid }}
shouldRunIos: ${{ steps.setVariables.outputs.shouldRunIos }}
UnitTests:
needs: SetUp
uses: ./.github/workflows/test.yml
with:
shouldRunKmp: ${{ needs.SetUp.outputs.shouldRunKmp }}
shouldRunAndroid: ${{ needs.SetUp.outputs.shouldRunAndroid }}
shouldRunIos: ${{ needs.SetUp.outputs.shouldRunIos }}
Detekt:
uses: ./.github/workflows/lint.yml
AllowMerge:
if: always()
runs-on: ubuntu-latest
needs: [ UnitTests, Detekt ]
steps:
- run: |
if [ ${{ github.event_name }} == pull_request ] && [ ${{ join(github.event.pull_request.labels.*.name) == '' }} == true ]; then
exit 1
elif [ ${{ (contains(needs.UnitTests.result, 'failure')) }} == true ]; then
exit 1
elif [ ${{ (contains(needs.Detekt.result, 'failure')) }} == true ]; then
exit 1
else
exit 0
fi