Skip to content

Commit 5201bfb

Browse files
committed
Setup CircleCI to replace TravisCI
1 parent b7f683a commit 5201bfb

File tree

4 files changed

+75
-36
lines changed

4 files changed

+75
-36
lines changed

.circleci/config.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Use the latest 2.1 version of CircleCI pipeline process engine.
2+
# See: https://circleci.com/docs/2.0/configuration-reference
3+
version: 2.1
4+
5+
# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects.
6+
# See: https://circleci.com/docs/2.0/orb-intro/
7+
orbs:
8+
# The python orb contains a set of prepackaged CircleCI configuration you can use repeatedly in your configuration files
9+
# Orb commands and jobs help you with common scripting around a language/tool
10+
# so you dont have to copy and paste it everywhere.
11+
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python
12+
python: circleci/[email protected]
13+
14+
# Define a job to be invoked later in a workflow.
15+
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
16+
jobs:
17+
build-and-test: # This is the name of the job, feel free to change it to better match what you're trying to do!
18+
# These next lines defines a Docker executors: https://circleci.com/docs/2.0/executor-types/
19+
# You can specify an image from Dockerhub or use one of the convenience images from CircleCI's Developer Hub
20+
# A list of available CircleCI Docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python
21+
# The executor is the environment in which the steps below will be executed - below will use a python 3.8 container
22+
# Change the version below to your required version of python
23+
docker:
24+
- image: cimg/base:2022.01
25+
# Checkout the code as the first step. This is a dedicated CircleCI step.
26+
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
27+
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
28+
# Then run your tests!
29+
# CircleCI will report the results back to your VCS provider.
30+
steps:
31+
- checkout
32+
- run:
33+
name: Install system deps
34+
command: sudo apt update -y && sudo apt upgrade -y && sudo apt install poppler-utils python3 python3-pip
35+
- run:
36+
name: Install python deps
37+
command: pip3 install pillow psutil memory_profiler codecov
38+
- run:
39+
name: Run tests
40+
# This assumes pytest is installed via the install-package step above
41+
command: CIRCLECI=true python3 tests.py && coverage run tests.py
42+
- run:
43+
name: Uninstall poppler
44+
command: sudo apt remove poppler-utils
45+
- run:
46+
name: Run tests without poppler
47+
command: coverage run -a tests.py
48+
- run:
49+
name: Upload report
50+
command: codecov
51+
52+
# Invoke jobs via workflows
53+
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
54+
workflows:
55+
sample: # This is the name of the workflow, feel free to change it to better match your workflow.
56+
# Inside the workflow, you define the jobs you want to run.
57+
jobs:
58+
- build-and-test

.travis.yml

