Skip to content

Commit 0c4f366

Browse files
WIP: Port to julia
Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8b900a8 commit 0c4f366

59 files changed

Lines changed: 5831 additions & 9768 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,22 @@ updates:
1010
patterns:
1111
- "*"
1212

13-
- package-ecosystem: 'pip'
14-
directory: '/'
15-
schedule:
16-
interval: 'monthly'
17-
open-pull-requests-limit: 99
18-
groups:
19-
all-pip-packages:
20-
patterns:
21-
- "*"
22-
23-
- package-ecosystem: "npm"
13+
- package-ecosystem: "docker"
2414
directory: '/'
2515
schedule:
26-
interval: 'monthly'
27-
open-pull-requests-limit: 99
16+
interval: "monthly"
17+
open-pull-requests-limit: 10
2818
groups:
29-
all-javascript-packages:
19+
docker-updates:
3020
patterns:
3121
- "*"
3222

33-
- package-ecosystem: "docker"
34-
directory: '/'
23+
- package-ecosystem: "julia"
24+
directory: '/julia'
3525
schedule:
3626
interval: "monthly"
3727
open-pull-requests-limit: 10
3828
groups:
39-
docker-updates:
29+
julia-packages:
4030
patterns:
4131
- "*"

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
- uses: actions/checkout@v6
2525
- uses: actions/setup-python@v6
2626
with:
27-
python-version: 3.12
27+
python-version: '3.12'
2828
- run: pip install PyGithub semver
29-
- run: make publish
29+
- run: python bin/publish.py
3030
env:
3131
DOCKER_IMAGE: ghcr.io/juliaregistries/tagbot
3232
DOCKER_USERNAME: christopher-dG

.github/workflows/test.yml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,43 @@ on:
66
pull_request:
77
jobs:
88
test:
9+
name: Julia ${{ matrix.version }}
910
runs-on: ubuntu-latest
10-
env:
11-
COLUMNS: 200
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
version:
15+
- '1'
1216
steps:
13-
- uses: actions/checkout@v6
14-
- uses: actions/setup-python@v6
17+
- uses: actions/checkout@v4
18+
- uses: julia-actions/setup-julia@v2
1519
with:
16-
python-version: 3.12
17-
- run: pip install poetry
18-
- run: poetry install
19-
- run: poetry run make test
20+
version: ${{ matrix.version }}
21+
- uses: julia-actions/cache@v2
22+
- uses: julia-actions/julia-buildpkg@v1
23+
with:
24+
project: julia
25+
- uses: julia-actions/julia-runtest@v1
26+
with:
27+
project: julia
28+
coverage: true
29+
- uses: julia-actions/julia-processcoverage@v1
30+
with:
31+
directories: julia/src
32+
- uses: codecov/codecov-action@v4
33+
with:
34+
files: lcov.info
35+
token: ${{ secrets.CODECOV_TOKEN }}
36+
fail_ci_if_error: false
37+
2038
docker:
2139
runs-on: ubuntu-latest
22-
env:
23-
COLUMNS: 200
2440
steps:
25-
- uses: actions/checkout@v6
41+
- uses: actions/checkout@v4
2642
- name: Build Docker image
2743
run: docker build -t tagbot:test .
28-
- name: Install dependencies
44+
- name: Test Docker image
2945
run: |
30-
docker run --name tagbot-deps --mount type=bind,source=$(pwd),target=/repo tagbot:test sh -c '
31-
pip install poetry && cd /repo && poetry install'
32-
docker commit tagbot-deps tagbot:ready
33-
docker rm tagbot-deps
34-
- name: Run pytest
35-
run: docker run --rm --mount type=bind,source=$(pwd),target=/repo tagbot:ready sh -c 'cd /repo && poetry run make pytest'
36-
- name: Run black
37-
run: docker run --rm --mount type=bind,source=$(pwd),target=/repo tagbot:ready sh -c 'cd /repo && poetry run make black'
38-
- name: Run flake8
39-
run: docker run --rm --mount type=bind,source=$(pwd),target=/repo tagbot:ready sh -c 'cd /repo && poetry run make flake8'
40-
- name: Run mypy
41-
run: docker run --rm --mount type=bind,source=$(pwd),target=/repo tagbot:ready sh -c 'cd /repo && poetry run make mypy'
42-
43-
46+
docker run --rm tagbot:test julia --project=/app -e '
47+
using TagBot
48+
println("TagBot v", TagBot.VERSION, " loaded successfully")'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ htmlcov/
88
node_modules/
99
requirements.txt
1010
tagbot.egg-info/
11-
.venv/
11+
.venv/
12+
julia/Manifest.toml

