Skip to content

Commit 372a18a

Browse files
authored
Merge pull request #294 from sass/azure_pipelines
azure pipelines [skip travis] [skip appveyor]
2 parents fde5b18 + b431900 commit 372a18a

14 files changed

+138
-245
lines changed

.coveragerc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ branch = True
44
source = $PWD
55
data_file = $PWD/.coverage
66
omit =
7-
.tox/*
7+
*/.tox/*
88
/usr/*
99
*/setup.py
10-
*/build_manylinux_wheels.py
11-
*/upload_appveyor_builds.py
1210

1311
[report]
1412
show_missing = True

.travis.yml

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

CONTRIBUTING.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ Tests
2323
- All code patches should contain one or more unit tests or regression tests.
2424
- All code patches have to successfully run tests on every Python version
2525
we aim to support. tox_ would help.
26-
- All commits will be tested by Travis_ (Linux) and
27-
AppVeyor_ (Windows).
26+
- All commits will be tested by `Azure Pipelines`_ (Linux and Windows).
2827

2928
.. _tox: https://tox.readthedocs.io/
30-
.. _Travis: https://travis-ci.org/sass/libsass-python
31-
.. _AppVeyor: https://ci.appveyor.com/project/asottile/libsass-python
29+
.. _`Azure Pipelines`: https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
3230

3331

3432
Maintainer's guide
@@ -52,11 +50,11 @@ Here's a brief check list for releasing a new version:
5250
- Make a source distribution and upload it to PyPI
5351
(``python3 setup.py sdist upload``).
5452
If it's successful the new version must appear on PyPI_.
55-
- AppVeyor_ automatically makes binary wheels for Windows, but each CI build
56-
takes longer than an hour. These wheels are not automatically uploaded,
57-
but there's upload_appveyor_builds.py script that downloads built wheels and
58-
uploads them to PyPI.
59-
- Run build_manylinux_wheels.py to build linux wheels and upload them to
53+
- `Azure Pipelines`_ automatically makes binary wheels for Windows, but each
54+
CI build takes a while. These wheels are not automatically uploaded,
55+
but there's ``./bin/download-windows-wheels`` script that downloads built
56+
wheels. Then upload them with ``twine``.
57+
- Run ``./bin/build-manylinux-wheels`` to build linux wheels and upload them to
6058
PyPI (takes ~10 minutes).
6159
- The `docs website`__ also has to be updated.
6260
It's currently a static website deployed on GitHub Pages.

README.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@ libsass-python: Sass_/SCSS for Python
55
:alt: PyPI
66
:target: https://pypi.org/pypi/libsass/
77

8-
.. image:: https://travis-ci.org/sass/libsass-python.svg
9-
:target: https://travis-ci.org/sass/libsass-python
8+
.. image:: https://dev.azure.com/asottile/asottile/_apis/build/status/sass.libsass-python?branchName=master
9+
:target: https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
1010
:alt: Build Status
1111

12-
.. image:: https://ci.appveyor.com/api/projects/status/asgquaxlffnuryoq/branch/master?svg=true
13-
:target: https://ci.appveyor.com/project/asottile/libsass-python
14-
:alt: Build Status (Windows)
15-
16-
.. image:: https://coveralls.io/repos/github/sass/libsass-python/badge.svg?branch=master
17-
:target: https://coveralls.io/github/sass/libsass-python?branch=master
12+
.. image:: https://img.shields.io/azure-devops/coverage/asottile/asottile/22/master.svg
13+
:target: https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
1814
:alt: Coverage Status
1915

2016
This package provides a simple Python extension module ``sass`` which is

appveyor.yml

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

azure-pipelines.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
trigger:
2+
branches:
3+
include: [master, test-me-*]
4+
tags:
5+
include: ['*']
6+
7+
resources:
8+
repositories:
9+
- repository: self
10+
checkoutOptions:
11+
submodules: true
12+
- repository: asottile
13+
type: github
14+
endpoint: github
15+
name: asottile/azure-pipeline-templates
16+
ref: refs/tags/v0.0.13
17+
18+
jobs:
19+
- template: job--pre-commit.yml@asottile
20+
- template: job--python-tox.yml@asottile
21+
parameters:
22+
toxenvs: [py27, py35, py36, py37]
23+
os: windows
24+
wheel_tags: true
25+
- template: job--python-tox.yml@asottile
26+
parameters:
27+
toxenvs: [py27, py35, py36, py37]
28+
os: windows
29+
architecture: x86
30+
name_postfix: _x86
31+
wheel_tags: true
32+
- template: job--python-tox.yml@asottile
33+
parameters:
34+
toxenvs: [pypy, pypy3, py27, py35, py36, py37]
35+
os: linux
File renamed without changes.

