-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
278e947
commit 17e1896
Showing
2 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Use the latest 2.1 version of CircleCI pipeline process engine. | ||
# See: https://circleci.com/docs/2.0/configuration-reference | ||
version: 2.1 | ||
|
||
# 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. | ||
# See: https://circleci.com/docs/2.0/orb-intro/ | ||
orbs: | ||
# The python orb contains a set of prepackaged CircleCI configuration you can use repeatedly in your configuration files | ||
# Orb commands and jobs help you with common scripting around a language/tool | ||
# so you dont have to copy and paste it everywhere. | ||
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python | ||
codecov: codecov/[email protected] | ||
python: circleci/[email protected] | ||
|
||
# Define a job to be invoked later in a workflow. | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs | ||
jobs: | ||
build: | ||
docker: | ||
- image: cimg/python:3.6.10 | ||
environment: | ||
DATABASE_URL: postgresql://postgresql:test123@localhost/test?sslmode=disable | ||
- image: circleci/postgres:9.6.2 | ||
environment: | ||
POSTGRES_USER: postgresql | ||
POSTGRES_DB: test | ||
parameters: | ||
publish_pypi: | ||
type: string | ||
default: "" | ||
steps: | ||
- checkout | ||
- run: sudo apt-get update | ||
- run: sudo apt-get install postgresql-client | ||
- run: whoami | ||
- run: | | ||
psql \ | ||
-d "postgresql://postgresql:test123@localhost/test?sslmode=disable" \ | ||
-c "CREATE TABLE metrics (id serial NOT NULL PRIMARY KEY, url TEXT, http_status TEXT, day TEXT, month TEXT, year TEXT, time TEXT,elapsed_time TEXT, pattern_verified TEXT);" | ||
- run: | ||
name: Retrieve Kafka C Handler | ||
command: | | ||
git clone https://github.com/edenhill/librdkafka.git | ||
cd librdkafka && ./configure --prefix /usr && make && sudo make install | ||
- python/install-packages: | ||
pkg-manager: pip | ||
|
||
- run: | ||
name: Run tests and Run Coverage | ||
command: | | ||
pip install coverage | ||
coverage run -m unittest tests/all_tests.py | ||
coverage xml | ||
- codecov/upload: | ||
file: './coverage.xml' | ||
token: $CODECOV_TOKEN | ||
- when: | ||
condition: <<parameters.publish_pypi>> | ||
steps: | ||
- run: | ||
name: Publish package | ||
command: | | ||
pip3 install --upgrade pip | ||
sudo apt-get install build-essential libssl-dev libffi-dev python-dev | ||
pip3 install cryptography | ||
python3 -m pip install --upgrade build | ||
pip3 install twine | ||
python -m build | ||
python3 -m twine upload dist/* | ||
- store_test_results: | ||
path: test-results | ||
- store_artifacts: | ||
path: test-results | ||
destination: tr1 | ||
publish_pypi: | ||
parameters: | ||
custom_checkout: | ||
type: string | ||
default: "" | ||
machine: true | ||
steps: | ||
- when: | ||
condition: <<parameters.custom_checkout>> | ||
steps: | ||
- run: echo "my custom checkout" | ||
- unless: | ||
condition: <<parameters.custom_checkout>> | ||
steps: | ||
- checkout | ||
# Invoke jobs via workflows | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows | ||
workflows: | ||
build_and_publish: | ||
jobs: | ||
- build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters