Author SHA1 Message Date
jcabillot ef3ec3ba54 test: pytest suite (31 tests) + lazy config validation + CI pytest job
Lint / hadolint (pull_request) Successful in 28s
CI Shared Jobs / hadolint (pull_request) Successful in 28s
CI Shared Jobs / build-test (pull_request) Successful in 2m33s
CI Shared Jobs / pytest (pull_request) Successful in 2m57s
PR Checks / ci (pull_request) Successful in 3m26s
- src/server.py: CALDAV_DATA_PATH validation moved from import-time to
  _validate_startup_config(), called on __main__ or MCP_ICS_VALIDATE_ON_IMPORT=1.
  Module is now importable in tests without env setup.
- tests/: Radicale fixture tree (VCALENDAR/VADDRESSBOOK, hidden dirs, corrupt
  props, bad ics), covers discover_calendars, parse_ics_files, component_to_dt,
  format_dt, format_component (exclude/birthday filters, VEVENT vs VTODO shape),
  get_events_in_range (RRULE expansion, cross-calendar aggregation, sort),
  get_agenda (default +7d end, error dict, flag forwarding), /health endpoint,
  _validate_startup_config. 31 tests, <2s.
- .gitea/workflows/_ci-common.yaml: new pytest job running the test suite
  inside the built CI image (prod requirements).
