Skip to content

Commit

Permalink
add branches master to ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniodimariano committed Oct 15, 2021
1 parent 278e947 commit 17e1896
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 2 deletions.
96 changes: 96 additions & 0 deletions .circleci/config.yml
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Run Python Tests
on:
push:
branches:
- actions
- master
pull_request:
branches:
- actions
- master

jobs:
backend-tests:
Expand Down

0 comments on commit 17e1896

Please sign in to comment.