Skip to content

Commit 9d38b0f

Browse files
committed
Merge branch 'branch-check'
* branch-check: GITHUB: workflows/testing.yml: update to actions/upload-artifact@v4 GITHUB: workflows/testing.yml: only build & upload docs from tim-janik/anklang GITHUB: workflows/testing.yml: update to actions/cache@v4 GITHUB: workflows/testing.yml: use actions/checkout@v4.1.1, fix annotated tag Upgrade to actions/checkout@v4.1.1 and Fix actions/checkout messing up checkouts of annotated tags; actions/checkout#290 Also fetch submodule upfront. GITHUB: workflows/testing.yml: remove Release-Upload run MISC: Makefile.mk: fix script v2.34 invocation The util script from util-linux 2.34 (focal) has no `-O` option. GITHUB: workflows/testing.yml: add `make branch-check` and check errors in PRs MISC: Makefile.mk: add branch-check rule, $BRANCH_CHECK_EXIT holds error status GITHUB: workflows/testing.yml: disable CI on tag pushes MISC: mknews.sh: show git command line MISC: Makefile.mk: fix missing CLEANDIRS Signed-off-by: Tim Janik <timj@gnu.org>
2 parents ceaf526 + b8dc4a9 commit 9d38b0f

File tree

3 files changed

+59
-35
lines changed

3 files changed

+59
-35
lines changed

.github/workflows/testing.yml

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@
55
on:
66
push:
77
branches: [ 'trunk', 'next', 'wip/**' ]
8-
tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
8+
# tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
99
pull_request:
10-
branches: ['trunk', 'next']
10+
branches: [ 'trunk', 'next' ]
1111

1212
jobs:
1313

