-
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.
Merge pull request #1 from Indicio-tech/feature/cicd
feat: add ci/cd
- Loading branch information
Showing
5 changed files
with
312 additions
and
1 deletion.
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,48 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Code Quality Check | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
|
||
env: | ||
FLAKE8_VERSION: 3.9.2 | ||
BLACK_VERSION: 21.8b0 | ||
|
||
jobs: | ||
format: | ||
name: Format and Lint Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.6 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.6 | ||
- name: Cache python environment | ||
id: cache-env | ||
uses: actions/cache@v2 | ||
with: | ||
path: env | ||
key: ${{ runner.os }}-format-lint-${{ env.FLAKE8_VERSION }}-${{ env.BLACK_VERSION }}-${{ hashFiles('.github/workflows/code-quality-check.yml') }} | ||
- name: create virtual environment | ||
if: steps.cache-env.outputs.cache-hit != 'true' | ||
run: | | ||
python -m venv env | ||
- name: Install dependencies | ||
if: steps.cache-env.outputs.cache-hit != 'true' | ||
run: | | ||
env/bin/python -m pip install black==${{ env.BLACK_VERSION }} | ||
env/bin/python -m pip install flake8==${{ env.FLAKE8_VERSION }} | ||
- name: Black Format Check | ||
run: | | ||
env/bin/python -m black --check echo_agent tests | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
env/bin/python -m flake8 . --exclude=env --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
env/bin/python -m flake8 . --exclude=env --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
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,64 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
|
||
env: | ||
POETRY_VERSION: 1.1.7 | ||
|
||
jobs: | ||
test: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Cache poetry installation | ||
id: cache-poetry | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.local | ||
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ env.POETRY_VERSION }}-${{ hashFiles('.github/workflows/code-quality-check.yml') }} | ||
- name: Install poetry | ||
if: steps.cache-poetry.outputs.cache-hit != 'true' | ||
run: | | ||
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - --version=${{ env.POETRY_VERSION }} | ||
- name: Setup poetry environment | ||
id: setup-poetry-env | ||
run: | | ||
poetry env use $(which python) | ||
echo "::set-output name=poetry-env::$(poetry env info --path)" | ||
- name: Cache poetry virtual environment | ||
id: cache-poetry-venv | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.setup-poetry-env.outputs.poetry-env }} | ||
key: poetry-env-${{ runner.os }}-${{ matrix.python-version }}-${{ env.POETRY_VERSION }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('.github/workflows/code-quality-check.yml') }} | ||
- name: Install dependencies | ||
if: steps.cache-poetry-venv.outputs.cache-hit != 'true' | ||
run: | | ||
poetry install | ||
- name: Run unit tests with pytest | ||
run: | | ||
poetry run pytest | ||
# int: | ||
# name: Integration Tests | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - name: Run integration tests | ||
# run: | | ||
# docker-compose -f int/docker-compose.yml run tests | ||
# - name: Clean up integration tests | ||
# if: always() | ||
# run: | | ||
# docker-compose -f int/docker-compose.yml down |
Oops, something went wrong.