71 lines
2.4 KiB
YAML
71 lines
2.4 KiB
YAML
# CI-02 PROBE - THROWAWAY. Trial 2: CI-01's per-PR concurrency group kept, but
|
|
# cancel-in-progress FLIPPED TO false. Trial 1 (no block at all) left a queued
|
|
# run alive across two further pushes. This trial asks the narrower question the
|
|
# fix actually turns on: does the group ALONE kill a queued run, the way GitHub
|
|
# documents ("any previously pending job in the group will be cancelled"), or
|
|
# was cancel-in-progress: true the whole cause?
|
|
name: checks
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [release/1.0, master]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: addon-checks-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
unit:
|
|
runs-on: [self-hosted, goodwe-rig]
|
|
timeout-minutes: 20
|
|
env:
|
|
WS: /home/homelab/ci/ci02probe-${{ github.run_number }}
|
|
PRNUM: ${{ github.event.pull_request.number }}
|
|
BASEREF: ${{ github.base_ref }}
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
URL: ${{ github.server_url }}/${{ github.repository }}.git
|
|
steps:
|
|
- name: Q00 an empty clone
|
|
run: |
|
|
set -eu
|
|
rm -rf "$WS" && mkdir -p "$WS" && cd "$WS"
|
|
git init -q .
|
|
git remote add origin "$(echo "$URL" | sed "s#://#://x-access-token:${TOKEN}@#")"
|
|
echo "BASEREF=[$BASEREF] PRNUM=[$PRNUM]"
|
|
|
|
- name: Q01 github.base_ref is populated and its branch fetches ALONE
|
|
if: always()
|
|
run: |
|
|
set -eu
|
|
cd "$WS"
|
|
test -n "$BASEREF"
|
|
git fetch -q origin "+refs/heads/$BASEREF:refs/remotes/origin/base"
|
|
git rev-parse refs/remotes/origin/base
|
|
|
|
- name: Q02 the pull request head fetches ALONE
|
|
if: always()
|
|
run: |
|
|
set -eu
|
|
cd "$WS"
|
|
git fetch -q origin "+refs/pull/$PRNUM/head:refs/remotes/origin/pr"
|
|
git rev-parse refs/remotes/origin/pr
|
|
|
|
- name: Q03 and only THEN does the merge itself refuse
|
|
if: always()
|
|
run: |
|
|
set -eu
|
|
cd "$WS"
|
|
git fetch -q origin "+refs/heads/$BASEREF:refs/remotes/origin/base"
|
|
git fetch -q origin "+refs/pull/$PRNUM/head:refs/remotes/origin/pr"
|
|
git checkout -qf refs/remotes/origin/base
|
|
git -c user.email=ci@local -c user.name=ci merge --no-edit refs/remotes/origin/pr
|
|
|
|
- name: Q09 hold the single runner slot
|
|
if: always()
|
|
run: sleep 200
|
|
|
|
- name: Q99 clean up
|
|
if: always()
|
|
run: rm -rf "$WS" || true
|