Skip to content

Commit

Permalink
CI administration (#12)
Browse files Browse the repository at this point in the history
* Simplify pull_request workflow a bit and rely on checks

* ci-admin script

* No need for extra script for pyinstaller; reorganize scripts
  • Loading branch information
asorbini authored Apr 18, 2024
1 parent 3c66d33 commit 52d08ba
Show file tree
Hide file tree
Showing 14 changed files with 925 additions and 596 deletions.
36 changes: 2 additions & 34 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Pull Request
run-name: |
PR #${{ github.event.pull_request.number }} [${{ github.event_name == 'pull_request' && 'updated' || 'reviewed' }}, ${{ github.event.action }}${{ github.event.pull_request.draft && ', draft' || '' }}] ${{github.event.pull_request.title}}
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:
Expand Down Expand Up @@ -110,27 +110,13 @@ jobs:
;;
esac
# Fail if no test is enabled, to report a failed check and block the PR from automerging.
# It is ok to generate failed run, since they will be cleaned up once the PR is closed.
if [ -z "${basic}${full}${test_not_needed}" ]; then
printf -- "ERROR: PR #${{ github.event.pull_request.number }} is not ready for testing yet.\n" >&2
check_failed=y
elif [ -n "${test_not_needed}" ]; then
printf -- "PR #${{ github.event.pull_request.number }} doesn't need further testing.\n" >&2
fi
(
echo CHECK_FAILED=${check_failed}
# echo CHECK_FAILED=${check_failed}
echo VALIDATE_BASIC=${basic}
echo VALIDATE_FULL=${full}
echo VALIDATE_DEB=${full}
) >> ${GITHUB_OUTPUT}
- name: "Fail job if check failed"
run: |
exit 1
if: steps.config.outputs.CHECK_FAILED

basic-validation:
needs: check-trigger
if: ${{ needs.check-trigger.outputs.VALIDATE_BASIC }}
Expand Down Expand Up @@ -187,21 +173,3 @@ jobs:
base-tag: ${{ matrix.base-tag }}
platform: ${{ matrix.platform }}
pull-request: true

enable-merge:
needs:
- check-trigger
- full-validation
- deb-validation
uses: ./.github/workflows/pull_request_check_approval.yml
if: ${{ needs.check-trigger.outputs.VALIDATE_FULL && !needs.check-trigger.outputs.VALIDATE_BASIC }}

enable-merge-at-once:
needs:
- check-trigger
- full-validation
- deb-validation
- basic-validation
uses: ./.github/workflows/pull_request_check_approval.yml
if: ${{ needs.check-trigger.outputs.VALIDATE_FULL && needs.check-trigger.outputs.VALIDATE_BASIC }}

99 changes: 0 additions & 99 deletions .github/workflows/pull_request_check_approval.yml

This file was deleted.

13 changes: 9 additions & 4 deletions .github/workflows/pull_request_closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,15 @@ jobs:

- name: "Clean up workflow runs"
run: |
src/uno/scripts/cleanup_closed_pull_request.sh \
${{ github.repository }} \
${{ github.event_name == 'pull_request' && github.event.pull_request.number || inputs.pr-number }} \
${{ github.event_name == 'pull_request' && github.event.pull_request.merged || inputs.pr-merged }}
docker run --rm \
-v $(pwd):/workspace \
-e GH_TOKEN=${GH_TOKEN} \
-w /workspace \
${ADMIN_IMAGE} \
src/uno/scripts/ci-admin pr-closed \
-r ${{ github.repository }} \
-N ${{ github.event_name == 'pull_request' && github.event.pull_request.number || inputs.pr-number }} \
${{ (github.event_name == 'pull_request' && github.event.pull_request.merged || inputs.pr-merged) && '-m' || '' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ADMIN_IMAGE: ghcr.io/mentalsmash/uno-ci-admin:latest
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ changelog:
-v $(UNO_DIR)/:/uno \
-w /uno \
$(DEB_BUILDER) \
/uno/scripts/bundle/update_changelog.sh
/uno/scripts/debian/update_changelog.sh

# Build uno's debian packages.
# Requires the Debian Builder image.
Expand All @@ -172,7 +172,7 @@ debuild:
-v $(UNO_DIR)/:/uno \
-w /uno \
$(DEB_BUILDER) \
/uno/scripts/debian_build.sh
/uno/scripts/debian/build.sh

# Run integration tests using the debian package.
# Requires the Debian Tester image
Expand Down
13 changes: 7 additions & 6 deletions scripts/bundle/pyinstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@ FLAVOR=${1:-default}
: "${DIST_DIR:=$(pwd)/dist/bundle/${FLAVOR}}"
[ -n "${DIST_DIR}" ]

: "${BUILD_DIR:=$(pwd)/build/pyinstaller}"
: "${BUILD_DIR:=$(pwd)/build/bundle}"
[ -n "${BUILD_DIR}" ]

(
set -x
rm -rf ${BUILD_DIR}
)

: "${SCRIPTS:=\
./scripts/bundle/uno
./uno/test/integration/runner.py}"
[ -n "${SCRIPTS}" ]

: "${VENV_PYINST:=${BUILD_DIR}/venv-pyinst}"
[ -n "${VENV_PYINST}" ]

: "${VENV_UNO:=${BUILD_DIR}/venv-uno}"
[ -n "${VENV_UNO}" ]


: "${SCRIPTS:=\
${VENV_UNO}/bin/uno
./uno/test/integration/runner.py}"
[ -n "${SCRIPTS}" ]

if [ ! -d "${VENV_PYINST}" ]; then
(
set -x
Expand Down
3 changes: 0 additions & 3 deletions scripts/bundle/uno

This file was deleted.

Loading

0 comments on commit 52d08ba

Please sign in to comment.