-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
109 lines (89 loc) · 2.72 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
SNAP_FILE = $(shell ls -1t *.snap | head -1)
LXD_NAME = $(shell lxc list --project snapcraft snapcraft-immich-distribution -cn -f csv)
all: build install
:
.PHONY: build
build:
snapcraft
.PHONY: try
try:
snapcraft try --debug --verbosity debug
sudo snap try prime
.PHONY: shell
shell:
lxc start --project snapcraft ${LXD_NAME} || :
lxc shell --project snapcraft ${LXD_NAME}
.PHONY: install
install:
sudo snap install --dangerous ${SNAP_FILE}
.PHONY: remove
remove:
sudo snap remove --purge immich-distribution
testprod:
cat ${SNAP_FILE} | ssh d -- lxc file push - immich-prod/root/${SNAP_FILE}
ssh d lxc exec immich-prod -- snap install --dangerous /root/${SNAP_FILE}
#
# To run the tests:
# - Make sure that the selenium container is running.
# - Install the package locally (or inside the Incus VM).
# - Run "make tests".
#
.PHONY: tests
tests:
make -C tests test
.PHONY: cleantests
cleantests:
sudo snap remove --purge immich-distribution
make install
make -C tests test
.PHONY: selenium
selenium:
make -C tests/ selenium
#
# Run the documentation site locally with poetry.
#
.PHONY: docs
docs:
cd docs && poetry run mkdocs serve
#
# Incus based build environment, can be used if you have Incus installed, and not
# the needed tooling to build snaps locally. This will create an Ubuntu 22.04 VM
# with the needed tooling and build the snap there. The current directory will be
# mounted into the VM at /build.
#
# Execute "make incus-setup" to setup the VM, "make incus-build" to build the snap
# and "make incus-destroy" to remove the VM.
#
# Prefix a make target with "incus-" to run it inside the VM.
#
.PHONY: incus-setup
incus-setup:
incus init images:ubuntu/22.04 immich-distribution --vm -c limits.memory=6GiB -d root,size=30GiB
incus config device add immich-distribution build disk source=${PWD} path=/build
incus start immich-distribution
sleep 30 # wait for the VM to boot
incus exec immich-distribution -- sudo apt update
incus exec immich-distribution -- sudo apt install snapd podman make python3.10-venv curl git jq -y
sleep 10 # wait snapd to start
incus exec immich-distribution -- sudo snap install --classic snapcraft
incus exec immich-distribution -- sudo snap install lxd
incus exec immich-distribution -- sudo lxd init --auto
incus-%:
incus exec immich-distribution -- bash -c 'cd /build && make $*'
.PHONY: incus-destroy
incus-destroy:
incus delete -f immich-distribution
#
# This will remove remove/purge the local installation.
#
.PHONY: reset
reset:
@echo "This will purge and clean the local installation in 5 seconds ..."
sleep 5
make clean
sudo snap remove --purge immich-distribution
sudo rm -rf prime
.PHONY: clean
clean:
snapcraft clean || true
rm -rf SNAP_COMMON tests/latest_logs/ *.snap