1414
Focal-Assets:
1515
runs-on: ubuntu-latest
1616
env: { CICACHE: "/tmp/cicache", CITAG: "focal" }
1717
steps:
18-
- uses: actions/checkout@v4
19-
- uses: actions/cache@v3
18+
- uses: actions/checkout@v4.1.1
19+
with: { fetch-depth: 0 }
20+
- run: |
21+
git fetch -f --tags # Fix actions/checkout annotated tag mess; actions/checkout#290
22+
git submodule update --init --recursive
23+
- uses: actions/cache@v4
2024
with: { path: "/tmp/cicache", key: "cifocal-${{hashFiles ('misc/Dockerfile.focal')}}" }
2125
- name: 'Prepare Docker Image'
2226
run: |
@@ -25,12 +29,12 @@ jobs:
2529
- name: 'Build Dist Assets'
2630
run: |
2731
misc/cirun -u 1000 make mkassets
28-
- uses: actions/upload-artifact@v3.1.3
32+
- uses: actions/upload-artifact@v4
2933
with: { name: assets, path: assets/ }
30-
- uses: actions/upload-artifact@v3.1.3
34+
- uses: actions/upload-artifact@v4
3135
with: { name: dist-tarball, path: assets/*.tar* }
3236
- name: 'Upload API Docs' # http://tim-janik.github.io/docs/anklang
33-
if: github.ref == 'refs/heads/trunk'
37+
if: github.repository == 'tim-janik/anklang' && github.ref == 'refs/heads/trunk'
3438
run: |
3539
misc/cirun -u 1000 make -j`nproc` all
3640
(umask 0077 && cat <<< "${{ secrets.SSH_ID_GHDOCS4ANKLANG_ECDSA }}" > .git/.ssh_id_ghdocs4anklang)
@@ -40,8 +44,12 @@ jobs:
4044
runs-on: ubuntu-latest
4145
env: { CICACHE: "/tmp/cicache", CITAG: "arch" }
4246
steps:
43-
- uses: actions/checkout@v4
44-
- uses: actions/cache@v3
47+
- uses: actions/checkout@v4.1.1
48+
with: { fetch-depth: 0 }
49+
- run: |
50+
git fetch -f --tags # Fix actions/checkout annotated tag mess; actions/checkout#290
51+
git submodule update --init --recursive
52+
- uses: actions/cache@v4
4553
with: { path: "/tmp/cicache", key: "ciarch-${{hashFiles ('misc/Dockerfile.arch')}}" }
4654
- name: 'Prepare Docker Image'
4755
run: |
@@ -54,19 +62,21 @@ jobs:
5462
misc/cirun -u 1000 make -j`nproc` check
5563
misc/cirun -u 1000 make x11test-v
5664
# Artifact upload from x11test
57-
- uses: actions/upload-artifact@v3.1.3
65+
- uses: actions/upload-artifact@v4
5866
if: always()
59-
with:
60-
name: x11test
61-
path: out/x11test/
67+
with: { name: "x11test", path: "out/x11test/" }
6268

6369
Focal-Clang-Tidy:
6470
if: ${{ ! contains(github.ref, 'refs/tags/') }}
6571
runs-on: ubuntu-latest
6672
env: { CICACHE: "/tmp/cicache", CITAG: "focal" }
6773
steps:
68-
- uses: actions/checkout@v4
69-
- uses: actions/cache@v3
74+
- uses: actions/checkout@v4.1.1
75+
with: { fetch-depth: 0 }
76+
- run: |
77+
git fetch -f --tags # Fix actions/checkout annotated tag mess; actions/checkout#290
78+
git submodule update --init --recursive
79+
- uses: actions/cache@v4
7080
with: { path: "/tmp/cicache", key: "cifocal-${{hashFiles ('misc/Dockerfile.focal')}}" }
7181
- name: 'Prepare Docker Image'
7282
run: |
@@ -80,35 +90,30 @@ jobs:
8090
run: |
8191
misc/cirun -u 1000 make -j`nproc` clang-tidy
8292
# Artifact upload from clang-tidy
83-
- uses: actions/upload-artifact@v3.1.3
93+
- uses: actions/upload-artifact@v4
8494
with: { name: clang-tidy, path: out/clang-tidy/ }
85-
86-
Release-Upload:
87-
needs: [Focal-Assets, Arch-Replay]
88-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
89-
env: { GH_TOKEN: "${{ github.token }}" }
90-
runs-on: ubuntu-latest
91-
steps:
92-
- uses: actions/checkout@v4
93-
- name: Download Release Assets
94-
uses: actions/download-artifact@v3
95-
- run: ls -lR assets/
96-
- name: Create Release with Assets
97-
run: misc/publish.sh
95+
- name: 'Make branch-check'
96+
# Use non-0 exit status for a failing branch-check on PRs
97+
run: |
98+
test -z "${{ github.event.pull_request }}" || BRANCH_CHECK_EXIT=77
99+
misc/cirun -u 1000 make branch-check BRANCH_CHECK_EXIT=$BRANCH_CHECK_EXIT
98100
99101
Ping-IRC:
100102
if: always()
101-
needs: [Focal-Assets, Arch-Replay, Focal-Clang-Tidy, Release-Upload]
103+
needs: [Focal-Assets, Arch-Replay, Focal-Clang-Tidy]
102104
runs-on: ubuntu-latest
103105
steps:
104-
- uses: actions/checkout@v3
106+
- uses: actions/checkout@v4.1.1
107+
with: { fetch-depth: 0 }
108+
- run: |
109+
git fetch -f --tags # Fix actions/checkout annotated tag mess; actions/checkout#290
110+
git submodule update --init --recursive
105111
- name: Check Jobs
106112
run: |
107-
echo '${{ needs.Focal-Assets.result }}' '${{ needs.Arch-Replay.result }}' '${{ needs.Focal-Clang-Tidy.result }}' '${{ needs.Release-Upload.result }}'
113+
echo '${{ needs.Focal-Assets.result }}' '${{ needs.Arch-Replay.result }}' '${{ needs.Focal-Clang-Tidy.result }}'
108114
[[ ${{ needs.Focal-Assets.result }} =~ success|skipped ]]
109115
[[ ${{ needs.Arch-Replay.result }} =~ success|skipped ]]
110116
[[ ${{ needs.Focal-Clang-Tidy.result }} =~ success|skipped ]]
111-
[[ ${{ needs.Release-Upload.result }} =~ success|skipped ]]
112117
- name: Ping IRC
113118
if: always()
114119
run: |

misc/Makefile.mk

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ $>/clang-tidy/%.log: % $(GITCOMMITDEPS) | $>/clang-tidy/
4949
CLANG_TIDY_DEFS := -I. -I$> -isystem external/ -isystem $>/external/ -DASE_COMPILATION $(ASEDEPS_CFLAGS) $(GTK2_CFLAGS)
5050
# File specific LINT_FLAGS, example: ase/jsonapi.cc.LINT_FLAGS ::= --checks=-clang-analyzer-core.NullDereference
5151
jsonipc/testjsonipc.cc.CTIDY_DEFS ::= -D__JSONIPC_NULL_REFERENCE_THROWS__
52-
clang-tidy-clean:
53-
rm -f -r $>/clang-tidy/
5452
.PHONY: clang-tid clang-tidy-clean
53+
CLEANDIRS += $>/clang-tidy/
5554

5655
# == scan-build ==
5756
scan-build: | $>/misc/scan-build/
@@ -71,6 +70,24 @@ scan-build: | $>/misc/scan-build/
7170
.PHONY: scan-build
7271
# Note, 'make scan-build' requires 'make default CC=clang CXX=clang++' to generate any reports.
7372

73+
# == branch-check ==
74+
# Check for various lint results in files touched by the current branch
75+
BRANCH_CHECK_UPSTREAM ::= trunk
76+
branch-check:
77+
$(QGEN)
78+
$Q script $>/$(@F).log </dev/null -e -c ' : \
79+
&& $(MAKE) -j`nproc` all \
80+
&& $(MAKE) lint \
81+
&& $(MAKE) -j`nproc` clang-tidy \
82+
'
83+
$Q git diff --name-only $$(git merge-base $(BRANCH_CHECK_UPSTREAM) HEAD) > $>/$(@F).files && sed 's/$$/:/' -i $>/$(@F).files
84+
$Q grep -qFf $>/$(@F).files $>/$(@F).log || exit 0 \
85+
&& M="$@: $$(git describe --all --always HEAD): Problems found in files touched since '$(BRANCH_CHECK_UPSTREAM)'" \
86+
&& echo && echo "$$M" | sed -e '1{ h; s/./=/g; p;x; p;x; }'
87+
$Q (set -x && grep -m 24 --color=auto -Ff $>/$(@F).files $>/$(@F).log) || exit 0 && exit $(BRANCH_CHECK_EXIT)
88+
BRANCH_CHECK_EXIT ?= 0
89+
.PHONY: branch-check
90+
7491
# == misc/anklang.desktop ==
7592
# https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
7693
$>/misc/anklang.desktop: misc/anklang.desktop | $>/misc/

misc/mknews.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,5 @@ else
5656
echo '``````````````````````````````````````````````````````````````````````````````````````'
5757
echo
5858
fi
59+
60+
echo "git log --first-parent --date=short --pretty=\"%s # %cd %an %h%n%w(0,4,4)%b\" '$NEWS_TAG..HEAD' | sed -r 's/\s+[A-Z][a-zA-Z0-9-]*:.*<.*@.*>\s*$//' " >&2

0 commit comments

Comments
 (0)