summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-10-04 23:22:22 +0500
committerEgor Tensin <egor@tensin.name>2026-10-04 23:22:22 +0500
commit49ae1a515d0aca17397d35b8d99bd5b4f442ca55 (patch)
tree013bfed876482549cf0b06a763542525d46b4fc9
parentMakefile: source package name from PKGBUILD (diff)
downloadcmake-common-49ae1a515d0aca17397d35b8d99bd5b4f442ca55.tar.gz
cmake-common-49ae1a515d0aca17397d35b8d99bd5b4f442ca55.zip
Makefile: move setup steps from GitHub Actions workflow
-rw-r--r--Makefile41
1 files changed, 41 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index c58e716..e556803 100644
--- a/Makefile
+++ b/Makefile
@@ -57,3 +57,44 @@ maintenance: pkgver
echo '-----------------------------------------------------------------'; \
exit 1; \
fi
+
+.PHONY: ci/deps
+ci/deps:
+ @echo '============================================ CI: dependencies ==='
+ pacman -Syu --noconfirm git openssh
+
+# makepkg for no reason hard-forbids running as root. Kill me now.
+.PHONY: ci/user
+ci/user:
+ @echo '============================================ CI: builder user ==='
+ useradd -m -s /bin/bash builder
+ passwd -d builder
+ echo 'builder ALL=(ALL) ALL' >> /etc/sudoers
+ chown -R builder:builder -- "$$GITHUB_WORKSPACE"
+
+.PHONY: ci/ssh
+ci/ssh:
+ @echo '=========================================== CI: configure SSH ==='
+ mkdir -p /home/builder/.ssh/
+ echo 'StrictHostKeyChecking no' > /home/builder/.ssh/config
+ echo "$$SSH_KEY" > /home/builder/.ssh/id_ed25519
+ chown -R builder:builder /home/builder/.ssh
+ chmod 0600 /home/builder/.ssh/id_ed25519
+
+# See https://github.com/actions/checkout#push-a-commit-using-the-built-in-token
+.PHONY: ci/git
+ci/git:
+ @echo '=========================================== CI: configure git ==='
+ runuser -u builder -- git -C "$$GITHUB_WORKSPACE" config user.name "github-actions[bot]"
+ runuser -u builder -- git -C "$$GITHUB_WORKSPACE" config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+
+.PHONY: ci/setup
+ci/setup: ci/deps
+ci/setup: ci/user
+ci/setup: ci/ssh
+ci/setup: ci/git
+
+.PHONY: ci
+ci: ci/setup
+ci:
+ runuser -u builder -- $(MAKE) -C "$$GITHUB_WORKSPACE" maintenance