Skip to content

Commit

Permalink
Merge branch 'branch-check'
Browse files Browse the repository at this point in the history
* 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/[email protected], fix annotated tag
	Upgrade to actions/[email protected] 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 <[email protected]>
  • Loading branch information
tim-janik committed Jan 26, 2024
2 parents ceaf526 + b8dc4a9 commit 9d38b0f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 35 deletions.
71 changes: 38 additions & 33 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@
on:
push:
branches: [ 'trunk', 'next', 'wip/**' ]
tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
# tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
pull_request:
branches: ['trunk', 'next']
branches: [ 'trunk', 'next' ]

jobs:

Focal-Assets:
runs-on: ubuntu-latest
env: { CICACHE: "/tmp/cicache", CITAG: "focal" }
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
- uses: actions/[email protected]
with: { fetch-depth: 0 }
- run: |
git fetch -f --tags # Fix actions/checkout annotated tag mess; actions/checkout#290
git submodule update --init --recursive
- uses: actions/cache@v4
with: { path: "/tmp/cicache", key: "cifocal-${{hashFiles ('misc/Dockerfile.focal')}}" }
- name: 'Prepare Docker Image'
run: |
Expand All @@ -25,12 +29,12 @@ jobs:
- name: 'Build Dist Assets'
run: |
misc/cirun -u 1000 make mkassets
- uses: actions/upload-artifact@v3.1.3
- uses: actions/upload-artifact@v4
with: { name: assets, path: assets/ }
- uses: actions/upload-artifact@v3.1.3
- uses: actions/upload-artifact@v4
with: { name: dist-tarball, path: assets/*.tar* }
- name: 'Upload API Docs' # http://tim-janik.github.io/docs/anklang
if: github.ref == 'refs/heads/trunk'
if: github.repository == 'tim-janik/anklang' && github.ref == 'refs/heads/trunk'
run: |
misc/cirun -u 1000 make -j`nproc` all
(umask 0077 && cat <<< "${{ secrets.SSH_ID_GHDOCS4ANKLANG_ECDSA }}" > .git/.ssh_id_ghdocs4anklang)
Expand All @@ -40,8 +44,12 @@ jobs:
runs-on: ubuntu-latest
env: { CICACHE: "/tmp/cicache", CITAG: "arch" }
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
- uses: actions/[email protected]
with: { fetch-depth: 0 }
- run: |
git fetch -f --tags # Fix actions/checkout annotated tag mess; actions/checkout#290
git submodule update --init --recursive
- uses: actions/cache@v4
with: { path: "/tmp/cicache", key: "ciarch-${{hashFiles ('misc/Dockerfile.arch')}}" }
- name: 'Prepare Docker Image'
run: |
Expand All @@ -54,19 +62,21 @@ jobs:
misc/cirun -u 1000 make -j`nproc` check
misc/cirun -u 1000 make x11test-v
# Artifact upload from x11test
- uses: actions/upload-artifact@v3.1.3
- uses: actions/upload-artifact@v4
if: always()
with:
name: x11test
path: out/x11test/
with: { name: "x11test", path: "out/x11test/" }

Focal-Clang-Tidy:
if: ${{ ! contains(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
env: { CICACHE: "/tmp/cicache", CITAG: "focal" }
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
- uses: actions/[email protected]
with: { fetch-depth: 0 }
- run: |
git fetch -f --tags # Fix actions/checkout annotated tag mess; actions/checkout#290
git submodule update --init --recursive
- uses: actions/cache@v4
with: { path: "/tmp/cicache", key: "cifocal-${{hashFiles ('misc/Dockerfile.focal')}}" }
- name: 'Prepare Docker Image'
run: |
Expand All @@ -80,35 +90,30 @@ jobs:
run: |
misc/cirun -u 1000 make -j`nproc` clang-tidy
# Artifact upload from clang-tidy
- uses: actions/upload-artifact@v3.1.3
- uses: actions/upload-artifact@v4
with: { name: clang-tidy, path: out/clang-tidy/ }

Release-Upload:
needs: [Focal-Assets, Arch-Replay]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
env: { GH_TOKEN: "${{ github.token }}" }
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Release Assets
uses: actions/download-artifact@v3
- run: ls -lR assets/
- name: Create Release with Assets
run: misc/publish.sh
- name: 'Make branch-check'
# Use non-0 exit status for a failing branch-check on PRs
run: |
test -z "${{ github.event.pull_request }}" || BRANCH_CHECK_EXIT=77
misc/cirun -u 1000 make branch-check BRANCH_CHECK_EXIT=$BRANCH_CHECK_EXIT
Ping-IRC:
if: always()
needs: [Focal-Assets, Arch-Replay, Focal-Clang-Tidy, Release-Upload]
needs: [Focal-Assets, Arch-Replay, Focal-Clang-Tidy]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with: { fetch-depth: 0 }
- run: |
git fetch -f --tags # Fix actions/checkout annotated tag mess; actions/checkout#290
git submodule update --init --recursive
- name: Check Jobs
run: |
echo '${{ needs.Focal-Assets.result }}' '${{ needs.Arch-Replay.result }}' '${{ needs.Focal-Clang-Tidy.result }}' '${{ needs.Release-Upload.result }}'
echo '${{ needs.Focal-Assets.result }}' '${{ needs.Arch-Replay.result }}' '${{ needs.Focal-Clang-Tidy.result }}'
[[ ${{ needs.Focal-Assets.result }} =~ success|skipped ]]
[[ ${{ needs.Arch-Replay.result }} =~ success|skipped ]]
[[ ${{ needs.Focal-Clang-Tidy.result }} =~ success|skipped ]]
[[ ${{ needs.Release-Upload.result }} =~ success|skipped ]]
- name: Ping IRC
if: always()
run: |
Expand Down
21 changes: 19 additions & 2 deletions misc/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ $>/clang-tidy/%.log: % $(GITCOMMITDEPS) | $>/clang-tidy/
CLANG_TIDY_DEFS := -I. -I$> -isystem external/ -isystem $>/external/ -DASE_COMPILATION $(ASEDEPS_CFLAGS) $(GTK2_CFLAGS)
# File specific LINT_FLAGS, example: ase/jsonapi.cc.LINT_FLAGS ::= --checks=-clang-analyzer-core.NullDereference
jsonipc/testjsonipc.cc.CTIDY_DEFS ::= -D__JSONIPC_NULL_REFERENCE_THROWS__
clang-tidy-clean:
rm -f -r $>/clang-tidy/
.PHONY: clang-tid clang-tidy-clean
CLEANDIRS += $>/clang-tidy/

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

# == branch-check ==
# Check for various lint results in files touched by the current branch
BRANCH_CHECK_UPSTREAM ::= trunk
branch-check:
$(QGEN)
$Q script $>/$(@F).log </dev/null -e -c ' : \
&& $(MAKE) -j`nproc` all \
&& $(MAKE) lint \
&& $(MAKE) -j`nproc` clang-tidy \
'
$Q git diff --name-only $$(git merge-base $(BRANCH_CHECK_UPSTREAM) HEAD) > $>/$(@F).files && sed 's/$$/:/' -i $>/$(@F).files
$Q grep -qFf $>/$(@F).files $>/$(@F).log || exit 0 \
&& M="$@: $$(git describe --all --always HEAD): Problems found in files touched since '$(BRANCH_CHECK_UPSTREAM)'" \
&& echo && echo "$$M" | sed -e '1{ h; s/./=/g; p;x; p;x; }'
$Q (set -x && grep -m 24 --color=auto -Ff $>/$(@F).files $>/$(@F).log) || exit 0 && exit $(BRANCH_CHECK_EXIT)
BRANCH_CHECK_EXIT ?= 0
.PHONY: branch-check

# == misc/anklang.desktop ==
# https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
$>/misc/anklang.desktop: misc/anklang.desktop | $>/misc/
Expand Down
2 changes: 2 additions & 0 deletions misc/mknews.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ else
echo '``````````````````````````````````````````````````````````````````````````````````````'
echo
fi

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 comments on commit 9d38b0f

Please sign in to comment.