make a half-baked tarball (#221)

* make a half-baked tarball

Closes #217

Signed-off-by: Xe Iaso <me@xeiaso.net>

* make two tarballs: one with just the vendor, and one with vendor and npm

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso 2025-04-06 08:44:52 -04:00 committed by GitHub
parent f1f8fdf752
commit df27a96f1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 77 additions and 5 deletions

View File

@ -64,7 +64,7 @@ jobs:
- name: Build Packages
run: |
wget https://github.com/Xe/x/releases/download/v1.13.3/yeet_1.13.3_amd64.deb -O var/yeet.deb
wget https://github.com/Xe/x/releases/download/v1.13.4/yeet_1.13.4_amd64.deb -O var/yeet.deb
sudo apt -y install -f ./var/yeet.deb
yeet

View File

@ -66,7 +66,7 @@ jobs:
- name: Build Packages
run: |
wget https://github.com/Xe/x/releases/download/v1.13.3/yeet_1.13.3_amd64.deb -O var/yeet.deb
wget https://github.com/Xe/x/releases/download/v1.13.4/yeet_1.13.4_amd64.deb -O var/yeet.deb
sudo apt -y install -f ./var/yeet.deb
yeet

View File

@ -1,6 +1,7 @@
NODE_MODULES = node_modules
VERSION := $(shell cat ./VERSION)
.PHONY: build assets deps lint test
.PHONY: build assets deps lint prebaked-build test
assets:
npm run assets
@ -19,5 +20,8 @@ lint:
go vet ./...
go tool staticcheck ./...
prebaked-build:
go build -o ./var/anubis -ldflags "-X 'github.com/TecharoHQ/anubis.Version=$(VERSION)'" ./cmd/anubis
test:
npm run test

1
doc/VERSION Normal file
View File

@ -0,0 +1 @@
1.15.1

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
- Added support for native Debian, Red Hat, and tarball packaging strategies including installation and use directions.
- A prebaked tarball has been added, allowing distros to build Anubis like they could in v1.15.x.
- The placeholder Anubis mascot has been replaced with a design by [CELPHASE](https://bsky.app/profile/celphase.bsky.social).
- Allow iMessage's link preview fetcher through Anubis by default.
- Added a periodic cleanup routine for the decaymap that removes expired entries, ensuring stale data is properly pruned.

View File

@ -8,7 +8,11 @@ These instructions may work, but for right now they are informative for downstre
:::
## Tools needed
## Entirely from source
If you are doing a build entirely from source, here's what you need to do:
### Tools needed
In order to build a production-ready binary of Anubis, you need the following packages in your environment:
@ -50,6 +54,23 @@ make build
From this point it is up to you to make sure that `./var/anubis` ends up in the right place. You may want to consult the `./run` folder for useful files such as a systemd unit and `anubis.env.default` file.
## "Pre-baked" tarball
The `anubis-src-with-vendor` tarball has many pre-build steps already done, including:
- Go module dependencies are present in `./vendor`
- Static assets (JS, CSS, etc.) are already built in CI
This means you do not have to manage Go, NPM, or other ecosystem dependencies.
When using this tarball, all you need to do is build `./cmd/anubis`:
```text
make prebaked-build
```
Anubis will be built to `./var/anubis`.
## Development dependencies
Optionally, you can install the following dependencies for development:

View File

@ -69,7 +69,7 @@ Install `yeet`:
:::
```text
go install within.website/x/cmd/yeet@v1.13.3
go install within.website/x/cmd/yeet@v1.13.4
```
Install the dependencies for Anubis:

View File

@ -24,4 +24,49 @@ $`npm run assets`;
file.install("./run/default.env", `${etc}/default.env`);
},
}));
});
// NOTE(Xe): Fixes #217. This is a "half baked" tarball that includes the harder
// parts for deterministic distros already done. Distributions like NixOS, Gentoo
// and *BSD ports have a difficult time fitting the square peg of their dependency
// model into the bazarr of round holes that various modern languages use. Needless
// to say, this makes adoption easier.
tarball.build({
name: "anubis-src-vendor",
license: "MIT",
// XXX(Xe): This is needed otherwise go will be very sad.
platform: yeet.goos,
goarch: yeet.goarch,
build: ({ out }) => {
// prepare clean checkout in $out
$`git archive --format=tar HEAD | tar xC ${out}`;
// vendor Go dependencies
$`cd ${out} && go mod vendor`;
// write VERSION file
$`echo ${git.tag()} > ${out}/VERSION`;
},
mkFilename: ({ name, version }) => `${name}-${version}`,
});
tarball.build({
name: "anubis-src-vendor-npm",
license: "MIT",
// XXX(Xe): This is needed otherwise go will be very sad.
platform: yeet.goos,
goarch: yeet.goarch,
build: ({ out }) => {
// prepare clean checkout in $out
$`git archive --format=tar HEAD | tar xC ${out}`;
// vendor Go dependencies
$`cd ${out} && go mod vendor`;
// build NPM-bound dependencies
$`cd ${out} && npm ci && npm run assets && rm -rf node_modules`
// write VERSION file
$`echo ${git.tag()} > ${out}/VERSION`;
},
mkFilename: ({ name, version }) => `${name}-${version}`,
});