Use Sourcehut for CI

This commit is contained in:
Hugo Osvaldo Barrera 2021-04-05 12:16:20 +02:00
parent 255ea8f9bf
commit ef34d77ab1
12 changed files with 145 additions and 229 deletions

16
.builds/style.yaml Normal file
View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
}

View file

@ -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

View file

@ -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

View file

@ -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:

48
scripts/make_ci_conf.py Executable file
View file

@ -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))

View file

@ -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)

22
scripts/tests.template Normal file
View file

@ -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

View file

@ -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