1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #20063 from RIOT-OS/merge_groups_migration

ci: migrate to github merge queues
This commit is contained in:
Kaspar Schleiser 2023-11-09 13:07:08 +00:00 committed by GitHub
commit 7c57db8b6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 29 deletions

View File

@ -2,6 +2,8 @@ name: check-commits
on:
pull_request:
types: [opened, reopened, synchronize]
merge_group:
jobs:
check-commits:
runs-on: ubuntu-latest
@ -24,3 +26,10 @@ jobs:
- name: Run checks
run: |
./dist/tools/${{ matrix.check }}/check.sh "${{ github.base_ref }}"
check-commits-success:
needs: check-commits
if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
steps:
- name: check-commits succeeded
run: exit 0

View File

@ -4,8 +4,11 @@ on:
types: [opened, reopened, labeled, unlabeled, synchronize]
pull_request_review:
types: [submitted, dismissed]
merge_group:
jobs:
check-labels:
if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
steps:
- uses: RIOT-OS/check-labels-action@v1.1.1

View File

@ -3,10 +3,12 @@ name: pr-labeler
on:
pull_request_target:
types: [opened, synchronize, reopened]
merge_group:
jobs:
triage:
runs-on: ubuntu-latest
if: github.event_name != 'merge_group'
steps:
- uses: actions/labeler@main
with:

View File

@ -13,6 +13,7 @@ on:
pull_request:
branches:
- '*'
merge_group:
jobs:
static-tests:
@ -21,11 +22,18 @@ jobs:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: set CI_BASE_BRANCH
run: |
if [ -n "${{ github.base_ref }}" ]; then
echo "CI_BASE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
elif [ -n "${{ github.event.merge_group.base_ref }}" ]; then
echo "CI_BASE_BRANCH=${{ github.event.merge_group.base_ref }}" | sed s.=refs/heads/.=. >> $GITHUB_ENV
fi
- name: Setup git
run: |
# Note: ${{ github.base_ref }} is empty when not in a PR
if [ -n "${{ github.base_ref }}" ]; then
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} --no-tags
# Note: CI_BASE_BRANCH is empty when not in a PR
if [ -n "${CI_BASE_BRANCH}" ]; then
git fetch origin ${CI_BASE_BRANCH}:${CI_BASE_BRANCH} --no-tags
else
git config diff.renameLimit 16384
fi
@ -34,9 +42,9 @@ jobs:
run: docker pull riot/static-test-tools:latest
- name: Run static-tests
run: |
# Note: ${{ github.base_ref }} is empty when not in a PR
# Note: ${CI_BASE_BRANCH} is empty when not in a PR
docker run --rm \
-e CI_BASE_BRANCH=${{ github.base_ref }} \
-e CI_BASE_BRANCH \
-e GITHUB_RUN_ID=${GITHUB_RUN_ID} \
-v $(pwd):/data/riotbuild \
riot/static-test-tools:latest \

View File

@ -11,6 +11,7 @@ on:
pull_request:
branches:
- '*'
merge_group:
jobs:
tools-build:

View File

@ -9,9 +9,11 @@ on:
pull_request:
branches:
- '*'
merge_group:
jobs:
python-tests:
if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main

View File

@ -178,22 +178,18 @@ check_label() {
return $?
}
# this function returns 0 when this is build is building one of the two bors
# branches ("staging" or "trying", 1 otherwise.
is_bors_build() {
test "${CI_BUILD_BRANCH}" = "staging" || test "${CI_BUILD_BRANCH}" = "trying"
# true if "$2" starts with "$1", false otherwise
startswith() {
case "${2}" in
${1}*) true ;;
*) false ;;
esac
}
# Set CI_BASE_COMMIT in case of a bors build.
# This assumes that bors always adds a single merge commit (possibly itself
# including multiple merges for PRs) on the base branch.
# That git command outputs the hash of the second merge commit (the one before
# the topmost merge), which should be the base branch HEAD.
# (CI_BASE_COMMIT is used by `can_fast_ci_run.py` to only build changes.)
if test -z "${CI_BASE_COMMIT}" && is_bors_build ; then
previous_merge="$(git log --merges --max-count 1 --skip 1 --pretty=format:%H)"
export CI_BASE_COMMIT="${previous_merge}"
fi
# this function returns 0 when this build is building a merge queue branch.
is_merge_queue_build() {
startswith "gh-readonly-queue/" "${CI_BUILD_BRANCH}"
}
# fullbuild logic
# non-full-builds are those where can_fast_ci_run might reduce the build
@ -216,8 +212,8 @@ fi
# configurations.
if [ -z "${QUICK_BUILD}" ]; then
export QUICK_BUILD=0
if is_bors_build ; then
# always do full build for bors' branches
if is_merge_queue_build; then
# always do full build for merge queue' branches
true
elif [ ${FULL_BUILD} -eq 1 ]; then
# full build if building nightly or full build requested by label
@ -323,14 +319,6 @@ error() {
exit 1
}
# true if "$2" starts with "$1", false otherwise
startswith() {
case "${2}" in
${1}*) true ;;
*) false ;;
esac
}
# if MURDOCK_HOOK is set, this function will execute it and pass on all it's
# parameters. should the hook script exit with negative exit code, hook() makes
# this script exit with error, too.