Skip to content

Commit

Permalink
[gha] Use poetry for tests in GitHub Actions workflow
Browse files Browse the repository at this point in the history
This commit starts using Poetry for the installation
of the dependencies and running the tests in
the GitHub Actions workflow.

It also updates the dependencies and adds flake8 and coverage.

Signed-off-by: Jose Javier Merchante <jjmerchante@bitergia.com>
  • Loading branch information
jjmerchante committed Mar 15, 2022
1 parent 5e2dbd8 commit 757b157
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 19 deletions.
41 changes: 24 additions & 17 deletions .github/workflows/ci.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: build
name: tests

on: [push, pull_request]
on:
push:
branches:
- '**'
tags:
- '!**'
pull_request:
branches:
- '**'

jobs:
tests:
Expand Down Expand Up @@ -41,17 +49,17 @@ jobs:
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: ${{ matrix.elasticsearch-version }}


- name: Install and set up Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade setuptools
pip install --upgrade wheel
pip install "numpy<=1.18.3"
pip install -r "requirements.txt"
pip install -r "requirements_tests.txt"
pip install flake8 coveralls
poetry install -vvv
poetry add -D coveralls
- name: Verify MySQL connection
run: |
sudo apt-get install -y mysql-client libmysqlclient-dev
Expand All @@ -63,14 +71,13 @@ jobs:
curl -fsSL "http://localhost:9200/_cat/health?h=status"
- name: Lint with flake8
run: flake8 . --exclude ./src

run: |
poetry run flake8
- name: Tests and Coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd tests
coverage run --source=sirmordred run_tests.py
# --service=github is a workaround for bug
# https://github.com/coveralls-clients/coveralls-python/issues/251
coveralls --service=github
poetry run coverage run --source=sirmordred run_tests.py
poetry run coveralls --service=github
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SirMordred [![Build Status](https://github.com/chaoss/grimoirelab-sirmordred/workflows/build/badge.svg)](https://github.com/chaoss/grimoirelab-sirmordred/actions?query=workflow:build+branch:master+event:push) [![Coverage Status](https://coveralls.io/repos/github/chaoss/grimoirelab-sirmordred/badge.svg?branch=master)](https://coveralls.io/github/chaoss/grimoirelab-sirmordred?branch=master)
# SirMordred [![Build Status](https://github.com/chaoss/grimoirelab-sirmordred/workflows/tests/badge.svg)](https://github.com/chaoss/grimoirelab-sirmordred/actions?query=workflow:tests+branch:master+event:push) [![Coverage Status](https://coveralls.io/repos/github/chaoss/grimoirelab-sirmordred/badge.svg?branch=master)](https://coveralls.io/github/chaoss/grimoirelab-sirmordred?branch=master)

SirMordred is the tool used to coordinate the execution of the GrimoireLab platform, via two main configuration files, the `setup.cfg` and `projects.json`, which are summarized in their corresponding sections.

Expand Down
56 changes: 55 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ grimoirelab-panels = {git = "https://github.com/chaoss/grimoirelab-sigils"}

[tool.poetry.dev-dependencies]
httpretty = "^1.1.4"
flake8 = "^4.0.1"
coverage = "^6.3.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down

0 comments on commit 757b157

Please sign in to comment.