Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 7 additions & 17 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,22 @@ updates:
patterns:
- "*"

- package-ecosystem: 'pip'
directory: '/'
schedule:
interval: 'monthly'
open-pull-requests-limit: 99
groups:
all-pip-packages:
patterns:
- "*"

- package-ecosystem: "npm"
- package-ecosystem: "docker"
directory: '/'
schedule:
interval: 'monthly'
open-pull-requests-limit: 99
interval: "monthly"
open-pull-requests-limit: 10
groups:
all-javascript-packages:
docker-updates:
patterns:
- "*"

- package-ecosystem: "docker"
directory: '/'
- package-ecosystem: "julia"
directory: '/julia'
schedule:
interval: "monthly"
open-pull-requests-limit: 10
groups:
docker-updates:
julia-packages:
patterns:
- "*"
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.12
python-version: '3.12'
- run: pip install PyGithub semver
- run: make publish
- run: python bin/publish.py
env:
DOCKER_IMAGE: ghcr.io/juliaregistries/tagbot
DOCKER_USERNAME: christopher-dG
Expand Down
134 changes: 110 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,124 @@ on:
pull_request:
jobs:
test:
name: Julia ${{ matrix.version }}
runs-on: ubuntu-latest
env:
COLUMNS: 200
strategy:
fail-fast: false
matrix:
version:
- '1'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
python-version: 3.12
- run: pip install poetry
- run: poetry install
- run: poetry run make test
version: ${{ matrix.version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-runtest@v1
with:
project: julia
coverage: true
- uses: julia-actions/julia-processcoverage@v1
with:
directories: julia/src
- uses: codecov/codecov-action@v4
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false

docker:
runs-on: ubuntu-latest
env:
COLUMNS: 200
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t tagbot:test .
- name: Install dependencies
- name: Test Docker image loads
run: |
docker run --name tagbot-deps --mount type=bind,source=$(pwd),target=/repo tagbot:test sh -c '
pip install poetry && cd /repo && poetry install'
docker commit tagbot-deps tagbot:ready
docker rm tagbot-deps
- name: Run pytest
run: docker run --rm --mount type=bind,source=$(pwd),target=/repo tagbot:ready sh -c 'cd /repo && poetry run make pytest'
- name: Run black
run: docker run --rm --mount type=bind,source=$(pwd),target=/repo tagbot:ready sh -c 'cd /repo && poetry run make black'
- name: Run flake8
run: docker run --rm --mount type=bind,source=$(pwd),target=/repo tagbot:ready sh -c 'cd /repo && poetry run make flake8'
- name: Run mypy
run: docker run --rm --mount type=bind,source=$(pwd),target=/repo tagbot:ready sh -c 'cd /repo && poetry run make mypy'
docker run --rm tagbot:test julia --color=yes --project=/app -e '
using TagBot
println("TagBot v", TagBot.VERSION, " loaded successfully")'
- name: Run tests in Docker
run: |
docker run --rm tagbot:test julia --color=yes --project=/app -e '
using Pkg
Pkg.test()'
- name: Run Docker integration test
env:
INPUT_TOKEN: ${{ github.token }}
run: |
# Clone Example.jl - a small, stable, registered package
git clone --depth=100 https://github.com/JuliaLang/Example.jl.git /tmp/Example.jl

# Run TagBot in the Docker container exactly as action.yml would
# (same CMD, same env vars GitHub Actions sets)
docker run --rm \
-v /tmp/Example.jl:/github/workspace:ro \
-e GITHUB_ACTIONS=true \
-e GITHUB_WORKSPACE=/github/workspace \
-e GITHUB_REPOSITORY=JuliaLang/Example.jl \
-e INPUT_TOKEN="${INPUT_TOKEN}" \
-e INPUT_REGISTRY=JuliaRegistries/General \
-e INPUT_SSH= \
-e INPUT_GPG= \
-e INPUT_DRAFT=false \
-e INPUT_BRANCHES=false \
-e INPUT_DISPATCH=false \
-e INPUT_DISPATCH_DELAY=5 \
-e INPUT_USER=github-actions[bot] \
-e INPUT_EMAIL=41898282+github-actions[bot]@users.noreply.github.com \
tagbot:test

# The container runs `julia -e "using TagBot; TagBot.main()"` by default
# For Example.jl (fully tagged), it should exit successfully with "No new versions"

integration:
name: Integration Test (Example.jl)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
with:
project: julia
- name: Clone test package (Example.jl)
run: git clone --depth=100 https://github.com/JuliaLang/Example.jl.git /tmp/Example.jl
- name: Run TagBot main() like action.yml does
env:
GITHUB_ACTIONS: true
GITHUB_WORKSPACE: /tmp/Example.jl
INPUT_TOKEN: ${{ github.token }}
INPUT_REGISTRY: JuliaRegistries/General
INPUT_SSH: ''
INPUT_GPG: ''
INPUT_DRAFT: 'false'
INPUT_BRANCHES: 'false'
INPUT_DISPATCH: 'false'
INPUT_DISPATCH_DELAY: '5'
INPUT_USER: github-actions[bot]
INPUT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: |
cd julia
# Override GitHub's built-in GITHUB_REPOSITORY for testing
export GITHUB_REPOSITORY=JuliaLang/Example.jl
julia --color=yes --project=. -e '
using TagBot

println("="^60)
println("Integration Test - Running TagBot.main()")
println("="^60)
println("Repository: ", ENV["GITHUB_REPOSITORY"])
println("Registry: ", ENV["INPUT_REGISTRY"])
println()

# Run the actual main() function - same as Docker CMD
TagBot.main()

println()
println("="^60)
println("✅ TagBot.main() completed successfully")
println("="^60)
'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ htmlcov/
node_modules/
requirements.txt
tagbot.egg-info/
.venv/
.venv/
julia/Manifest.toml
37 changes: 17 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
FROM python:3.14-slim as builder

RUN apt-get update && apt-get install -y curl

# Install Poetry (latest) using the official install script
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="/root/.local/bin:$PATH"
FROM julia:1.12
LABEL org.opencontainers.image.source https://github.com/JuliaRegistries/TagBot

RUN poetry self add poetry-plugin-export
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
gnupg \
openssh-client \
&& rm -rf /var/lib/apt/lists/*

COPY pyproject.toml .
COPY poetry.lock .
RUN poetry export --format requirements.txt --output /root/requirements.txt
# Set up Julia environment
WORKDIR /app
COPY julia/Project.toml ./
COPY julia/src ./src
COPY julia/test ./test
RUN julia --color=yes --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'

FROM python:3.14-slim
LABEL org.opencontainers.image.source https://github.com/JuliaRegistries/TagBot
ENV PYTHONPATH /root
RUN apt-get update && apt-get install -y git gnupg make openssh-client
COPY --from=builder /root/requirements.txt /root/requirements.txt
RUN pip install --no-cache-dir --requirement /root/requirements.txt
COPY action.yml /root/action.yml
COPY tagbot /root/tagbot
CMD python -m tagbot.action
# Set entrypoint
ENV JULIA_PROJECT=/app
CMD ["julia", "--project=/app", "-e", "using TagBot; TagBot.main()"]
27 changes: 11 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
.PHONY: test test-docker publish pytest black flake8 mypy
.PHONY: test test-web docker publish

# Run Julia tests
test:
./bin/test.sh
cd julia && julia --color=yes --project=. -e 'using Pkg; Pkg.test()'

test-docker:
./bin/test-docker.sh
# Run Python web service tests
test-web:
cd test/web && python -m pytest

pytest:
python -m pytest --cov tagbot --ignore node_modules

black:
black --check bin stubs tagbot test

flake8:
flake8 bin tagbot test

mypy:
mypy --strict bin tagbot
# Build Docker image
docker:
docker build -t tagbot:test .

# Publish release (run from CI)
publish:
./bin/publish.py
python bin/publish.py
19 changes: 9 additions & 10 deletions bin/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ def configure_ssh() -> None:
def on_workflow_dispatch(version: str) -> None:
semver = resolve_version(version)
if semver.build is not None or semver.prerelease is not None:
# TODO: It might actually be nice to properly support prereleases.
raise ValueError("Only major, minor, and patch components should be set")
update_pyproject_toml(semver)
update_project_toml(semver)
update_action_yml(semver)
branch = git_push(semver)
repo = GH.get_repo(REPO)
Expand Down Expand Up @@ -74,23 +73,23 @@ def resolve_version(bump: str) -> VersionInfo:


def current_version() -> VersionInfo:
with open(repo_file("pyproject.toml")) as f:
pyproject = f.read()
m = re.search(r'version = "(.*)"', pyproject)
with open(repo_file("julia", "Project.toml")) as f:
project = f.read()
m = re.search(r'version = "(.*)"', project)
if not m:
raise ValueError("Invalid pyproject.toml")
raise ValueError("Invalid julia/Project.toml")
return VersionInfo.parse(m[1])


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


def update_pyproject_toml(version: VersionInfo) -> None:
path = repo_file("pyproject.toml")
def update_project_toml(version: VersionInfo) -> None:
path = repo_file("julia", "Project.toml")
with open(path) as f:
pyproject = f.read()
updated = re.sub(r"version = .*", f'version = "{version}"', pyproject, count=1)
project = f.read()
updated = re.sub(r'version = ".*"', f'version = "{version}"', project, count=1)
with open(path, "w") as f:
f.write(updated)

Expand Down
10 changes: 0 additions & 10 deletions bin/test-docker.sh

This file was deleted.

23 changes: 0 additions & 23 deletions bin/test.sh

This file was deleted.

Loading
Loading