Skip to content

Commit feaf33d

Browse files
authored
Change to git-flow model for PRs (#1039)
As discussed, this PR moves the LLVM backend repo over to the flow-based model of versioning we already use in the K repo.
1 parent 8d4130e commit feaf33d

File tree

4 files changed

+77
-25
lines changed

4 files changed

+77
-25
lines changed

.github/workflows/clang-format-check.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: "Code Checks"
22
on:
33
pull_request:
4+
types: [opened, edited, reopened, synchronize]
5+
branches:
6+
- 'develop'
47
concurrency:
58
group: ${{ github.workflow }}-${{ github.ref }}
69
cancel-in-progress: true

.github/workflows/develop.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 'Bump version and make master job'
2+
on:
3+
push:
4+
branches:
5+
- 'develop'
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
12+
version-bump:
13+
name: 'Version Bump'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: 'Check out code'
17+
uses: actions/checkout@v4
18+
with:
19+
token: ${{ secrets.JENKINS_GITHUB_PAT }}
20+
# fetch-depth 0 means deep clone the repo
21+
fetch-depth: 0
22+
- name: 'Update Version'
23+
run: |
24+
set -x
25+
git config user.name devops
26+
git config user.email [email protected]
27+
git checkout -B master origin/master
28+
old_develop="$(git merge-base origin/develop origin/master)"
29+
new_develop="$(git rev-parse origin/develop)"
30+
if git diff --exit-code ${old_develop} ${new_develop} -- package/version; then
31+
git merge --no-edit origin/develop
32+
./package/version.sh bump
33+
else
34+
git merge --no-edit --strategy-option=theirs origin/develop
35+
fi
36+
./package/version.sh sub
37+
if git add --update && git commit --no-edit --allow-empty --message "Set Version: $(cat package/version)"; then
38+
git push origin master
39+
fi

.github/workflows/master-pr.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'Change PR target to master'
2+
on:
3+
pull_request:
4+
branches:
5+
- 'master'
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
12+
change-base:
13+
name: 'Change base to develop branch'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: 'Check out code'
17+
uses: actions/checkout@v4
18+
with:
19+
token: ${{ secrets.JENKINS_GITHUB_PAT }}
20+
# fetch-depth 0 means deep clone the repo
21+
fetch-depth: 0
22+
- name: 'Change base'
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.JENKINS_GITHUB_PAT }}
25+
run: |
26+
set -x
27+
pull_number=$(jq --raw-output .pull_request.number "${GITHUB_EVENT_PATH}")
28+
curl -X PATCH \
29+
-H "Accept: application/vnd.github+json" \
30+
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
31+
https://api.github.com/repos/runtimeverification/llvm-backend/pulls/${pull_number} \
32+
-d '{"base":"develop"}'

.github/workflows/test.yml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,14 @@
11
name: "Run LLVM backend tests"
22
on:
33
pull_request:
4+
types: [opened, edited, reopened, synchronize]
5+
branches:
6+
- 'develop'
47
concurrency:
58
group: ${{ github.workflow }}-${{ github.ref }}
69
cancel-in-progress: true
710

811
jobs:
9-
version-bump:
10-
name: 'Version Bump'
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: 'Check out code'
14-
uses: actions/checkout@v3
15-
with:
16-
token: ${{ secrets.JENKINS_GITHUB_PAT }}
17-
# fetch-depth 0 means deep clone the repo
18-
fetch-depth: 0
19-
ref: ${{ github.event.pull_request.head.sha }}
20-
- name: 'Configure GitHub user'
21-
run: |
22-
git config user.name devops
23-
git config user.email [email protected]
24-
- name: 'Update version'
25-
run: |
26-
og_version=$(git show origin/${GITHUB_BASE_REF}:package/version)
27-
./package/version.sh bump ${og_version}
28-
./package/version.sh sub
29-
new_version=$(cat package/version)
30-
git add --update && git commit --message "Set Version: ${new_version}" || true
31-
- name: 'Push updates'
32-
run: git push origin HEAD:${GITHUB_HEAD_REF}
33-
3412
compile-nix-flake:
3513
name: 'Nix flake'
3614
strategy:

0 commit comments

Comments
 (0)