-19
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pdf2image
2-
[![TravisCI](https://travis-ci.org/Belval/pdf2image.svg?branch=master)](https://travis-ci.org/Belval/pdf2image) [![PyPI version](https://badge.fury.io/py/pdf2image.svg)](https://badge.fury.io/py/pdf2image) [![codecov](https://codecov.io/gh/Belval/pdf2image/branch/master/graph/badge.svg)](https://codecov.io/gh/Belval/pdf2image) [![Downloads](https://pepy.tech/badge/pdf2image/month)](https://pepy.tech/project/pdf2image) [![Documentation Status](https://readthedocs.org/projects/pdf2image/badge/?version=latest)](https://pdf2image.readthedocs.io/en/latest/?badge=latest)
2+
[![CircleCI](https://circleci.com/gh/Belval/pdf2image/tree/master.svg?style=svg)](https://circleci.com/gh/Belval/pdf2image/tree/master) [![PyPI version](https://badge.fury.io/py/pdf2image.svg)](https://badge.fury.io/py/pdf2image) [![codecov](https://codecov.io/gh/Belval/pdf2image/branch/master/graph/badge.svg)](https://codecov.io/gh/Belval/pdf2image) [![Downloads](https://pepy.tech/badge/pdf2image/month)](https://pepy.tech/project/pdf2image) [![Documentation Status](https://readthedocs.org/projects/pdf2image/badge/?version=latest)](https://pdf2image.readthedocs.io/en/latest/?badge=latest)
33

44
A python (3.6+) module that wraps pdftoppm and pdftocairo to convert PDF to a PIL Image object
55

tests.py

+16-16
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ def test_conversion_from_path_using_dir_14(self):
178178
@profile
179179
@unittest.skipIf(not POPPLER_INSTALLED, "Poppler is not installed!")
180180
@unittest.skipIf(
181-
"TRAVIS" in os.environ and os.environ["TRAVIS"] == "true",
182-
"Skipping this test on Travis CI.",
181+
"CIRCLECI" in os.environ and os.environ["CIRCLECI"] == "true",
182+
"Skipping this test on CircleCI.",
183183
)
184184
def test_conversion_from_bytes_241(self): # pragma: no cover
185185
start_time = time.time()
@@ -195,8 +195,8 @@ def test_conversion_from_bytes_241(self): # pragma: no cover
195195
@profile
196196
@unittest.skipIf(not POPPLER_INSTALLED, "Poppler is not installed!")
197197
@unittest.skipIf(
198-
"TRAVIS" in os.environ and os.environ["TRAVIS"] == "true",
199-
"Skipping this test on Travis CI.",
198+
"CIRCLECI" in os.environ and os.environ["CIRCLECI"] == "true",
199+
"Skipping this test on CircleCI.",
200200
)
201201
def test_conversion_from_path_241(self): # pragma: no cover
202202
start_time = time.time()
@@ -211,8 +211,8 @@ def test_conversion_from_path_241(self): # pragma: no cover
211211
@profile
212212
@unittest.skipIf(not POPPLER_INSTALLED, "Poppler is not installed!")
213213
@unittest.skipIf(
214-
"TRAVIS" in os.environ and os.environ["TRAVIS"] == "true",
215-
"Skipping this test on Travis CI.",
214+
"CIRCLECI" in os.environ and os.environ["CIRCLECI"] == "true",
215+
"Skipping this test on CircleCI.",
216216
)
217217
def test_conversion_from_bytes_using_dir_241(self): # pragma: no cover
218218
start_time = time.time()
@@ -232,8 +232,8 @@ def test_conversion_from_bytes_using_dir_241(self): # pragma: no cover
232232
@profile
233233
@unittest.skipIf(not POPPLER_INSTALLED, "Poppler is not installed!")
234234
@unittest.skipIf(
235-
"TRAVIS" in os.environ and os.environ["TRAVIS"] == "true",
236-
"Skipping this test on Travis CI.",
235+
"CIRCLECI" in os.environ and os.environ["CIRCLECI"] == "true",
236+
"Skipping this test on CircleCI.",
237237
)
238238
def test_conversion_from_path_using_dir_241(self): # pragma: no cover
239239
start_time = time.time()
@@ -785,8 +785,8 @@ def test_conversion_from_path_using_dir_14_with_4_threads(self):
785785

786786
@profile
787787
@unittest.skipIf(
788-
"TRAVIS" in os.environ and os.environ["TRAVIS"] == "true",
789-
"Skipping this test on Travis CI.",
788+
"CIRCLECI" in os.environ and os.environ["CIRCLECI"] == "true",
789+
"Skipping this test on CircleCI.",
790790
)
791791
@unittest.skipIf(not POPPLER_INSTALLED, "Poppler is not installed!")
792792
def test_conversion_from_bytes_241_with_4_threads(self): # pragma: no cover
@@ -802,8 +802,8 @@ def test_conversion_from_bytes_241_with_4_threads(self): # pragma: no cover
802802

803803
@profile
804804
@unittest.skipIf(
805-
"TRAVIS" in os.environ and os.environ["TRAVIS"] == "true",
806-
"Skipping this test on Travis CI.",
805+
"CIRCLECI" in os.environ and os.environ["CIRCLECI"] == "true",
806+
"Skipping this test on CircleCI.",
807807
)
808808
@unittest.skipIf(not POPPLER_INSTALLED, "Poppler is not installed!")
809809
def test_conversion_from_path_241_with_4_threads(self): # pragma: no cover
@@ -818,8 +818,8 @@ def test_conversion_from_path_241_with_4_threads(self): # pragma: no cover
818818

819819
@profile
820820
@unittest.skipIf(
821-
"TRAVIS" in os.environ and os.environ["TRAVIS"] == "true",
822-
"Skipping this test on Travis CI.",
821+
"CIRCLECI" in os.environ and os.environ["CIRCLECI"] == "true",
822+
"Skipping this test on CircleCI.",
823823
)
824824
@unittest.skipIf(not POPPLER_INSTALLED, "Poppler is not installed!")
825825
def test_conversion_from_bytes_using_dir_241_with_4_threads(
@@ -841,8 +841,8 @@ def test_conversion_from_bytes_using_dir_241_with_4_threads(
841841

842842
@profile
843843
@unittest.skipIf(
844-
"TRAVIS" in os.environ and os.environ["TRAVIS"] == "true",
845-
"Skipping this test on Travis CI.",
844+
"CIRCLECI" in os.environ and os.environ["CIRCLECI"] == "true",
845+
"Skipping this test on CircleCI.",
846846
)
847847
@unittest.skipIf(not POPPLER_INSTALLED, "Poppler is not installed!")
848848
def test_conversion_from_path_using_dir_241_with_4_threads(

0 commit comments

Comments
 (0)