mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-27 14:12:09 +00:00
Build system: allow parallel builds
Make it possible to build the tilde, staging, production, and onion sites in parallel. Lint the staging site before deploying it. Also make these bmake-compatible so I can use bmake instead of gmake.
This commit is contained in:
parent
5a1782f1ee
commit
3f7e32e70f
2 changed files with 47 additions and 20 deletions
|
@ -3,7 +3,7 @@ image: alpine/edge
|
||||||
packages:
|
packages:
|
||||||
- rsync
|
- rsync
|
||||||
- git # for Hugo's gitInfo
|
- git # for Hugo's gitInfo
|
||||||
- make
|
- bmake
|
||||||
sources:
|
sources:
|
||||||
- https://git.sr.ht/~seirdy/seirdy.one
|
- https://git.sr.ht/~seirdy/seirdy.one
|
||||||
secrets:
|
secrets:
|
||||||
|
@ -15,12 +15,10 @@ triggers:
|
||||||
tasks:
|
tasks:
|
||||||
- deps: |
|
- deps: |
|
||||||
echo "StrictHostKeyChecking=no" >> ~/.ssh/config
|
echo "StrictHostKeyChecking=no" >> ~/.ssh/config
|
||||||
rsync -v deploy@seirdy.one:/home/deploy/binaries.tar.gz .
|
rsync -Wv deploy@seirdy.one:/home/deploy/binaries.tar.gz .
|
||||||
mkdir -p ~/bin
|
mkdir -p ~/bin
|
||||||
tar xzf binaries.tar.gz -oC ~/bin
|
tar xzf binaries.tar.gz -oC ~/bin
|
||||||
cd seirdy.one
|
|
||||||
- build_deploy: |
|
- build_deploy: |
|
||||||
cd seirdy.one
|
cd seirdy.one
|
||||||
export PATH=~/bin:$PATH
|
export PATH=~/bin:$PATH
|
||||||
make clean deploy
|
bmake deploy-prod deploy-onion
|
||||||
make WWW_ROOT=/var/www/seirdy.onion HUGO_BASEURL='http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/' clean deploy-html
|
|
||||||
|
|
59
Makefile
59
Makefile
|
@ -1,4 +1,5 @@
|
||||||
CSS_DIR = assets/css
|
CSS_DIR = assets/css
|
||||||
|
SRCFILES = layouts/**/*.html layouts/**/*.xml content/**/*.md $(CSS_DIR)/*.css static/*.svg assets/*.svg config.toml csv/*
|
||||||
DEVSERVER_URL="http://localhost:1313/"
|
DEVSERVER_URL="http://localhost:1313/"
|
||||||
|
|
||||||
DOMAIN = seirdy.one
|
DOMAIN = seirdy.one
|
||||||
|
@ -12,17 +13,15 @@ WWW_RSYNC_DEST = $(USER):$(WWW_ROOT)
|
||||||
GEMINI_RSYNC_DEST = $(USER):$(GEMINI_ROOT)
|
GEMINI_RSYNC_DEST = $(USER):$(GEMINI_ROOT)
|
||||||
|
|
||||||
OUTPUT_DIR = public
|
OUTPUT_DIR = public
|
||||||
RSYNCFLAGS += -rlcv --zc=zstd --zl=6
|
RSYNCFLAGS += -rlcv --zc=zstd --zl=6 --skip-compress=gz/br/zst/png/webp/jpg/avif/jxl/mp4/mkv/webm/opus/mp3
|
||||||
# include br, jxl, and gmi in skip-compress; skip unchanged files.
|
|
||||||
RSYNCFLAGS += --skip-compress=gz/br/zst/png/webp/jpg/avif/jxl/mp4/mkv/webm/opus/mp3 -c
|
|
||||||
# compression gets slow for extreme levels like the old "70109"
|
# compression gets slow for extreme levels like the old "70109"
|
||||||
ECT_LEVEL=9
|
ECT_LEVEL=9
|
||||||
|
|
||||||
VNU ?= vnu
|
VNU ?= vnu
|
||||||
|
|
||||||
.PHONY: hugo
|
.PHONY: hugo
|
||||||
hugo: clean
|
hugo: $(SRCFILES)
|
||||||
hugo -b $(HUGO_BASEURL) $(HUGO_FLAGS)
|
hugo -b $(HUGO_BASEURL) $(HUGO_FLAGS) -d $(OUTPUT_DIR)
|
||||||
|
|
||||||
# .hintrc-local for linting local files
|
# .hintrc-local for linting local files
|
||||||
# same as regular .hintrc but with a different connector.
|
# same as regular .hintrc but with a different connector.
|
||||||
|
@ -37,13 +36,13 @@ clean:
|
||||||
rm -rf $(OUTPUT_DIR) .lighthouseci lighthouse-reports mentions.json
|
rm -rf $(OUTPUT_DIR) .lighthouseci lighthouse-reports mentions.json
|
||||||
|
|
||||||
.PHONY: lint-css
|
.PHONY: lint-css
|
||||||
lint-css:
|
lint-css: $(CSS_DIR)/*.css
|
||||||
pnpm -s dlx stylelint --config linter-configs/stylelintrc.json --di --rd --rdd $(CSS_DIR)/main.css $(CSS_DIR)/dark.css $(CSS_DIR)/print.css
|
pnpm -s dlx stylelint --config linter-configs/stylelintrc.json --di --rd --rdd $(CSS_DIR)/*.css
|
||||||
@#csslint --quiet $(CSS_DIR)
|
@#csslint --quiet $(CSS_DIR)
|
||||||
|
|
||||||
.PHONY: lint-html
|
.PHONY: lint-html
|
||||||
lint-html: hugo
|
lint-html:
|
||||||
$(VNU) --stdout --format json --skip-non-html --also-check-svg public | jq --from-file linter-configs/vnu_filter.jq
|
$(VNU) --stdout --format json --skip-non-html --also-check-svg $(OUTPUT_DIR) | jq --from-file linter-configs/vnu_filter.jq
|
||||||
|
|
||||||
.PHONY: hint
|
.PHONY: hint
|
||||||
hint: hugo .hintrc-local
|
hint: hugo .hintrc-local
|
||||||
|
@ -70,16 +69,19 @@ check-links: hugo
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: lint-css hint-devserver check-links
|
test: lint-css hint-devserver check-links
|
||||||
|
|
||||||
.PHONY: build
|
gz:
|
||||||
build: hugo
|
|
||||||
ifndef NO_STATIC
|
|
||||||
find $(OUTPUT_DIR) -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.webmanifest' -o -name '*.*.svg' \
|
find $(OUTPUT_DIR) -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.webmanifest' -o -name '*.*.svg' \
|
||||||
| grep -v gemini \
|
| grep -v gemini \
|
||||||
| xargs ect -$(ECT_LEVEL) -gzip
|
| xargs ect -$(ECT_LEVEL) -gzip
|
||||||
|
|
||||||
|
brotli:
|
||||||
find $(OUTPUT_DIR) -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.webmanifest' -o -name '*.*.svg' \
|
find $(OUTPUT_DIR) -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.webmanifest' -o -name '*.*.svg' \
|
||||||
| grep -v gemini \
|
| grep -v gemini \
|
||||||
| xargs brotli -q 11 --
|
| xargs brotli -q 11 --
|
||||||
endif
|
|
||||||
|
compress: gz brotli
|
||||||
|
|
||||||
|
.PHONY: compress gz brotli
|
||||||
|
|
||||||
# save webmentions to a file, don't send yet
|
# save webmentions to a file, don't send yet
|
||||||
mentions.json: hugo
|
mentions.json: hugo
|
||||||
|
@ -91,11 +93,11 @@ mentions.json: hugo
|
||||||
rm mentions.json.unfiltered
|
rm mentions.json.unfiltered
|
||||||
|
|
||||||
.PHONY: deploy-html
|
.PHONY: deploy-html
|
||||||
deploy-html: build
|
deploy-html:
|
||||||
rsync $(RSYNCFLAGS) --exclude 'gemini' --exclude '*.gmi' --exclude-from .rsyncignore $(OUTPUT_DIR)/ $(WWW_RSYNC_DEST) --delete
|
rsync $(RSYNCFLAGS) --exclude 'gemini' --exclude '*.gmi' --exclude-from .rsyncignore $(OUTPUT_DIR)/ $(WWW_RSYNC_DEST) --delete
|
||||||
|
|
||||||
.PHONY: deploy-gemini
|
.PHONY: deploy-gemini
|
||||||
deploy-gemini: hugo
|
deploy-gemini:
|
||||||
rsync $(RSYNCFLAGS) --exclude '*.html' --exclude '*.xml' --exclude '*.gz' --exclude '*.br' --exclude-from .rsyncignore $(OUTPUT_DIR)/gemini/ $(OUTPUT_DIR)/about $(OUTPUT_DIR)/posts $(OUTPUT_DIR)/publickey.* $(GEMINI_RSYNC_DEST)/ --delete
|
rsync $(RSYNCFLAGS) --exclude '*.html' --exclude '*.xml' --exclude '*.gz' --exclude '*.br' --exclude-from .rsyncignore $(OUTPUT_DIR)/gemini/ $(OUTPUT_DIR)/about $(OUTPUT_DIR)/posts $(OUTPUT_DIR)/publickey.* $(GEMINI_RSYNC_DEST)/ --delete
|
||||||
rsync $(RSYNCFLAGS) $(OUTPUT_DIR)/posts/gemini.xml $(GEMINI_RSYNC_DEST)/feed.xml
|
rsync $(RSYNCFLAGS) $(OUTPUT_DIR)/posts/gemini.xml $(GEMINI_RSYNC_DEST)/feed.xml
|
||||||
|
|
||||||
|
@ -110,3 +112,30 @@ test-staging: deploy-html
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: test deploy
|
all: test deploy
|
||||||
|
|
||||||
|
.PHONY: deploy-envs
|
||||||
|
deploy-envs:
|
||||||
|
@$(MAKE) NO_STATIC=1 HUGO_FLAGS='--gc' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs hugo
|
||||||
|
@$(MAKE) NO_STATIC=1 HUGO_FLAGS='--gc' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs deploy
|
||||||
|
|
||||||
|
.PHONY: deploy-prod
|
||||||
|
deploy-prod:
|
||||||
|
@$(MAKE) clean
|
||||||
|
@$(MAKE) hugo
|
||||||
|
@$(MAKE) compress
|
||||||
|
@$(MAKE) deploy
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: deploy-staging
|
||||||
|
deploy-staging:
|
||||||
|
@$(MAKE) HUGO_BASEURL=https://staging.seirdy.one HUGO_FLAGS='--gc' DOMAIN=staging.seirdy.one USER=deploy@seirdy.one OUTPUT_DIR=public_staging clean
|
||||||
|
@$(MAKE) HUGO_BASEURL=https://staging.seirdy.one HUGO_FLAGS='--gc' DOMAIN=staging.seirdy.one USER=deploy@seirdy.one OUTPUT_DIR=public_staging hugo
|
||||||
|
@$(MAKE) HUGO_BASEURL=https://staging.seirdy.one HUGO_FLAGS='--gc' DOMAIN=staging.seirdy.one USER=deploy@seirdy.one OUTPUT_DIR=public_staging lint-local compress
|
||||||
|
@$(MAKE) HUGO_BASEURL=https://staging.seirdy.one HUGO_FLAGS='--gc' DOMAIN=staging.seirdy.one USER=deploy@seirdy.one OUTPUT_DIR=public_staging deploy
|
||||||
|
|
||||||
|
.PHONY: deploy-onion
|
||||||
|
deploy-onion:
|
||||||
|
@$(MAKE) WWW_ROOT=/var/www/seirdy.onion HUGO_BASEURL='http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/' OUTPUT_DIR=public_onion clean
|
||||||
|
@$(MAKE) WWW_ROOT=/var/www/seirdy.onion HUGO_BASEURL='http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/' OUTPUT_DIR=public_onion hugo
|
||||||
|
@$(MAKE) WWW_ROOT=/var/www/seirdy.onion HUGO_BASEURL='http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/' OUTPUT_DIR=public_onion compress
|
||||||
|
@$(MAKE) WWW_ROOT=/var/www/seirdy.onion HUGO_BASEURL='http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/' OUTPUT_DIR=public_onion deploy-html
|
||||||
|
|
Loading…
Reference in a new issue