bin/download-windows-wheels

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env python3
2+
import argparse
3+
import io
4+
import json
5+
import os.path
6+
import re
7+
import urllib.request
8+
import zipfile
9+
10+
DEFINITION_RE = re.compile(
11+
r'https://(?P<org>[^.]+)\.visualstudio\.com/(?P<project>[^/]+)'
12+
r'/_build/latest\?definitionId=(?P<definition>\d+)',
13+
)
14+
BUILDS = 'https://dev.azure.com/{org}/{project}/_apis/build/builds?api-version=5.0&definitions={definition}&$top=5' # noqa: E501
15+
ARTIFACTS = 'https://dev.azure.com/{org}/{project}/_apis/build/builds/{build}/artifacts?api-version=5.0' # noqa: E501
16+
17+
18+
def main() -> int:
19+
parser = argparse.ArgumentParser()
20+
parser.add_argument('tag')
21+
parser.add_argument('--dest', default='dist')
22+
args = parser.parse_args()
23+
24+
with open('README.md') as f:
25+
match = DEFINITION_RE.search(f.read())
26+
assert match
27+
28+
builds_resp = urllib.request.urlopen(BUILDS.format(**match.groupdict()))
29+
builds_json = json.load(builds_resp)
30+
31+
build_id = next(
32+
iter([
33+
build['id'] for build in builds_json['value']
34+
if build['status'] == 'completed'
35+
if build['result'] == 'succeeded'
36+
if build['sourceBranch'] == f'refs/tags/{args.tag}'
37+
]),
38+
)
39+
40+
artifacts_url = ARTIFACTS.format(build=build_id, **match.groupdict())
41+
artifacts_resp = urllib.request.urlopen(artifacts_url)
42+
artifacts_json = json.load(artifacts_resp)
43+
44+
os.makedirs(args.dest, exist_ok=True)
45+
for artifact in artifacts_json['value']:
46+
if artifact['name'].startswith('wheel_'):
47+
print(f'artifact: {artifact["name"]}')
48+
resp = urllib.request.urlopen(artifact['resource']['downloadUrl'])
49+
bio = io.BytesIO(resp.read())
50+
with zipfile.ZipFile(bio) as zipf:
51+
for info in zipf.infolist():
52+
if info.filename.endswith('.whl'):
53+
info.filename = os.path.basename(info.filename)
54+
zipf.extract(info, path=args.dest)
55+
return 0
56+
57+
58+
if __name__ == '__main__':
59+
exit(main())

docs/index.rst

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -132,26 +132,19 @@ Open source
132132
GitHub (Git repository + issues)
133133
https://github.com/sass/libsass-python
134134

135-
Travis CI
136-
https://travis-ci.org/sass/libsass-python
135+
Azure Pipelines CI (linux + windows)
136+
https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
137137

138-
.. image:: https://travis-ci.org/sass/libsass-python.svg
139-
:target: https://travis-ci.org/sass/libsass-python
140-
:alt: Build Status
138+
.. image:: https://dev.azure.com/asottile/asottile/_apis/build/status/sass.libsass-python?branchName=master
139+
:target: https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
140+
:alt: Build Status
141141

142-
AppVeyor (CI for Windows)
143-
https://ci.appveyor.com/project/asottile/libsass-python
142+
Azure Pipelines Coverage (Test coverage)
143+
https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
144144

145-
.. image:: https://ci.appveyor.com/api/projects/status/asgquaxlffnuryoq/branch/master?svg=true
146-
:target: https://ci.appveyor.com/project/asottile/libsass-python
147-
:alt: Build Status (Windows)
148-
149-
Coveralls (Test coverage)
150-
https://coveralls.io/r/sass/libsass-python
151-
152-
.. image:: https://coveralls.io/repos/github/sass/libsass-python/badge.svg?branch=master
153-
:target: https://coveralls.io/r/sass/libsass-python
154-
:alt: Coverage Status
145+
.. image:: https://img.shields.io/azure-devops/coverage/asottile/asottile/22/master.svg
146+
:target: https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
147+
:alt: Coverage Status
155148

156149
PyPI
157150
https://pypi.org/pypi/libsass/

sasstests.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ def normalize_path(path):
3939
return path
4040

4141

42+
@pytest.fixture(scope='session', autouse=True)
43+
def set_coverage_instrumentation():
44+
if 'PWD' in os.environ: # pragma: no branch
45+
rcfile = os.path.join(os.environ['PWD'], '.coveragerc')
46+
os.environ['COVERAGE_PROCESS_START'] = rcfile
47+
48+
4249
A_EXPECTED_CSS = '''\
4350
body {
4451
background-color: green; }
@@ -65,12 +72,8 @@ def normalize_path(path):
6572
),
6673
}
6774

68-
with open('test/a.scss') as f:
69-
A_EXPECTED_MAP_CONTENTS = dict(
70-
A_EXPECTED_MAP, **{
71-
'sourcesContent': [f.read()],
72-
}
73-
)
75+
with io.open('test/a.scss', newline='') as f:
76+
A_EXPECTED_MAP_CONTENTS = dict(A_EXPECTED_MAP, sourcesContent=[f.read()])
7477

7578
B_EXPECTED_CSS = '''\
7679
b i {

0 commit comments

Comments
 (0)