Skip to content

Commit 3d024c0

Browse files
committed
improved runner
1 parent 6dfd614 commit 3d024c0

File tree

6 files changed

+228
-59
lines changed

6 files changed

+228
-59
lines changed

.justfile

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,33 @@ gh: gh-fmt gh-clippy gh-test
6262

6363
# Docker stuff
6464

65-
debian:
65+
docker-debian:
6666
docker build -f scripts/Dockerfile-debian -t aoc-debian scripts/
67-
docker run --rm -ti -v $PWD:/aoc -w /aoc aoc-debian
6867

69-
fedora:
68+
docker-fedora:
7069
docker build -f scripts/Dockerfile-fedora -t aoc-fedora scripts/
71-
docker run --rm -ti -v $PWD:/aoc -w /aoc aoc-fedora
7270

73-
alpine:
71+
docker-alpine:
7472
docker build -f scripts/Dockerfile-alpine -t aoc-alpine scripts/
73+
74+
debian: docker-debian
75+
docker run --rm -ti -v $PWD:/aoc -w /aoc aoc-debian
76+
77+
fedora: docker-fedora
78+
docker run --rm -ti -v $PWD:/aoc -w /aoc aoc-fedora
79+
80+
alpine: docker-alpine
7581
docker run --rm -ti -v $PWD:/aoc -w /aoc aoc-alpine
7682

7783
docker-aor:
7884
docker build -t aor --target aor -f scripts/Dockerfile .
7985

8086
docker-aoc:
81-
docker build -t aoc --target aoc -f scripts/Dockerfile .
87+
docker build -t aoc --target aoc -f scripts/Dockerfile .
88+
89+
docker-images: docker-debian docker-fedora docker-alpine docker-aor docker-aoc
90+
docker image save aoc-debian -o aoc-debian.tar
91+
docker image save aoc-fedora -o aoc-fedora.tar
92+
docker image save aoc-alpine -o aoc-alpine.tar
93+
docker image save aor -o aor.tar
94+
docker image save aoc -o aoc.tar

scripts/Dockerfile-fedora

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ RUN dnf install -y java-latest-openjdk-devel || true
3636

3737
# Python and virtualenvs
3838
ENV PATH="/root/.local/bin:$PATH"
39-
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
39+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
40+
uv python install 3.11 3.12 3.13 3.14
4041

4142
# User environment
4243
ENV Z3_SYS_Z3_HEADER=/usr/include/z3/z3.h

scripts/answers.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,17 @@ def __init__(self, cookie_session, force_update=False, dry_run=False) -> None:
6161
(self.rootdir / "data").mkdir(exist_ok=True, parents=True)
6262
self.force_update = force_update
6363
self.dry_run = dry_run
64-
self.db = sqlite3.connect(self.rootdir / "data" / "cache.db")
64+
65+
if "AOC_TARGET_DIR" in os.environ:
66+
cache_file = Path(os.environ["AOC_TARGET_DIR"]) / "cache.db"
67+
else:
68+
cache_file = self.rootdir / "data" / "cache.db"
69+
if not cache_file.is_file():
70+
print(f"Database {cache_file} does not exist.")
71+
exit(1)
72+
73+
self.db = sqlite3.connect(cache_file)
74+
6575
self.always_submit = False
6676

6777
self.db.executescript(
@@ -610,7 +620,6 @@ def parse(self, year, _day):
610620
bonus = defaultdict(list)
611621

612622
for year, day, stars, title, sols in puzzles:
613-
614623
if any(f.suffix == ".rs" and f.parent.name == f.stem for f in sols):
615624
rust[year] += 1
616625

0 commit comments

Comments
 (0)