From 0c7a2971db63b3331ea1b35403adde3f1f767412 Mon Sep 17 00:00:00 2001 From: p-goulart Date: Fri, 12 Jan 2024 18:02:55 +0100 Subject: [PATCH] Add linting and testing workflows --- .github/workflows/flake8.yml | 26 ++++++++++++++++++++++ .github/workflows/pytest.yml | 43 ++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 .github/workflows/flake8.yml create mode 100644 .github/workflows/pytest.yml diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml new file mode 100644 index 0000000..4714730 --- /dev/null +++ b/.github/workflows/flake8.yml @@ -0,0 +1,26 @@ +name: Flake8 + +on: + push: + paths: + - "**/*.py" + - "pyproject.toml" + - "poetry.lock" + - ".github/workflows/flake8.yml" + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: flake8 Lint + uses: py-actions/flake8@v2 + with: + exclude: "**/.archive/" diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..39bbb42 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,43 @@ +name: Pytest + +on: + push: + paths: + - "**/*.py" + - "tests/" + - "pyproject.toml" + - "poetry.lock" + - ".github/workflows/pytest.yml" + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11"] + env: + LT_HOME: foo/lt/home + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Set up Poetry + uses: Gr1N/setup-poetry@v8 + - name: Check Poetry config + run: poetry check + - name: Install dependencies + run: poetry install --with test + env: + POETRY_HTTP_BASIC_GITLAB_USERNAME: "lt-ai-package-registry" + POETRY_HTTP_BASIC_GITLAB_PASSWORD: ${{ secrets.POETRY_HTTP_BASIC_GITLAB_PASSWORD }} + - name: Install spaCy pipeline + run: poetry run spacy download pt_core_news_sm + - name: Pytest + uses: pavelzw/pytest-action@v2 + with: + custom-pytest: "poetry run pytest" + emoji: true + verbose: true + job-summary: true