Skip to content

PR #14 [updated, ready_for_review] Nightly cleanup #166

PR #14 [updated, ready_for_review] Nightly cleanup

PR #14 [updated, ready_for_review] Nightly cleanup #166

Workflow file for this run

name: Pull Request
run-name: |
PR #${{ github.event.pull_request.number }} [${{ github.event_name == 'pull_request' && 'updated' || 'reviewed' }}, ${{ github.event_name == 'pull_request' && github.event.action || github.event.review.state }}${{ github.event.pull_request.draft && ', draft' || '' }}] ${{github.event.pull_request.title}}
on:
pull_request:
branches:
- master
paths-ignore:
# No sense in doing these tests for these file
- 'README.md'
- 'docs/**/*'
types:
- opened
- synchronize
- ready_for_review
- converted_to_draft
pull_request_review:
types: [submitted]
concurrency:
group: pr-test-${{ github.ref }}-${{github.event_name}}
cancel-in-progress: true
permissions:
packages: read
contents: read
jobs:
check-trigger:
runs-on: ubuntu-latest
outputs:
VALIDATE_BASIC: ${{ steps.config.outputs.VALIDATE_BASIC }}
VALIDATE_DEB: ${{ steps.config.outputs.VALIDATE_DEB }}
VALIDATE_FULL: ${{ steps.config.outputs.VALIDATE_FULL }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Clone uno
uses: actions/checkout@v4
with:
path: src/uno
submodules: true
- name: "Generate job configuration"
id: config
run: |
case ${{ github.event_name }} in
pull_request_review)
case "${{ github.event.review.state }}" in
approved)
# A new review was submitted, and the review state is "approved":
# perform a full validation (ci build on more platforms + deb validation)
full=y
# If the PR is still in draft: perform also a basic validation
if [ "${{ github.event.pull_request.draft }}" = true ]; then
basic=y
fi
;;
*)
# A new review was submitted, but the state is not "approved": nothing to do yet
;;
esac
;;
pull_request)
case "${{ github.event.pull_request.draft }}" in
true)
# The PR was updated but it is still in draft: nothing to do
;;
false)
# The PR was updated, and it is not a draft: perform a basic validation if:
# - PR.state == 'opened':
# -> PR opened as non-draft, perform an initial check
# - PR.state == 'synchronized':
# -> PR updated by new commits.
# TODO(asorbini) assert(${{ github.event.action }} != 'approved')
# (assumption is that any commit will invalidate a previous 'approved')
# - PR.state == 'ready_for_review':
# -> PR moved out of draft, run basic validation only if not already 'approved'.
# (assumption: a basic validation was already performed on the `pull_request_review`
# event for the approval.)
case "${{ github.event.action }}" in
opened|synchronize)
basic=y
;;
ready_for_review)
# (assumption: if the PR is not "mergeable" it must have not been approved.
# Ideally: we would just query the review state, but that doesn't seem to
# be available on the pull_request object, see:
# https://docs.github.com/en/webhooks/webhook-events-and-payloads#pull_request)
# So we use the GitHub API to query the state,
# see: https://stackoverflow.com/a/77647838
(cd src/uno; gh repo set-default ${{ github.repository }})
review_state=$(cd src/uno; gh pr view 11 --json reviewDecision --jq '.reviewDecision')
case "${review_state}" in
APPROVED)
test_not_needed=y
;;
*)
basic=y
;;
esac
;;
*)
;;
esac
;;
esac
;;
esac
(
# echo CHECK_FAILED=${check_failed}
echo VALIDATE_BASIC=${basic}
echo VALIDATE_FULL=${full}
echo VALIDATE_DEB=${full}
) >> ${GITHUB_OUTPUT}
basic-validation:
needs: check-trigger
if: ${{ needs.check-trigger.outputs.VALIDATE_BASIC }}
strategy:
matrix:
build-platform: [amd64]
base-image: ["ubuntu:22.04"]
uno-middleware: ['']
test-without-license: [false]
uses: ./.github/workflows/ci.yml
secrets: inherit
with:
build-platform: ${{matrix.build-platform}}
base-image: ${{matrix.base-image}}
uno-middleware: ${{matrix.uno-middleware}}
test-without-license: ${{matrix.test-without-license}}
full-validation:
needs: check-trigger
if: ${{ needs.check-trigger.outputs.VALIDATE_FULL }}
strategy:
matrix:
build-platform: [amd64, arm64]
base-image: ["ubuntu:22.04"]
uno-middleware: ['']
test-without-license: [false, true]
exclude:
- build-platform: amd64
base-image: "ubuntu:22.04"
uno-middleware: ''
test-without-license: false
- build-platform: arm64
base-image: "ubuntu:22.04"
uno-middleware: ''
test-without-license: true
uses: ./.github/workflows/ci.yml
secrets: inherit
with:
build-platform: ${{matrix.build-platform}}
base-image: ${{matrix.base-image}}
uno-middleware: ${{matrix.uno-middleware}}
test-without-license: ${{matrix.test-without-license}}
deb-validation:
needs: check-trigger
if: ${{ needs.check-trigger.outputs.VALIDATE_DEB }}
strategy:
matrix:
base-tag: ["ubuntu:22.04"]
platform: [amd64]
uses: ./.github/workflows/_deb_build.yml
secrets: inherit
with:
base-tag: ${{ matrix.base-tag }}
platform: ${{ matrix.platform }}
pull-request: true