Skip to content

Commit a738119

Browse files
committed
Merge branch 'distcheck-in-ci'
* Branch commit log: .github/workflows/testing.yml: run CI for PRs and tags .github/workflows/testing.yml: upload artifacts/, add CreateRelease Makefile.mk: fix ChangeLog and tarball location .gitignore: updates .github/workflows/testing.yml: add distcheck to CI, upload tarball Makefile.mk: add `make distcheck` Makefile.mk: reorder & cleanup .github/workflows/testing.yml: install jj and fzf in usr/local .github/workflows/testing.yml: use sudo for make install .github/workflows/testing.yml: install pandoc for man builds Signed-off-by: Tim Janik <timj@gnu.org>
2 parents ac769d5 + 4d42593 commit a738119

File tree

3 files changed

+85
-33
lines changed

3 files changed

+85
-33
lines changed

.github/workflows/testing.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,74 @@
33
# Linting: xclip -sel c <.github/workflows/testing.yml # https://rhysd.github.io/actionlint/
44

55
on:
6-
pull_request:
76
push:
8-
branches: [ '**' ]
9-
# tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
7+
branches: ['main', 'master', 'trunk', 'wip/**']
8+
tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
9+
pull_request:
10+
branches: ['trunk', 'wip/**'] # Only run PRs targeting these branches
1011

1112
jobs:
1213

13-
MakeCheck:
14+
MakeDistCheck:
1415
runs-on: ubuntu-24.04
1516
steps:
16-
- { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0, submodules: recursive, github-server-url: 'https://github.com' } }
17-
- run: git fetch -f --tags && git describe --long # Fix actions/checkout#290
17+
- { uses: actions/checkout@v4, with: { fetch-depth: 0 } }
18+
- run: git fetch -f --tags # Fix actions/checkout#290
1819
- run: |
1920
curl -s -L https://github.com/junegunn/fzf/releases/download/v0.56.3/fzf-0.56.3-linux_amd64.tar.gz |
20-
tar zxvf - -C ~/.cargo/bin/ fzf
21+
sudo tar zxvf - -C /usr/local/bin/ fzf
2122
fzf --version
2223
- run: |
2324
curl -s -L https://github.com/martinvonz/jj/releases/download/v0.31.0/jj-v0.31.0-x86_64-unknown-linux-musl.tar.gz |
24-
tar zxvf - -C ~/.cargo/bin/ ./jj
25+
sudo tar zxvf - -C /usr/local/bin/ ./jj
2526
jj --version
27+
- run: |
28+
cd /tmp && wget -q -c https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-1-amd64.deb
29+
sudo apt install ./pandoc-3.7.0.2-1-amd64.deb && pandoc --version
2630
- run: |
2731
make all
2832
- run: |
2933
make check
3034
- run: |
31-
make install
35+
sudo make install
3236
- run: |
3337
make installcheck
3438
- run: |
35-
make uninstall
39+
sudo make uninstall
3640
- run: |
3741
make clean
42+
- run: |
43+
make distcheck
44+
- uses: actions/upload-artifact@v4
45+
with: { name: jj-fzf-Tarball, path: artifacts/ }
46+
47+
CreateRelease:
48+
runs-on: ubuntu-latest
49+
needs: [ MakeDistCheck ]
50+
if: github.ref_type == 'tag' # https://docs.github.com/en/actions/reference/events-that-trigger-workflows
51+
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
52+
permissions: { contents: write } # allow github.token to create a release
53+
env: { GH_TOKEN: "${{ github.token }}" }
54+
steps:
55+
- { uses: actions/checkout@v4, with: { fetch-depth: 0 } }
56+
- run: git fetch -f --tags # Fix actions/checkout#290
57+
- uses: actions/download-artifact@v4
58+
with: { path: ./artifacts, merge-multiple: true }
59+
- run: ls -alR artifacts/
60+
- run: |
61+
.github/workflows/gh-release.sh "Anklang"
3862
3963
Ping-IRC:
4064
if: always()
41-
needs: [MakeCheck]
65+
needs: [MakeDistCheck]
4266
runs-on: ubuntu-24.04
4367
steps:
4468
- { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0, github-server-url: 'https://github.com' } }
4569
- run: git fetch -f --tags && git describe --long # Fix actions/checkout#290
4670
- name: Check Jobs
4771
run: |
48-
echo '${{ needs.MakeCheck.result }}'
49-
[[ ${{ needs.MakeCheck.result }} =~ success|skipped ]]
72+
echo '${{ needs.MakeDistCheck.result }}'
73+
[[ ${{ needs.MakeDistCheck.result }} =~ success|skipped ]]
5074
- name: Ping IRC
5175
if: ${{ always() && !env.ACT }}
5276
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/BACKLOG.md
22
/doc/jj-fzf.1
33
/wiki/
4+
/artifacts/
45
*.tmp*
56
.x*

