diff --git a/.builds/style.yaml b/.builds/style.yaml new file mode 100644 index 0000000..12c5862 --- /dev/null +++ b/.builds/style.yaml @@ -0,0 +1,16 @@ +image: archlinux +packages: + - docker + - docker-compose + - python-pip +sources: + - https://github.com/pimutils/vdirsyncer +tasks: + - setup: | + cd vdirsyncer + make -e install-style + - test: | + cd vdirsyncer + # Non-system python is used for packages: + export PATH=$PATH:~/.local/bin/ + make -e style diff --git a/.builds/tests-minimal.yaml b/.builds/tests-minimal.yaml new file mode 100644 index 0000000..52d2abf --- /dev/null +++ b/.builds/tests-minimal.yaml @@ -0,0 +1,25 @@ +# TODO: Maybe shift this job to ubuntu/debian. +image: archlinux +packages: + - docker + - docker-compose + - python-pip +sources: + - https://github.com/pimutils/vdirsyncer +environment: + BUILD: test + CI: true + REQUIREMENTS: minimal + # TODO: ETESYNC_TESTS +tasks: + - setup: | + cd vdirsyncer + sudo systemctl start docker + DAV_SERVER="radicale xandikos" make -e install-test + - test: | + cd vdirsyncer + # Non-system python is used for packages: + export PATH=$PATH:~/.local/bin/ + make -e ci-test + DAV_SERVER=radicale make -e ci-test-storage + DAV_SERVER=xandikos make -e ci-test-storage diff --git a/.builds/tests-release.yaml b/.builds/tests-release.yaml new file mode 100644 index 0000000..0761054 --- /dev/null +++ b/.builds/tests-release.yaml @@ -0,0 +1,24 @@ +image: archlinux +packages: + - docker + - docker-compose + - python-pip +sources: + - https://github.com/pimutils/vdirsyncer +environment: + BUILD: test + CI: true + REQUIREMENTS: release + # TODO: ETESYNC_TESTS +tasks: + - setup: | + cd vdirsyncer + sudo systemctl start docker + DAV_SERVER="radicale xandikos" make -e install-test + - test: | + cd vdirsyncer + # Non-system python is used for packages: + export PATH=$PATH:~/.local/bin/ + make -e ci-test + DAV_SERVER=radicale make -e ci-test-storage + DAV_SERVER=xandikos make -e ci-test-storage diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f0b7cd..c7e29c3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,6 @@ repos: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - id: end-of-file-fixer - exclude: '.travis.yml' - id: check-toml - id: check-added-large-files - id: debug-statements @@ -18,12 +17,3 @@ repos: rev: v2.3.0 hooks: - id: reorder-python-imports - - repo: local - hooks: - - id: update-travis - name: Update travis job definition - description: Ensures that travis job definition are up to date. - entry: scripts/make_travisconf.py - files: '.*travis.*' - stages: [commit] - language: script diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c9bf874..0000000 --- a/.travis.yml +++ /dev/null @@ -1,113 +0,0 @@ -{ - "branches": { - "only": [ - "master" - ] - }, - "cache": "pip", - "dist": "focal", - "git": { - "submodules": false - }, - "install": [ - ". scripts/travis-install.sh", - "make -e install-$BUILD" - ], - "language": "python", - "matrix": { - "fast_finish": true, - "include": [ - { - "env": "BUILD=style", - "python": "3.7" - }, - { - "env": "BUILD=test REQUIREMENTS=release", - "python": "3.7" - }, - { - "env": "BUILD=test-storage DAV_SERVER=radicale REQUIREMENTS=release ", - "python": "3.7" - }, - { - "env": "BUILD=test-storage DAV_SERVER=xandikos REQUIREMENTS=release ", - "python": "3.7" - }, - { - "env": "BUILD=test-storage DAV_SERVER=fastmail REQUIREMENTS=release ", - "python": "3.7" - }, - { - "env": "BUILD=test REQUIREMENTS=minimal", - "python": "3.7" - }, - { - "env": "BUILD=test-storage DAV_SERVER=radicale REQUIREMENTS=minimal ", - "python": "3.7" - }, - { - "env": "BUILD=test-storage DAV_SERVER=xandikos REQUIREMENTS=minimal ", - "python": "3.7" - }, - { - "env": "BUILD=test REQUIREMENTS=release", - "python": "3.8" - }, - { - "env": "BUILD=test-storage DAV_SERVER=radicale REQUIREMENTS=release ", - "python": "3.8" - }, - { - "env": "BUILD=test-storage DAV_SERVER=xandikos REQUIREMENTS=release ", - "python": "3.8" - }, - { - "env": "BUILD=test REQUIREMENTS=minimal", - "python": "3.8" - }, - { - "env": "BUILD=test-storage DAV_SERVER=radicale REQUIREMENTS=minimal ", - "python": "3.8" - }, - { - "env": "BUILD=test-storage DAV_SERVER=xandikos REQUIREMENTS=minimal ", - "python": "3.8" - }, - { - "env": "BUILD=test REQUIREMENTS=release", - "python": "3.9" - }, - { - "env": "BUILD=test-storage DAV_SERVER=radicale REQUIREMENTS=release ", - "python": "3.9" - }, - { - "env": "BUILD=test-storage DAV_SERVER=xandikos REQUIREMENTS=release ", - "python": "3.9" - }, - { - "env": "BUILD=test REQUIREMENTS=minimal", - "python": "3.9" - }, - { - "env": "BUILD=test-storage DAV_SERVER=radicale REQUIREMENTS=minimal ", - "python": "3.9" - }, - { - "env": "BUILD=test-storage DAV_SERVER=xandikos REQUIREMENTS=minimal ", - "python": "3.9" - }, - { - "env": "BUILD=test ETESYNC_TESTS=true REQUIREMENTS=latest", - "python": "3.7" - } - ] - }, - "script": [ - "make -e $BUILD" - ], - "services": [ - "docker" - ], - "sudo": true -} \ No newline at end of file diff --git a/Makefile b/Makefile index fbe59b8..f24510f 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ export DETERMINISTIC_TESTS := false # Run the etesync testsuite. export ETESYNC_TESTS := false -# Assume to run in Travis. Don't use this outside of a virtual machine. It will +# Assume to run in CI. Don't use this outside of a virtual machine. It will # heavily "pollute" your system, such as attempting to install a new Python # systemwide. export CI := false @@ -41,17 +41,17 @@ export TESTSERVER_BASE := ./tests/storage/servers/ CODECOV_PATH = /tmp/codecov.sh ifeq ($(CI), true) -test-storage: - curl -s https://codecov.io/bash > $(CODECOV_PATH) - $(PYTEST) tests/storage/ - bash $(CODECOV_PATH) -c -F storage -test: +ci-test: curl -s https://codecov.io/bash > $(CODECOV_PATH) $(PYTEST) tests/unit/ bash $(CODECOV_PATH) -c -F unit $(PYTEST) tests/system/ bash $(CODECOV_PATH) -c -F system [ "$(ETESYNC_TESTS)" = "false" ] || make test-storage +ci-test-storage: + curl -s https://codecov.io/bash > $(CODECOV_PATH) + $(PYTEST) tests/storage/ + bash $(CODECOV_PATH) -c -F storage else test: $(PYTEST) @@ -79,10 +79,6 @@ install-test: install-servers install-dev fi [ -z "$(TEST_EXTRA_PACKAGES)" ] || pip install $(TEST_EXTRA_PACKAGES) -install-test-storage: install-test - # This is just an alias - true - install-style: install-docs install-dev pip install pre-commit diff --git a/README.rst b/README.rst index bfacf71..6ec3d66 100644 --- a/README.rst +++ b/README.rst @@ -2,8 +2,8 @@ vdirsyncer ========== -.. image:: https://travis-ci.org/pimutils/vdirsyncer.svg?branch=master - :target: https://travis-ci.org/pimutils/vdirsyncer +.. image:: https://builds.sr.ht/~whynothugo/vdirsyncer.svg + :target: https://builds.sr.ht/~whynothugo/vdirsyncer :alt: CI status .. image:: https://codecov.io/github/pimutils/vdirsyncer/coverage.svg?branch=master diff --git a/docs/contributing.rst b/docs/contributing.rst index 449638a..233ea71 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -75,8 +75,8 @@ Submitting patches, pull requests Running tests, how to set up your development environment --------------------------------------------------------- -For many patches, it might suffice to just let Travis run the tests. However, -Travis is slow, so you might want to run them locally too. For this, set up a +For many patches, it might suffice to just let CI run the tests. However, +CI is slow, so you might want to run them locally too. For this, set up a virtualenv_ and run this inside of it:: # install: diff --git a/scripts/make_ci_conf.py b/scripts/make_ci_conf.py new file mode 100755 index 0000000..a56c6b1 --- /dev/null +++ b/scripts/make_ci_conf.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +from pathlib import Path + +REPO_ROOT = Path(__file__).parent.parent + +builds = [ + { + "BUILD": "style", + "REQUIREMENTS": "release", + "DAV_SERVER": "skip", + }, + { + "ETESYNC_TESTS": "true", + "BUILD": "test", + "REQUIREMENTS": "release", + "DAV_SERVER": "skip", + }, +] + +# XXX: Use `devel` here for recent python versions: +for requirements in ("release", "minimal"): + # XXX: `fastmail` has been left out here: + dav_servers = ("radicale", "xandikos") + + builds.append( + { + "BUILD": "test", + "REQUIREMENTS": requirements, + "DAV_SERVER": "skip", + }, + ) + + for dav_server in dav_servers: + job = { + "BUILD": "test-storage", + "REQUIREMENTS": requirements, + "DAV_SERVER": dav_server, + } + + +with open(REPO_ROOT / "scripts" / "tests.template") as f: + template = f.read() + +# TODO: Delete previous ones... + +for i, build in enumerate(builds): + with open(REPO_ROOT / ".builds" / f"{i}.yaml", "w") as f: + f.write(template.format(**build)) diff --git a/scripts/make_travisconf.py b/scripts/make_travisconf.py deleted file mode 100755 index 8301dac..0000000 --- a/scripts/make_travisconf.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python -import itertools -import json - -python_versions = ["3.7", "3.8", "3.9"] - -cfg = {} - -cfg['sudo'] = True -cfg['dist'] = 'focal' -cfg['language'] = 'python' -cfg['cache'] = 'pip' - -cfg['services'] = ['docker'] - -cfg['git'] = { - 'submodules': False -} - -cfg['branches'] = { - 'only': ['master'] -} - -cfg['install'] = """ -. scripts/travis-install.sh -make -e install-$BUILD -""".strip().splitlines() - -cfg['script'] = ["make -e $BUILD"] - -matrix = [] -cfg['matrix'] = {'include': matrix, 'fast_finish': True} - -matrix.append({ - 'python': python_versions[0], - 'env': 'BUILD=style' -}) - - -for python, requirements in itertools.product( - python_versions, - # XXX: Use `devel` here for recent python versions: - ("release", "minimal") -): - dav_servers = ("radicale", "xandikos") - - matrix.append({ - 'python': python, - 'env': f"BUILD=test REQUIREMENTS={requirements}", - }) - - if python == python_versions[0] and requirements == "release": - dav_servers += ("fastmail",) - - for dav_server in dav_servers: - job = { - 'python': python, - 'env': ("BUILD=test-storage " - f"DAV_SERVER={dav_server} " - f"REQUIREMENTS={requirements} ") - } - - if dav_server in ("davical", "icloud"): - job['if'] = 'NOT (type IN (pull_request))' - - matrix.append(job) - -matrix.append({ - 'python': python_versions[0], - 'env': ("BUILD=test " - "ETESYNC_TESTS=true " - "REQUIREMENTS=latest") -}) - -# matrix.append({ -# 'language': 'generic', -# 'os': 'osx', -# 'env': 'BUILD=test' -# }) - -with open('.travis.yml', 'w') as output: - json.dump(cfg, output, sort_keys=True, indent=2) diff --git a/scripts/tests.template b/scripts/tests.template new file mode 100644 index 0000000..26285e5 --- /dev/null +++ b/scripts/tests.template @@ -0,0 +1,22 @@ +# vim: ft=yaml + +image: archlinux +packages: + - docker + - docker-compose + - python-pip +sources: + - https://github.com/pimutils/vdirsyncer +environment: + BUILD: {BUILD} + REQUIREMENTS: {REQUIREMENTS} + DAV_SERVER: {DAV_SERVER} +tasks: + - setup: | + cd vdirsyncer + make -e install-$BUILD + - test: | + cd vdirsyncer + # Non-system python is used for packages: + export PATH=$PATH:~/.local/bin/ + make -e $BUILD diff --git a/scripts/travis-install.sh b/scripts/travis-install.sh deleted file mode 100644 index 9b78409..0000000 --- a/scripts/travis-install.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# The OS X VM doesn't have any Python support at all -# See https://github.com/travis-ci/travis-ci/issues/2312 -if [ "$TRAVIS_OS_NAME" = "osx" ]; then - brew update - brew install python3 - virtualenv -p python3 $HOME/osx-py3 - . $HOME/osx-py3/bin/activate -fi