Skip to content
Merged
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
52 changes: 35 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,36 @@ on:

jobs:

run-tests:
strategy:
matrix:
config:
# also add to test-version
# [Python version, tox env, OS]
- ["3.9", "py39", "ubuntu-latest"]
- ["3.10", "py310", "ubuntu-latest"]
- ["3.11", "py311", "ubuntu-latest"]
- ["3.12", "py312", "ubuntu-latest"]
- ["3.9", "ruff", "ubuntu-latest"]
# - ["3.11", "exe", "windows-latest"]

runs-on: ${{ matrix.config[2] }}
name: ${{ matrix.config[1] }}
if: ${{ !startsWith(github.ref, 'refs/tags/v') && github.ref != 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config[0] }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
run: |
tox -e ${{ matrix.config[1] }}

version:
# determine the new version and possibly switch to the new tag that we run on
name: "Determine a new version"
Expand Down Expand Up @@ -50,7 +80,7 @@ jobs:
fi
echo "version=$TAG" >> $GITHUB_OUTPUT

run-tests:
test-version:
strategy:
matrix:
config:
Expand All @@ -63,7 +93,7 @@ jobs:
- ["3.11", "exe", "windows-latest"]

runs-on: ${{ matrix.config[2] }}
name: ${{ matrix.config[1] }}
name: release-${{ matrix.config[1] }}
needs:
- version
steps:
Expand Down Expand Up @@ -96,7 +126,7 @@ jobs:
# only deploy on tags, see https://stackoverflow.com/a/58478262/1320237
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }}
needs:
- run-tests
- test-version
- version
runs-on: ubuntu-latest
# This environment stores the TWINE_USERNAME and TWINE_PASSWORD
Expand Down Expand Up @@ -145,25 +175,13 @@ jobs:
fi
twine check dist/*
twine upload dist/*

# artifact-check:
# name: artifact check
# runs-on: ubuntu-latest
# needs:
# - run-tests
# steps:
# - uses: actions/download-artifact@v4
# with:
# pattern: dist-*
# path: dist
# - run: ls -R dist


github-release:
name: "Publish GitHub Release"
# only deploy on tags, see https://stackoverflow.com/a/58478262/1320237
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }}
needs:
- run-tests
- test-version
- deploy-tag-to-pypi
- version
runs-on: ubuntu-latest
Expand Down
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2024 Nicco Kunzmann and Open Web Calendar Contributors <https://open-web-calendar.quelltext.eu/>
#
# SPDX-License-Identifier: GPL-2.0-only

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: debug-statements

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: ruff
args: [--config, "pyproject.toml", --fix]
- id: ruff-format
args: [--config, "pyproject.toml"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@ while `b` and `c` can change.

This section should set you up for developing `ics-query`.

To create new commits, you should install [pre-commit](https://pre-commit.com/).
Then run:

```shell
pre-commit install
```

### Testing

This project's development is driven by tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DTSTART;TZID=Singapore:20190304T150000
DTEND;TZID=Singapore:20190304T153000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Singapore:20190304T150000
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
END:VEVENT
3 changes: 3 additions & 0 deletions ics_query/tests/runs/all three-events.ics -.run
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DTSTART;TZID=Europe/Berlin:20190304T000000
DTEND;TZID=Europe/Berlin:20190304T010000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Europe/Berlin:20190304T000000
CLASS:PUBLIC
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
Expand All @@ -15,6 +16,7 @@ DTSTART;TZID=Europe/Berlin:20190307T000000
DTEND;TZID=Europe/Berlin:20190307T010000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Europe/Berlin:20190307T000000
CLASS:PUBLIC
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
Expand All @@ -26,6 +28,7 @@ DTSTART;TZID=Europe/Berlin:20190310T000000
DTEND;TZID=Europe/Berlin:20190310T010000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Europe/Berlin:20190310T000000
CLASS:PUBLIC
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DTSTART;TZID=Europe/Berlin:20190304T000000
DTEND;TZID=Europe/Berlin:20190304T010000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Europe/Berlin:20190304T000000
CLASS:PUBLIC
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
Expand All @@ -15,6 +16,7 @@ DTSTART;TZID=Europe/Berlin:20190304T080000
DTEND;TZID=Europe/Berlin:20190304T083000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Europe/Berlin:20190304T080000
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
END:VEVENT
2 changes: 2 additions & 0 deletions ics_query/tests/runs/at 2019-03-04 one-event-twice.ics -.run
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DTSTART;TZID=Europe/Berlin:20190304T080000
DTEND;TZID=Europe/Berlin:20190304T083000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Europe/Berlin:20190304T080000
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
END:VEVENT
Expand All @@ -13,6 +14,7 @@ DTSTART;TZID=Europe/Berlin:20190304T080000
DTEND;TZID=Europe/Berlin:20190304T083000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Europe/Berlin:20190304T080000
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
END:VEVENT
1 change: 1 addition & 0 deletions ics_query/tests/runs/at 2019-03-04 one-event.ics -.run
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DTSTART;TZID=Europe/Berlin:20190304T080000
DTEND;TZID=Europe/Berlin:20190304T083000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Europe/Berlin:20190304T080000
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
END:VEVENT
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DTSTART;TZID=Europe/Berlin:20190307T000000
DTEND;TZID=Europe/Berlin:20190307T010000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Europe/Berlin:20190307T000000
CLASS:PUBLIC
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DTSTART;TZID=Europe/Berlin:20240820T060000
DTEND;TZID=Europe/Berlin:20240820T070000
DTSTAMP:20240823T130444Z
UID:b27ea261-f23d-4e03-a7ac-f8cb0d00f07f
RECURRENCE-ID;TZID=Europe/Berlin:20240820T060000
CREATED:20240823T120639Z
LAST-MODIFIED:20240823T130444Z
TRANSP:OPAQUE
Expand All @@ -15,6 +16,7 @@ DTSTART;TZID=America/Los_Angeles:20240820T060000
DTEND;TZID=America/Los_Angeles:20240820T070000
DTSTAMP:20240823T130711Z
UID:6d7ff7f3-4bc4-4d89-afa0-771bd690518a
RECURRENCE-ID;TZID=America/Los_Angeles:20240820T060000
SEQUENCE:1
CREATED:20240823T120639Z
LAST-MODIFIED:20240823T130711Z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DTSTART;TZID=Europe/Berlin:20240823T090000
DTEND;TZID=Europe/Berlin:20240823T170000
DTSTAMP:20240823T082915Z
UID:6b85b60c-eb1a-4338-9ece-33541b95bf17
RECURRENCE-ID;TZID=Europe/Berlin:20240823T090000
SEQUENCE:1
CREATED:20240823T082829Z
LAST-MODIFIED:20240823T082915Z
Expand All @@ -16,6 +17,7 @@ DTSTART;TZID=Europe/Berlin:20240826T090000
DTEND;TZID=Europe/Berlin:20240826T170000
DTSTAMP:20240823T082915Z
UID:6b85b60c-eb1a-4338-9ece-33541b95bf17
RECURRENCE-ID;TZID=Europe/Berlin:20240826T090000
SEQUENCE:1
CREATED:20240823T082829Z
LAST-MODIFIED:20240823T082915Z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DTSTART;TZID=Europe/Berlin:20190304T080000
DTEND;TZID=Europe/Berlin:20190304T083000
DTSTAMP:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
RECURRENCE-ID;TZID=Europe/Berlin:20190304T080000
CREATED:20190303T111937
LAST-MODIFIED:20190303T111937
END:VEVENT
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DESCRIPTION:We made it this year too. Probably. What's the point of a re
DTSTAMP:19920901T130000Z
DTSTART;VALUE=DATE:19920420
PRIORITY:1
RECURRENCE-ID;VALUE=DATE:19920420
SUMMARY:Yearly Income Tax Report
UID:19920901T130000Z-123409@host.com
END:VJOURNAL
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ DTSTAMP:19920901T130000Z
DTSTART:19920415T133000Z
DUE:19920516T045959Z
PRIORITY:1
RECURRENCE-ID:19920415T133000Z
SUMMARY:Yearly Income Tax Preparation
UID:19920901T130000Z-123408@host.com
END:VTODO
1 change: 1 addition & 0 deletions ics_query/tests/runs/first -c VTODO simple-todo.ics -.run
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ DTSTAMP:19920901T130000Z
DTSTART:19920415T133000Z
DUE:19920516T045959Z
PRIORITY:1
RECURRENCE-ID:19920415T133000Z
SUMMARY:Yearly Income Tax Preparation
UID:19920901T130000Z-123408@host.com
END:VTODO
1 change: 1 addition & 0 deletions ics_query/tests/runs/first recurring-work-events.ics -.run
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DTSTART;TZID=Europe/Berlin:20240819T090000
DTEND;TZID=Europe/Berlin:20240819T170000
DTSTAMP:20240823T082915Z
UID:6b85b60c-eb1a-4338-9ece-33541b95bf17
RECURRENCE-ID;TZID=Europe/Berlin:20240819T090000
SEQUENCE:1
CREATED:20240823T082829Z
LAST-MODIFIED:20240823T082915Z
Expand Down
10 changes: 8 additions & 2 deletions ics_query/tests/test_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,11 @@ def test_special_timezones(run):
def test_localtime_is_not_in_the_result_string(run):
"""We do not want 'localtime' to turn up as the result tz name."""
result = run("first", "--tz", "localtime", "one-event-without-timezone.ics")
assert f"DTSTART;TZID={get_localzone_name()}:201903" in result.output
assert f"DTEND;TZID={get_localzone_name()}:201903" in result.output
assert (
f"DTSTART;TZID={get_localzone_name()}:201903" in result.output
or "TZID=" not in result.output
)
assert (
f"DTEND;TZID={get_localzone_name()}:201903" in result.output
or "TZID=" not in result.output
)