Makefile.mk

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ CLEANFILES := *.tmp
1515
CLEANDIRS :=
1616
Q := $(if $(findstring 1, $(V)),, @)
1717
QGEN = @echo ' GEN ' $@
18-
INSTALL := install -c
19-
RM := rm -f
18+
QSKIP := $(if $(findstring s,$(MAKEFLAGS)),: )
19+
QECHO = @QECHO() { Q1="$$1"; shift; QR="$$*"; QOUT=$$(printf ' %-8s ' "$$Q1" ; echo "$$QR") && $(QSKIP) echo "$$QOUT"; }; QECHO
2020

2121
# == Compare Versions ==
2222
# Shell command that is true if $1 <= $2 in version comparisons
@@ -54,24 +54,6 @@ man/markdown-flavour := -f markdown+hard_line_breaks+autolink_bare_uris+emoji+li
5454
CLEANFILES += doc/jj-fzf.1 doc/*.tmp*
5555
all: doc/jj-fzf.1
5656

57-
# == install & uninstall ==
58-
install: all
59-
$(QGEN)
60-
mkdir -p $(DESTDIR)$(PRJDIR)/doc $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
61-
install -c version.sh jj-fzf $(DESTDIR)$(PRJDIR)
62-
@ # Note, .gitattributes:export-subst + git archive + tar are used to hardcode version in $(PRJDIR)/version.sh
63-
test ! -e .gitattributes || git archive HEAD version.sh | tar xC $(DESTDIR)$(PRJDIR)
64-
install -c doc/jj-fzf.1 $(DESTDIR)$(PRJDIR)/doc
65-
ln -sf ../../../$(LIBEXEC)/doc/jj-fzf.1 $(DESTDIR)$(MANDIR)/man1/
66-
ln -sf ../$(LIBEXEC)/jj-fzf $(DESTDIR)$(BINDIR)/jj-fzf
67-
installcheck:
68-
$(QGEN)
69-
$Q $(DESTDIR)$(BINDIR)/jj-fzf --version >/dev/null || { echo "$@: ERROR: failed to start $(BINDIR)/jj-fzf" >&2; false; }
70-
$Q man $(DESTDIR)$(PRJDIR)/doc/jj-fzf.1 | grep -qF jj-fzf || { echo "$@: ERROR: failed to render $(DESTDIR)$(PRJDIR)/doc/jj-fzf.1" >&2; false; }
71-
uninstall:
72-
$(QGEN)
73-
rm -r -f $(DESTDIR)$(PRJDIR) $(DESTDIR)$(BINDIR)/jj-fzf $(DESTDIR)$(MANDIR)/man1/jj-fzf.1
74-
7557
# == tests ==
7658
tests-basics.sh:
7759
$Q tests/basics.sh
@@ -96,6 +78,51 @@ check-help:
9678
$Q ./jj-fzf --help | grep -qF jj-fzf || { echo "$@: ERROR: failed to render \`./jj-fzf --help\`" >&2; false; }
9779
check: check-deps check-gsed check-help shellcheck-error tests-basics.sh
9880

81+
# == install & uninstall ==
82+
install: all
83+
$(QGEN)
84+
mkdir -p $(DESTDIR)$(PRJDIR)/doc $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
85+
install -c version.sh jj-fzf $(DESTDIR)$(PRJDIR)
86+
@ # Note, .gitattributes:export-subst + git archive + tar are used to hardcode version in $(PRJDIR)/version.sh
87+
test ! -e .gitattributes || git archive HEAD version.sh | tar xC $(DESTDIR)$(PRJDIR)
88+
install -c doc/jj-fzf.1 $(DESTDIR)$(PRJDIR)/doc
89+
ln -sf ../../../$(LIBEXEC)/doc/jj-fzf.1 $(DESTDIR)$(MANDIR)/man1/
90+
ln -sf ../$(LIBEXEC)/jj-fzf $(DESTDIR)$(BINDIR)/jj-fzf
91+
installcheck:
92+
$(QGEN)
93+
$Q $(DESTDIR)$(BINDIR)/jj-fzf --version >/dev/null || { echo "$@: ERROR: failed to start $(BINDIR)/jj-fzf" >&2; false; }
94+
$Q man $(DESTDIR)$(PRJDIR)/doc/jj-fzf.1 | grep -qF jj-fzf || { echo "$@: ERROR: failed to render $(DESTDIR)$(PRJDIR)/doc/jj-fzf.1" >&2; false; }
95+
uninstall:
96+
$(QGEN)
97+
rm -r -f $(DESTDIR)$(PRJDIR) $(DESTDIR)$(BINDIR)/jj-fzf $(DESTDIR)$(MANDIR)/man1/jj-fzf.1
98+
99+
# == distcheck ==
100+
distcheck:
101+
@$(eval distversion != git describe --match='v[0-9]*.[0-9]*.[0-9]*' | sed 's/^v//')
102+
@$(eval distname := jj-fzf-$(distversion))
103+
$(QECHO) MAKE $(distname).tar.zst
104+
$Q test -n "$(distversion)" || { echo -e "#\n# $@: ERROR: no dist version, is git working?\n#" >&2; false; }
105+
$Q git describe --dirty | grep -qve -dirty || echo -e "#\n# $@: WARNING: working tree is dirty\n#"
106+
$Q rm -r -f artifacts/ && mkdir -p artifacts/
107+
$Q # Generate ChangeLog with ^^-prefixed records. Tab-indent commit bodies, kill whitespaces and multi-newlines
108+
$Q git log --abbrev=13 --date=short --first-parent HEAD \
109+
--pretty='^^%ad %an # %h%n%n%B%n' > artifacts/ChangeLog \
110+
&& sed 's/^/ /; s/^ ^^// ; s/[[:space:]]\+$$// ' -i artifacts/ChangeLog \
111+
&& sed '/^\s*$$/{ N; /^\s*\n\s*$$/D }' -i artifacts/ChangeLog
112+
$Q # Generate and compress artifacts/jj-fzf-*.tar.zst
113+
$Q git archive --prefix=$(distname)/ --add-file artifacts/ChangeLog -o artifacts/$(distname).tar HEAD
114+
$Q rm -f artifacts/$(distname).tar.zst && zstd --ultra -22 --rm artifacts/$(distname).tar && ls -lh artifacts/$(distname).tar.zst
115+
$Q T=`mktemp -d` && cd $$T && tar xf $(abspath artifacts/$(distname).tar.zst) \
116+
&& cd jj-fzf-$(distversion) \
117+
&& nice make all -j`nproc` \
118+
&& make PREFIX=$$T/inst install \
119+
&& make PREFIX=$$T/inst installcheck -j`nproc` \
120+
&& (set -x && $$T/inst/bin/jj-fzf --version) \
121+
&& make PREFIX=$$T/inst uninstall \
122+
&& (set -x && $$PWD/jj-fzf --version) \
123+
&& cd / && rm -r "$$T"
124+
$Q echo "Archive ready: artifacts/$(distname).tar.zst" | sed '1h; 1s/./=/g; 1p; 1x; $$p; $$x'
125+
99126
# == clean ==
100127
clean:
101128
rm -f $(CLEANFILES)

0 commit comments

Comments
 (0)