Skip to content

Commit df50294

Browse files
Replace defunct .travis.yml CI with a GitHub Action (#88)
1 parent 9fe6ad0 commit df50294

11 files changed

Lines changed: 60 additions & 34 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [speed.python.org]
6+
pull_request:
7+
branches: [speed.python.org]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
17+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
18+
with:
19+
python-version: "3.13"
20+
- run: pip install -r requirements-dev.txt
21+
- run: flake8 codespeed
22+
23+
test:
24+
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
python-version: ["3.12", "3.13", "3.14"]
29+
django: ["5.2", "6.1"]
30+
name: Python ${{ matrix.python-version }} / Django ${{ matrix.django }}
31+
env:
32+
DJANGO_SETTINGS_MODULE: sample_project.settings
33+
34+
steps:
35+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
36+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
- run: pip install -r requirements.txt "django==${{ matrix.django }}.*"
40+
- run: python manage.py test codespeed

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ override
1111
build
1212
dist
1313
*.egg-info
14+
.venv*/

‎.travis.yml‎

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Codespeed
2-
[![Build Status](https://travis-ci.org/tobami/codespeed.png?branch=master)](https://travis-ci.org/tobami/codespeed)
2+
[![Tests](https://github.com/python/codespeed/actions/workflows/test.yml/badge.svg)](https://github.com/python/codespeed/actions/workflows/test.yml)
33
[![PyPI version](https://img.shields.io/pypi/v/codespeed.svg)](https://pypi.python.org/pypi/codespeed)
44

55
Codespeed is a web application to monitor and analyze the performance of your code.

‎codespeed/commits/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
from .logs import get_logs, get_commit_date
2+
3+
__all__ = ["get_logs", "get_commit_date"]

‎codespeed/commits/logs.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def get_scm(project):
1616
elif project.repo_type == project.GIT:
1717
from .git import getlogs, updaterepo
1818
elif project.repo_type == project.GITHUB:
19-
from .github import getlogs, updaterepo
19+
from .github import getlogs, updaterepo # noqa: F401
2020
else:
2121
return None
2222

@@ -51,6 +51,7 @@ def _get_commit_date(project, commit_id):
5151

5252
return scm.get_commit_date(commit_id)
5353

54+
5455
def get_commit_date(project, commit_id):
5556
date = _get_commit_date(project, commit_id)
5657
if date is not None:

‎codespeed/commits/mercurial.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def update_repo(self, update=True):
2424
return
2525

2626
p = Popen(['hg', 'pull', '-u'], stdout=PIPE, stderr=PIPE,
27-
cwd=project.working_copy)
27+
cwd=project.working_copy)
2828
stdout, stderr = p.communicate()
2929

3030
if p.returncode != 0 or stderr:
@@ -37,7 +37,7 @@ def update_repo(self, update=True):
3737
cmd = ['hg', 'clone', project.repo_path, project.repo_name]
3838

3939
p = Popen(cmd, stdout=PIPE, stderr=PIPE,
40-
cwd=settings.REPOSITORY_BASE_PATH)
40+
cwd=settings.REPOSITORY_BASE_PATH)
4141
logger.debug('Cloning Mercurial repo {0} for project {1}'.format(
4242
project.repo_path, project))
4343
stdout, stderr = p.communicate()
@@ -52,9 +52,11 @@ def update_repo(self, update=True):
5252
def get_logs(self, endrev, startrev):
5353
self.update_repo(update=False)
5454

55+
template = ("{rev}:{node|short}\n{node}\n{author|user}\n"
56+
"{author|email}\n{date}\n{desc}\n=newlog=\n")
5557
cmd = ["hg", "log",
56-
"-r", "%s::%s" % (startrev.commitid, endrev.commitid),
57-
"--template", "{rev}:{node|short}\n{node}\n{author|user}\n{author|email}\n{date}\n{desc}\n=newlog=\n"]
58+
"-r", "%s::%s" % (startrev.commitid, endrev.commitid),
59+
"--template", template]
5860

5961
working_copy = self.project.working_copy
6062
p = Popen(cmd,
@@ -86,7 +88,8 @@ def get_logs(self, endrev, startrev):
8688

8789
# Parse date
8890
date = date.split('-')[0]
89-
date = datetime.datetime.fromtimestamp(float(date)).strftime("%Y-%m-%d %H:%M:%S")
91+
date = datetime.datetime.fromtimestamp(
92+
float(date)).strftime("%Y-%m-%d %H:%M:%S")
9093

9194
# Add changeset info
9295
logs.append({

‎codespeed/models.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def __str__(self):
145145
date = None
146146
else:
147147
date = self.date.isoformat(sep=" ")
148-
string = " - ".join(filter(None, (date, self.commitid, self.tag, self.branch.name)))
148+
string = " - ".join(
149+
filter(None, (date, self.commitid, self.tag, self.branch.name)))
149150
return string
150151

151152
class Meta:

‎codespeed/results.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def save_result(data, update_repo=True):
5252
if error:
5353
return res, True
5454
else:
55-
assert(isinstance(res, Environment))
55+
assert isinstance(res, Environment)
5656
env = res
5757

5858
p, created = Project.objects.get_or_create(name=data["project"])

‎requirements-dev.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flake8

0 commit comments

Comments
 (0)