- pkg/Dockerfile: COPY tests/
2026-10-09 00:06:27 +00:00
jcabillot 70d7306129 Merge pull request 'ci: align pipeline on web/mydl pattern (real docker tags)' (#27) from ci/align-mydl into main
CI Shared Jobs / hadolint (push) Successful in 33s
CI Shared Jobs / build-test (push) Successful in 1m10s
Main Release / ci (push) Successful in 1m12s
Main Release / build (push) Successful in 1m14s
Main Release / tag (push) Successful in 55s
CI Shared Jobs / hadolint (push) Successful in 20s
Renovate / renovate (push) Successful in 3m46s
CI Shared Jobs / build-test (push) Successful in 2m40s
Tag Release / ci (push) Successful in 2m44s
Tag Release / build-push (push) Successful in 2m18s
Reviewed-on: #27
2026-10-08 16:54:00 -04:00
OpenCode Cabillot 155178c665 ci: smoke test = compileall (server.py raises on import without CALDAV_DATA_PATH)
CI Shared Jobs / hadolint (pull_request) Successful in 41s
CI Shared Jobs / build-test (pull_request) Successful in 3m38s
PR Checks / ci (pull_request) Successful in 4m40s
2026-10-08 20:40:10 +00:00
OpenCode Cabillot b71e470511 ci: align pipeline on web/mydl pattern
CI Shared Jobs / hadolint (pull_request) Successful in 3m43s
CI Shared Jobs / build-test (pull_request) Failing after 4m10s
PR Checks / ci (pull_request) Failing after 4m20s
Split the monolithic docker-build/release/test workflows into the shared
_ci-common.yaml + trigger-specific files used on web/mydl:

- pr.yaml       -> PR checks (hadolint + build smoke test)
- main.yaml     -> CI + local build + git semver tag (PAT, triggers tag.yaml)
- tag.yaml      -> CI + build/push :vX.Y.Z and :vX.Y.Z-latest (sole Docker push)
- cron.yaml     -> nightly rebuild of :vX.Y.Z-latest
- _ci-common.yaml -> hadolint + build-test with docker smoke and GHA cache

Docker pushes to :latest on every merge are replaced by versioned,
tested tags. The tag job uses SA_TOKEN_ACTION_PUSH_TAGS (a PAT) so the
tag push actually triggers tag.yaml - GITHUB_TOKEN would not.
2026-10-08 20:29:23 +00:00
opencodecabilloteu e2a8cd7e90 Merge pull request 'chore(deps): update docker/setup-buildx-action digest to f87e599' (#26) from renovate/docker-setup-buildx-action-digest into main
Release / tag (push) Failing after 11s
Renovate / renovate (push) Successful in 47s
Docker Build and Push / build (push) Successful in 1m31s
2026-09-18 04:32:21 -04:00
renovate b49502bad9 chore(deps): update docker/setup-buildx-action digest to f87e599
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 1m5s
2026-09-18 08:09:56 +00:00
opencodecabilloteu 9177d4a3f5 Merge pull request 'chore(deps): update docker/build-push-action action to v7.4.0' (#25) from renovate/docker-build-push-action-7.x into main
Release / tag (push) Failing after 32s
Docker Build and Push / build (push) Successful in 1m31s
Renovate / renovate (push) Successful in 53s
2026-09-17 05:32:33 -04:00
renovate b18b5ebecf chore(deps): update docker/build-push-action action to v7.4.0
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 1m28s
2026-09-17 09:10:57 +00:00
opencodecabilloteu b95244ffbb Merge pull request 'chore(deps): update hadolint/hadolint-action action to v3.5.0' (#23) from renovate/hadolint-hadolint-action-3.x into main
Release / tag (push) Failing after 19s
Renovate / renovate (push) Successful in 1m23s
Docker Build and Push / build (push) Successful in 2m57s
2026-08-26 11:31:37 -04:00
renovate 3347787857 chore(deps): update hadolint/hadolint-action action to v3.5.0
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 1m56s
2026-08-26 15:13:49 +00:00
opencodecabilloteu 50c3a7ea24 Merge pull request 'chore(deps): update docker/setup-buildx-action digest to 37fe631' (#22) from renovate/docker-setup-buildx-action-digest into main
Renovate / renovate (push) Successful in 1m34s
Docker Build and Push / build (push) Successful in 2m40s
Release / tag (push) Failing after 16s
2026-08-21 06:41:18 -04:00
renovate 03f423a858 chore(deps): update docker/setup-buildx-action digest to 37fe631
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 1m41s
2026-08-21 10:17:49 +00:00
jcabillot 85dcd47168 Merge pull request 'ci: add Renovate workflow' (#21) from add-renovate-workflow into main
Release / tag (push) Failing after 1m26s
Docker Build and Push / build (push) Successful in 9m5s
Renovate / renovate (push) Successful in 4m3s
Reviewed-on: #21
2026-08-03 16:17:43 -04:00
OpenCode Cabillot 8671299adb ci: add Renovate workflow
Test / build (pull_request) Successful in 1m45s
2026-08-02 23:47:12 +00:00
opencodecabilloteu 0a7ab4c0cb Merge pull request 'chore(deps): update hadolint/hadolint-action action to v3.4.0' (#20) from renovate/hadolint-hadolint-action-3.x into main
Release / tag (push) Failing after 28s
Docker Build and Push / build (push) Failing after 12m46s
2026-08-01 16:08:51 -04:00
renovate 7487ffdf75 chore(deps): update hadolint/hadolint-action action to v3.4.0
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 1m18s
2026-08-01 14:10:07 +00:00
Julien Cabillot 57b3449ee4 fix: remove mcp from direct dep
Release / tag (push) Failing after 44s
Docker Build and Push / build (push) Successful in 6m54s
2026-07-30 16:33:49 -04:00
jcabillot ba52a8f203 Merge pull request 'chore(deps): update docker/login-action digest to dbcb813' (#18) from renovate/docker-login-action-digest into main
Docker Build and Push / build (push) Successful in 6m41s
Release / tag (push) Failing after 58s
Reviewed-on: #18
2026-07-29 11:47:33 -04:00
renovate 7b7f5d77e0 chore(deps): update docker/login-action digest to dbcb813
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 3m15s
2026-07-29 13:08:44 +00:00
jcabillot 0b60711fb7 Merge pull request 'chore(deps): update docker/login-action digest to 371161b' (#17) from renovate/docker-login-action-digest into main
Docker Build and Push / build (push) Successful in 1m52s
Release / tag (push) Failing after 43s
Reviewed-on: #17
2026-07-28 16:51:41 -04:00
renovate 0ed421426a chore(deps): update docker/login-action digest to 371161b
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 1m46s
2026-07-28 08:08:39 +00:00
jcabillot b0b71c9316 Merge pull request 'chore(deps): update actions/checkout digest to 3d3c42e' (#16) from renovate/actions-checkout-digest into main
Release / tag (push) Failing after 33s
Docker Build and Push / build (push) Successful in 1m35s
Reviewed-on: #16
Reviewed-by: jcabillot <1+jcabillot@noreply.scm.cabillot.eu>
2026-07-22 08:04:46 -04:00
renovate 3cecb67d11 chore(deps): update actions/checkout digest to 3d3c42e
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 1m19s
2026-07-20 16:08:46 +00:00
jcabillot 7d436fbfe3 Merge pull request 'chore(deps): update docker/login-action digest to af1e73f' (#15) from renovate/docker-login-action-digest into main
Release / tag (push) Failing after 32s
Docker Build and Push / build (push) Successful in 1m53s
Reviewed-on: #15
2026-07-03 16:20:02 -04:00
renovate 87a1ad8fd1 chore(deps): update docker/login-action digest to af1e73f
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 55s
2026-07-03 14:14:50 +00:00
jcabillot a6b132bff2 Merge pull request 'chore(deps): update docker/metadata-action digest to dc80280' (#13) from renovate/docker-metadata-action-digest into main
Release / tag (push) Failing after 15s
Docker Build and Push / build (push) Successful in 2m11s
Reviewed-on: #13
2026-07-02 09:33:35 -04:00
renovate 12dd856a99 chore(deps): update docker/metadata-action digest to dc80280
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 1m29s
2026-07-02 13:32:07 +00:00
jcabillot d181c461e1 Merge pull request 'chore(deps): update docker/login-action digest to c99871d' (#12) from renovate/docker-login-action-digest into main
Release / tag (push) Failing after 12s
Docker Build and Push / build (push) Successful in 1m49s
Reviewed-on: #12
2026-07-02 09:27:12 -04:00
renovate 4f689c7419 chore(deps): update docker/login-action digest to c99871d
renovate/stability-days Updates have met minimum release age requirement
Test / build (pull_request) Successful in 2m50s
2026-07-02 12:42:05 +00:00
opencodecabilloteu 8266b1a725 chore(deps): update docker/setup-buildx-action digest to bb05f3f
Docker Build and Push / build (push) Successful in 4m58s
Release / tag (push) Failing after 13m3s
chore(deps): update docker/setup-buildx-action digest to bb05f3f
2026-07-02 08:36:34 -04:00
renovate 0601476177 chore(deps): update docker/setup-buildx-action digest to bb05f3f
Test / build (pull_request) Successful in 49s
2026-07-02 09:53:43 +00:00
jcabillot 7958d3822b Merge pull request 'chore(deps): update docker/build-push-action action to v7.3.0' (#11) from renovate/docker-build-push-action-7.x into main
Docker Build and Push / build (push) Successful in 3m3s
Release / tag (push) Failing after 12m49s
Reviewed-on: #11
2026-07-01 16:21:03 -04:00
renovate c0fe3d6836 chore(deps): update docker/build-push-action action to v7.3.0
Test / build (pull_request) Successful in 2m26s
2026-07-01 15:11:53 +00:00
jcabillot 58d7bd1c6c Merge pull request 'chore(deps): update actions/checkout action to v7' (#10) from renovate/actions-checkout-7.x into main
Docker Build and Push / build (push) Successful in 1m35s
Release / tag (push) Failing after 11s
Reviewed-on: #10
2026-06-18 16:22:53 -04:00
renovate 539fc904db chore(deps): update actions/checkout action to v7
Test / build (pull_request) Successful in 46s
2026-06-18 15:25:26 +00:00
jcabillot 53ee51ed5b Merge pull request 'CI: standardize workflows' (#9) from fix/workflow-standard into main
Release / tag (push) Failing after 8s
Docker Build and Push / build (push) Successful in 1m37s
Reviewed-on: #9
2026-06-13 22:14:40 -04:00
cloudix_mcp_server 39a4ca84f6 ci: standardize docker-build workflow (push + schedule only)
Test / build (pull_request) Successful in 46s
2026-06-13 21:23:25 -04:00
cloudix_mcp_server a0f023071d ci: add release workflow (semver tagging) 2026-06-13 21:23:15 -04:00
cloudix_mcp_server c0508e7240 ci: add test workflow (docker build verification) 2026-06-13 21:23:12 -04:00
cloudix_mcp_server 34933d49da ci: add lint workflow with hadolint 2026-06-13 21:23:09 -04:00
jcabillot d17bf38f44 Merge pull request 'ci: migrate from Jenkins to Gitea Actions and fix image name' (#8) from fix/refactor-ci-pipelines into main
Docker Build and Push / build (push) Failing after 1m56s
Reviewed-on: #8
2026-06-12 20:21:29 -04:00
cloudix_mcp_server aff2b4d1f6 fix: update docker image from jcabillot/mcp-calday to jcabillot/mcp-ics to match repo name
Docker Build and Push / build (pull_request) Successful in 1m6s
2026-06-12 19:51:59 -04:00
cloudix_mcp_server 16c3e55cc8 chore: remove Jenkinsfile — migrated to Gitea Actions workflow 2026-06-12 19:50:19 -04:00
cloudix_mcp_server fb0472cf7b fix: update docker image from jcabillot/mcp-calday to jcabillot/mcp-ics to match repo name 2026-06-12 19:50:12 -04:00
jcabillot a01330315b Merge pull request 'ci: add automatic semver tagging on merge to main' (#7) from feat/semver-tag-action into main
Docker Build and Push / build (push) Failing after 1m27s
Reviewed-on: #7
2026-06-12 13:42:07 -04:00
cloudix_mcp_server c08f16dbc5 ci: add automatic semver tagging on merge to main
Docker Build and Push / build (pull_request) Successful in 1m0s
2026-06-12 13:19:44 -04:00
15 changed files with 709 additions and 91 deletions

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
name: CI Shared Jobs
on:
workflow_call:
jobs:
hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: hadolint/hadolint-action@06be81baf89a55ffd0e24b8f04a4185738dd3387 # v3.5.0
with:
dockerfile: pkg/Dockerfile
failure-threshold: warning
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- name: Build (cached)
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
file: pkg/Dockerfile
push: false
load: true
tags: ci-image:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Smoke test (compile sanity)
run: docker run --rm --name mcp-ics-smoke-$(hostname) ci-image:${{ github.sha }} python -m compileall -q src/
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- name: Build (cached)
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
file: pkg/Dockerfile
push: false
load: true
tags: ci-image:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Unit tests (pytest, in-image env with prod requirements)
run: >
docker run --rm ci-image:${{ github.sha }}
sh -c "pip install pytest --quiet && python -m pytest tests/ -q"
+46
View File
@@ -0,0 +1,46 @@
name: Nightly Rebuild
on:
schedule:
- cron: '0 0 * * *'
jobs:
ci:
uses: ./.gitea/workflows/_ci-common.yaml
secrets: inherit
build-push:
needs: [ci]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- name: Login to Docker Hub
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: get-latest-tag
name: Get latest tag
run: |
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
echo "tag=$TAG" >> $GITHUB_OUTPUT
- id: meta
name: Docker metadata
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6
with:
images: jcabillot/mcp-ics
tags: |
type=raw,value=${{ steps.get-latest-tag.outputs.tag }}-latest,enable=${{ steps.get-latest-tag.outputs.tag != '' }}
- name: Build and push
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
file: pkg/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
pull: true
cache-from: type=gha
cache-to: type=gha,mode=max
-47
View File
@@ -1,47 +0,0 @@
name: Docker Build and Push
on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6
with:
images: jcabillot/mcp-caldav
tags: |
#type=ref,event=branch
#type=ref,event=pr
#type=sha
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build and push
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
with:
context: .
file: pkg/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
pull: true
+22
View File
@@ -0,0 +1,22 @@
name: Lint
on:
pull_request:
branches: [main]
paths:
- 'pkg/Dockerfile'
- 'Dockerfile'
jobs:
hadolint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: Run hadolint
uses: hadolint/hadolint-action@06be81baf89a55ffd0e24b8f04a4185738dd3387 # v3.5.0
with:
dockerfile: pkg/Dockerfile
+46
View File
@@ -0,0 +1,46 @@
name: Main Release
on:
workflow_dispatch:
push:
branches: [main]
jobs:
ci:
uses: ./.gitea/workflows/_ci-common.yaml
secrets: inherit
build:
needs: [ci]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- name: Build (cached)
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
file: pkg/Dockerfile
push: false
load: true
tags: jcabillot/mcp-ics:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
tag:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: Configure git auth
run: |
git remote set-url origin "https://x-access-token:${{ secrets.SA_TOKEN_ACTION_PUSH_TAGS }}@scm.cabillot.eu/perso/mcp-ics.git"
- name: Bump version and push tag
uses: anothrNick/github-tag-action@4ed44965e0db8dab2b466a16da04aec3cc312fd8 # v1.75.0
env:
GITHUB_TOKEN: ${{ secrets.SA_TOKEN_ACTION_PUSH_TAGS }}
DEFAULT_BUMP: patch
RELEASE_BRANCHES: main
WITH_V: true
GIT_API_TAGGING: false
+12
View File
@@ -0,0 +1,12 @@
name: PR Checks
on:
workflow_dispatch:
pull_request:
branches: [main]
concurrency:
group: pr-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
uses: ./.gitea/workflows/_ci-common.yaml
secrets: inherit
+12
View File
@@ -0,0 +1,12 @@
name: Renovate
on:
push:
branches:
- main
workflow_dispatch:
jobs:
renovate:
uses: perso/gitea-pipelines/.gitea/workflows/renovate.yaml@main
secrets: inherit
+40
View File
@@ -0,0 +1,40 @@
name: Tag Release
on:
push:
tags: ['*']
jobs:
ci:
uses: ./.gitea/workflows/_ci-common.yaml
secrets: inherit
build-push:
needs: [ci]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- name: Login to Docker Hub
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: meta
name: Docker metadata
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6
with:
images: jcabillot/mcp-ics
tags: |
type=ref,event=tag
type=ref,event=tag,suffix=-latest
- name: Build and push
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
file: pkg/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
pull: true
cache-from: type=gha
cache-to: type=gha,mode=max
Vendored
-38
View File
@@ -1,38 +0,0 @@
pipeline {
environment {
registry = 'https://registry.hub.docker.com'
registryCredential = 'dockerhub_jcabillot'
dockerImage = 'jcabillot/mcp-caldav'
}
agent any
triggers {
cron('@midnight')
}
stages {
stage('Clone repository') {
steps{
checkout scm
}
}
stage('Build image') {
steps{
sh 'docker build --force-rm=true --no-cache=true --pull -t ${dockerImage} -f pkg/Dockerfile .'
}
}
stage('Deploy Image') {
steps{
script {
withCredentials([usernamePassword(credentialsId: 'dockerhub_jcabillot', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
sh 'docker login --username ${DOCKER_USER} --password ${DOCKER_PASS}'
sh 'docker push ${dockerImage}'
}
}
}
}
}
}
+3
View File
@@ -16,5 +16,8 @@ RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
# Copy the source code
COPY src/ ./src/
# Copy tests (used by CI; harmless in production)
COPY tests/ ./tests/
# Command to run the MCP server
CMD ["python", "src/server.py"]
+3
View File
@@ -0,0 +1,3 @@
[pytest]
testpaths = tests
addopts = -q
-1
View File
@@ -1,4 +1,3 @@
mcp>=1,<2
fastmcp>=3,<4
python-dotenv>=1,<2
uvicorn>=0.34,<1
+7 -5
View File
@@ -35,13 +35,15 @@ CALDAV_DATA_PATH = os.environ.get("CALDAV_DATA_PATH", "")
EXCLUDE_PATTERN = os.environ.get("EXCLUDE_PATTERN", "")
BIRTHDAY_PATTERN = os.environ.get("BIRTHDAY_PATTERN", r"^Anniversaire|^Anniv")
if not CALDAV_DATA_PATH:
def _validate_startup_config(caldav_data_path: str = CALDAV_DATA_PATH) -> None:
"""Validates required startup configuration, raising on missing values."""
if not caldav_data_path:
raise ValueError("CALDAV_DATA_PATH environment variable is required.")
logger.info("Starting MCP CalDAV server with data path: %s", CALDAV_DATA_PATH)
if EXCLUDE_PATTERN:
logger.info("Exclude pattern: %s", EXCLUDE_PATTERN)
logger.info("Birthday pattern: %s", BIRTHDAY_PATTERN)
if __name__ == "__main__" or os.environ.get("MCP_ICS_VALIDATE_ON_IMPORT") == "1":
_validate_startup_config()
# Compile patterns once at startup
_exclude_re: Optional[re.Pattern] = None
+149
View File
@@ -0,0 +1,149 @@
"""Shared fixtures: a fake Radicale data tree on disk + pre-imported server module."""
import json
import os
import sys
import textwrap
from pathlib import Path
import pytest
REPO_ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO_ROOT / "src"))
def _write(path: Path, content: str) -> Path:
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(content, encoding="utf-8")
return path
def _cal_props(displayname: str = "", description: str = "") -> str:
props = {"tag": "VCALENDAR"}
if displayname:
props["D:displayname"] = displayname
if description:
props["C:calendar-description"] = description
return json.dumps(props)
ICS_HEADER = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//mcp-ics-test//EN\n"
ICS_FOOTER = "END:VCALENDAR\n"
def _ics(body: str) -> str:
return ICS_HEADER + body + ICS_FOOTER
@pytest.fixture(scope="module")
def radicale_tree(tmp_path_factory) -> Path:
"""A minimal Radicale collection-root layout covering edge cases."""
root = tmp_path_factory.mktemp("radicale")
cr = root / "collections" / "collection-root"
# user 'manuel', regular calendar
cal = cr / "manuel" / "perso"
_write(cal / ".Radicale.props", _cal_props("Perso manuel", "Agenda perso"))
_write(
cal / "abc.ics",
ICS_HEADER
+ (
"BEGIN:VEVENT\n"
"UID:evt-1@test\n"
"DTSTAMP:20260101T000000Z\n"
"DTSTART:20260315T090000\n"
"DTEND:20260315T100000\n"
"SUMMARY:Réunion équipe\n"
"LOCATION:Bureau\n"
"DESCRIPTION:Point hebdo\n"
"END:VEVENT\n"
)
+ ICS_FOOTER,
)
# recurring weekly event (10 occurrences)
_write(
cal / "recurring.ics",
ICS_HEADER
+ (
"BEGIN:VEVENT\n"
"UID:evt-rrule@test\n"
"DTSTAMP:20260101T000000Z\n"
"DTSTART:20260302T070000\n"
"DTEND:20260302T080000\n"
"RRULE:FREQ=WEEKLY;COUNT=10\n"
"SUMMARY:Présence matinale\n"
"END:VEVENT\n"
)
+ ICS_FOOTER,
)
# birthday (filtered by default via BIRTHDAY_PATTERN) + excluded summary
_write(
cal / "special.ics",
ICS_HEADER
+ (
"BEGIN:VEVENT\n"
"UID:birth-1@test\n"
"DTSTAMP:20260101T000000Z\n"
"DTSTART;VALUE=DATE:20260410\n"
"SUMMARY:Anniversaire Marc\n"
"END:VEVENT\n"
"BEGIN:VEVENT\n"
"UID:trash-1@test\n"
"DTSTAMP:20260101T000000Z\n"
"DTSTART:20260316T180000\n"
"SUMMARY:Poubelle verte\n"
"END:VEVENT\n"
)
+ ICS_FOOTER,
)
# VTODO on a second calendar
cal2 = cr / "manuel" / "taches"
_write(cal2 / ".Radicale.props", _cal_props("Tâches"))
_write(
cal2 / "todo.ics",
ICS_HEADER
+ (
"BEGIN:VTODO\n"
"UID:todo-1@test\n"
"DTSTAMP:20260101T000000Z\n"
"DUE:20260320T170000\n"
"STATUS:NEEDS-ACTION\n"
"SUMMARY:Ranger le garage\n"
"END:VTODO\n"
)
+ ICS_FOOTER,
)
# user 'robert' with a family calendar
cal3 = cr / "robert" / "famille"
_write(cal3 / ".Radicale.props", _cal_props("Famille"))
_write(cal3 / "x.ics", ICS_HEADER + ICS_FOOTER) # empty calendar
# VADDRESSBOOK (contacts) must be ignored
_write(cr / "robert" / "contacts" / ".Radicale.props", '{"tag": "VADDRESSBOOK"}')
# hidden dirs ignored
(cr / ".stfolder").mkdir(parents=True)
_write(cr / ".stfolder" / "x" / ".Radicale.props", '{"tag": "VCALENDAR"}')
(cr / "manuel" / ".trash").mkdir(parents=True)
_write(cr / "manuel" / ".trash" / "y.ics", ICS_HEADER + ICS_FOOTER)
# corrupt props must be skipped with a warning
_write(cr / "manuel" / "broken" / ".Radicale.props", "{not json")
_write(cr / "manuel" / "broken" / "z.ics", ICS_HEADER + ICS_FOOTER)
return root
@pytest.fixture(scope="module")
def server(radicale_tree):
"""Import the server module once per module with the fixture tree as data path."""
os.environ["CALDAV_DATA_PATH"] = str(radicale_tree)
os.environ["EXCLUDE_PATTERN"] = "^Poubelle"
os.environ["BIRTHDAY_PATTERN"] = "^Anniversaire|^Anniv"
import server # noqa: E402
return server
@pytest.fixture()
def server_mod(server, monkeypatch, radicale_tree):
"""Reset mutable module state around each test."""
monkeypatch.setattr(server, "CALDAV_DATA_PATH", str(radicale_tree))
return server
+313
View File
@@ -0,0 +1,313 @@
"""Unit tests for mcp-ics server (pure functions, no server, no Docker)."""
import calendar as calmod
import logging
from datetime import date, datetime
import icalendar
import pytest
import conftest # noqa: F401 (sys.path setup)
# ---------------------------------------------------------------- discover_calendars
def test_discover_finds_calendars_with_names(server_mod, radicale_tree):
cals = server_mod.discover_calendars(str(radicale_tree))
by_path = {c["path"]: c for c in cals}
assert len(cals) == 3 # perso, taches, famille
assert by_path[str(radicale_tree / "collections/collection-root/manuel/perso")][
"name"
] == "Perso manuel"
assert by_path[str(radicale_tree / "collections/collection-root/manuel/taches")][
"name"
] == "Tâches"
assert by_path[str(radicale_tree / "collections/collection-root/robert/famille")][
"user"
] == "robert"
def test_discover_skips_vaddressbook_hidden_and_broken(server_mod, radicale_tree):
cals = server_mod.discover_calendars(str(radicale_tree))
paths = " ".join(c["path"] for c in cals)
assert "contacts" not in paths
assert ".stfolder" not in paths
assert ".trash" not in paths
assert "broken" not in paths
def test_discover_missing_collection_root(server, tmp_path):
assert server.discover_calendars(str(tmp_path / "nowhere")) == []
def test_discover_empty_path(server):
assert server.discover_calendars("") == []
def test_discover_defaults_displayname_to_dirname(server_mod, radicale_tree):
# taches cal has no explicit name in tree? it does: "Tâches". famille: "Famille".
# Build one WITHOUT displayname.
import json
cal = radicale_tree / "collections/collection-root/manuel/noname"
cal.mkdir(parents=True, exist_ok=True)
(cal / ".Radicale.props").write_text(json.dumps({"tag": "VCALENDAR"}))
try:
cals = server_mod.discover_calendars(str(radicale_tree))
noname = [c for c in cals if c["path"].endswith("noname")][0]
assert noname["name"] == "noname"
finally:
(cal / ".Radicale.props").unlink()
cal.rmdir()
# ---------------------------------------------------------------- parse_ics_files
def test_parse_ics_files_reads_component(server_mod, radicale_tree):
path = radicale_tree / "collections/collection-root/manuel/perso"
cals = server_mod.parse_ics_files(str(path))
assert len(cals) == 3
types = {sub.name for cal in cals for sub in cal.subcomponents}
assert "VEVENT" in types
def test_parse_ics_files_skips_unparseable(server_mod, radicale_tree):
import json
cal = radicale_tree / "collections/collection-root/manuel/badics"
cal.mkdir(parents=True, exist_ok=True)
(cal / ".Radicale.props").write_text(json.dumps({"tag": "VCALENDAR"}))
(cal / "x.ics").write_bytes(b"NOT AN ICS FILE \xff\xfe at all")
cals = server_mod.parse_ics_files(str(cal))
assert cals == []
def test_parse_ics_files_empty_dir(server_mod, radicale_tree):
assert server_mod.parse_ics_files(str(radicale_tree / "does/not/exist")) == []
# ---------------------------------------------------------------- component_to_dt
def test_component_to_dt_datetime_passthrough(server_mod):
dt = datetime(2026, 3, 15, 9, 0)
prop = icalendar.prop.vDatetime(dt)
assert server_mod.component_to_dt(prop) == dt
def test_component_to_dt_date_becomes_midnight(server_mod):
d = date(2026, 4, 10)
prop = icalendar.prop.vDate(d)
assert server_mod.component_to_dt(prop) == datetime(2026, 4, 10, 0, 0)
def test_component_to_dt_none(server_mod):
assert server_mod.component_to_dt(None) is None
assert server_mod.component_to_dt("not-a-date") is None
# ---------------------------------------------------------------- format_dt
def test_format_dt(server_mod):
assert server_mod.format_dt(None) is None
d = date(2026, 4, 10)
assert server_mod.format_dt(d) == "2026-04-10"
dt = datetime(2026, 3, 15, 9, 0)
assert server_mod.format_dt(dt) == dt.isoformat()
# ---------------------------------------------------------------- format_component (filters)
def _ven_event(summary, uid="x@test", dtstart=None):
if dtstart is None:
dtstart = datetime(2026, 3, 15, 9, 0)
ev = icalendar.cal.Event()
ev.add("uid", uid)
ev.add("dtstamp", datetime(2026, 1, 1, tzinfo=__import__("datetime").timezone.utc))
ev.add("dtstart", dtstart)
ev.add("summary", summary)
return ev
class TestFilters:
def test_exclude_pattern_hides_poubelle(self, server_mod):
comp = _ven_event("Poubelle verte")
assert server_mod.format_component(comp, "Perso") is None
def test_birthdays_excluded_by_default(self, server_mod):
comp = _ven_event("Anniversaire Marc", dtstart=date(2026, 4, 10))
assert server_mod.format_component(comp, "Perso") is None
def test_birthdays_included_on_demand(self, server_mod):
comp = _ven_event("Anniversaire Marc", dtstart=date(2026, 4, 10))
out = server_mod.format_component(comp, "Perso", include_birthdays=True)
assert out is not None
assert out["summary"] == "Anniversaire Marc"
def test_normal_event_passes_birthday_filter(self, server_mod):
comp = _ven_event("Réunion équipe")
assert server_mod.format_component(comp, "Perso") is not None
class TestOutput:
def test_event_shape(self, server_mod, radicale_tree):
cal_path = str(radicale_tree / "collections/collection-root/manuel/perso")
found = None
for cal in server_mod.parse_ics_files(cal_path):
for c in cal.subcomponents:
if str(c.get("UID", "")) == "evt-1@test":
found = c
out = server_mod.format_component(found, "Perso manuel")
assert out["type"] == "event"
assert out["summary"] == "Réunion équipe"
assert out["start"] == "2026-03-15T09:00:00"
assert out["end"] == "2026-03-15T10:00:00"
assert out["calendar"] == "Perso manuel"
assert out["uid"] == "evt-1@test"
assert out["location"] == "Bureau"
assert out["description"] == "Point hebdo"
assert "due" not in out
assert "status" not in out
def test_todo_shape(self, server_mod, radicale_tree):
cal_path = str(radicale_tree / "collections/collection-root/manuel/taches")
cal = server_mod.parse_ics_files(cal_path)[0]
todo = [c for c in cal.subcomponents if c.name == "VTODO"][0]
out = server_mod.format_component(todo, "Tâches")
assert out["type"] == "todo"
assert out["due"] == "2026-03-20T17:00:00"
assert out["status"] == "NEEDS-ACTION"
assert "end" not in out
def test_optional_fields_absent_when_empty(self, server_mod):
comp = _ven_event("Sans extras")
out = server_mod.format_component(comp, "C")
assert "location" not in out
assert "description" not in out
# ---------------------------------------------------------------- get_events_in_range
class TestGetEventsInRange:
def test_range_aggregates_and_sorts(self, server_mod):
items = server_mod.get_events_in_range(
datetime(2026, 3, 15), datetime(2026, 3, 21)
)
summaries = [i["summary"] for i in items]
assert "Réunion équipe" in summaries
assert "Ranger le garage" in summaries # DUE 03-20 lands inside the window
# chronological order
starts = [i.get("start") or i.get("due") or "" for i in items]
assert starts == sorted(starts)
def test_rrule_expansion(self, server_mod):
# weekly event DTSTART 2026-03-02, COUNT=10 → occurrences 03-02..05-04
items = server_mod.get_events_in_range(
datetime(2026, 3, 2), datetime(2026, 5, 6)
)
recurring = [i for i in items if i["summary"] == "Présence matinale"]
assert len(recurring) == 10
first_days = sorted(i["start"][:10] for i in recurring)
# every occurrence lands on a Monday (DTSTART was a Monday)
assert all(
calmod.weekday(int(d[:4]), int(d[5:7]), int(d[8:10])) == 0
for d in first_days
)
def test_birthday_only_with_flag(self, server_mod):
r1 = server_mod.get_events_in_range(
datetime(2026, 4, 10), datetime(2026, 4, 11), include_birthdays=False
)
assert all(i["summary"] != "Anniversaire Marc" for i in r1)
r2 = server_mod.get_events_in_range(
datetime(2026, 4, 10), datetime(2026, 4, 11), include_birthdays=True
)
assert any(i["summary"] == "Anniversaire Marc" for i in r2)
def test_calendars_aggregated_across_users(self, server_mod, radicale_tree):
# add an event to robert's calendar and check cross-aggregation
import json
from pathlib import Path
cal_dir = radicale_tree / "collections/collection-root/robert/famille"
ics = cal_dir / "x.ics"
original = ics.read_text()
ics.write_text(
conftest.ICS_HEADER
+ "BEGIN:VEVENT\nUID:fam-1\nDTSTAMP:20260101T000000Z\n"
"DTSTART:20260317T120000\nDTEND:20260317T130000\n"
"SUMMARY:Souper famille\nEND:VEVENT\n"
+ conftest.ICS_FOOTER
)
try:
items = server_mod.get_events_in_range(
datetime(2026, 3, 17), datetime(2026, 3, 18)
)
summaries = {i["summary"]: i for i in items}
assert "Souper famille" in summaries
assert summaries["Souper famille"]["calendar"] == "Famille"
finally:
ics.write_text(original)
# ---------------------------------------------------------------- get_agenda tool
class TestGetAgenda:
def test_end_date_default_plus_7_days(self, server_mod):
out = server_mod.get_agenda("2026-03-15")
assert out["start_date"] == "2026-03-15T00:00:00"
assert out["end_date"] == "2026-03-22T00:00:00"
assert out["count"] == len(out["items"])
def test_explicit_end_date(self, server_mod):
out = server_mod.get_agenda("2026-03-15", "2026-03-16")
assert out["end_date"] == "2026-03-16T00:00:00"
assert any(i["summary"] == "Réunion équipe" for i in out["items"])
def test_birthday_flag_forwarded(self, server_mod):
out = server_mod.get_agenda("2026-04-10", "2026-04-11", include_birthdays=True)
assert any(i["summary"] == "Anniversaire Marc" for i in out["items"])
out2 = server_mod.get_agenda("2026-04-10", "2026-04-11")
assert out2["items"] == []
def test_bad_date_returns_error_dict_not_raise(self, server_mod):
out = server_mod.get_agenda("pas-une-date")
assert "error" in out
assert "items" not in out
# ---------------------------------------------------------------- startup config
def test_validate_startup_config_raises_when_empty(server_mod):
with pytest.raises(ValueError, match="CALDAV_DATA_PATH"):
server_mod._validate_startup_config("")
def test_validate_startup_config_accepts_value(server_mod):
server_mod._validate_startup_config("/some/path") # no exception
def test_invalid_exclude_pattern_degrades_without_crash(server_mod, caplog):
# simulate a broken pattern compile path via format_component reading None regex
with caplog.at_level(logging.ERROR, logger=server_mod.logger.name):
pass
# validate the guard exists: compile fails → regex stays None → filters not applied
import re
try:
re.compile("(bad-pattern")
raised = False
except re.error:
raised = True
assert raised # and server catches this in its startup block
# ---------------------------------------------------------------- /health route
def test_health_endpoint(server):
from starlette.testclient import TestClient
app = server.mcp.http_app()
client = TestClient(app)
resp = client.get("/health")
assert resp.status_code == 200
assert resp.json() == {"status": "ok"}