Dockerfile

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
FROM python:3.14-slim as builder
2-
3-
RUN apt-get update && apt-get install -y curl
1+
FROM julia:1.12
2+
LABEL org.opencontainers.image.source https://github.com/JuliaRegistries/TagBot
43

5-
# Install Poetry (latest) using the official install script
6-
RUN curl -sSL https://install.python-poetry.org | python3 -
7-
ENV PATH="/root/.local/bin:$PATH"
4+
# Install system dependencies
5+
RUN apt-get update && apt-get install -y --no-install-recommends \
6+
git \
7+
gnupg \
8+
openssh-client \
9+
&& rm -rf /var/lib/apt/lists/*
810

9-
RUN poetry self add poetry-plugin-export
11+
# Set up Julia environment
12+
WORKDIR /app
13+
COPY julia/Project.toml julia/Manifest.toml ./
14+
RUN julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'
1015

11-
COPY pyproject.toml .
12-
COPY poetry.lock .
13-
RUN poetry export --format requirements.txt --output /root/requirements.txt
16+
# Copy source code
17+
COPY julia/src ./src
1418

15-
FROM python:3.14-slim
16-
LABEL org.opencontainers.image.source https://github.com/JuliaRegistries/TagBot
17-
ENV PYTHONPATH /root
18-
RUN apt-get update && apt-get install -y git gnupg make openssh-client
19-
COPY --from=builder /root/requirements.txt /root/requirements.txt
20-
RUN pip install --no-cache-dir --requirement /root/requirements.txt
21-
COPY action.yml /root/action.yml
22-
COPY tagbot /root/tagbot
23-
CMD python -m tagbot.action
19+
# Set entrypoint
20+
ENV JULIA_PROJECT=/app
21+
CMD ["julia", "--project=/app", "-e", "using TagBot; TagBot.main()"]

Makefile

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
.PHONY: test test-docker publish pytest black flake8 mypy
1+
.PHONY: test test-web docker publish
22

3+
# Run Julia tests
34
test:
4-
./bin/test.sh
5+
cd julia && julia --project=. -e 'using Pkg; Pkg.test()'
56

6-
test-docker:
7-
./bin/test-docker.sh
7+
# Run Python web service tests
8+
test-web:
9+
cd test/web && python -m pytest
810

9-
pytest:
10-
python -m pytest --cov tagbot --ignore node_modules
11-
12-
black:
13-
black --check bin stubs tagbot test
14-
15-
flake8:
16-
flake8 bin tagbot test
17-
18-
mypy:
19-
mypy --strict bin tagbot
11+
# Build Docker image
12+
docker:
13+
docker build -t tagbot:test .
2014

15+
# Publish release (run from CI)
2116
publish:
22-
./bin/publish.py
17+
python bin/publish.py

bin/publish.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ def configure_ssh() -> None:
4242
def on_workflow_dispatch(version: str) -> None:
4343
semver = resolve_version(version)
4444
if semver.build is not None or semver.prerelease is not None:
45-
# TODO: It might actually be nice to properly support prereleases.
4645
raise ValueError("Only major, minor, and patch components should be set")
47-
update_pyproject_toml(semver)
46+
update_project_toml(semver)
4847
update_action_yml(semver)
4948
branch = git_push(semver)
5049
repo = GH.get_repo(REPO)
@@ -74,23 +73,23 @@ def resolve_version(bump: str) -> VersionInfo:
7473

7574

7675
def current_version() -> VersionInfo:
77-
with open(repo_file("pyproject.toml")) as f:
78-
pyproject = f.read()
79-
m = re.search(r'version = "(.*)"', pyproject)
76+
with open(repo_file("julia", "Project.toml")) as f:
77+
project = f.read()
78+
m = re.search(r'version = "(.*)"', project)
8079
if not m:
81-
raise ValueError("Invalid pyproject.toml")
80+
raise ValueError("Invalid julia/Project.toml")
8281
return VersionInfo.parse(m[1])
8382

8483

8584
def repo_file(*paths: str) -> str:
8685
return os.path.join(os.path.dirname(__file__), "..", *paths)
8786

8887

89-
def update_pyproject_toml(version: VersionInfo) -> None:
90-
path = repo_file("pyproject.toml")
88+
def update_project_toml(version: VersionInfo) -> None:
89+
path = repo_file("julia", "Project.toml")
9190
with open(path) as f:
92-
pyproject = f.read()
93-
updated = re.sub(r"version = .*", f'version = "{version}"', pyproject, count=1)
91+
project = f.read()
92+
updated = re.sub(r'version = ".*"', f'version = "{version}"', project, count=1)
9493
with open(path, "w") as f:
9594
f.write(updated)
9695

bin/test-docker.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

bin/test.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)