Skip to content

Commit

Permalink
Add pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrgredowski committed Aug 27, 2023
1 parent 711432f commit 294ef65
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 11 deletions.
23 changes: 23 additions & 0 deletions .github/actions/setup-ci/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Setup CI
description: Setup Python and pre-commit for CI
runs:
using: composite
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: |
requirements.lock
requirements-dev.lock
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements.lock -r requirements-dev.lock
- name: Cache pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python and pre-commit
uses: ./.github/actions/setup-ci
- name: Pre-commit
run: |
SKIP=unittests pre-commit run --all-files --color=always
unittests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python and pre-commit
uses: ./.github/actions/setup-ci
- name: Test with pytest
run: |
python -m pytest tests
23 changes: 12 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ repos:
# - id: mypy
# args: [--ignore-missing-imports, --follow-imports=skip]

# - repo: local
# hooks:
# - id: unittests
# name: run unit tests
# entry: python -m pytest
# language: system
# pass_filenames: false
# always_run: true
# args: [
# --doctest-modules
# ]
- repo: local
hooks:
- id: unittests
name: run unit tests
entry: python -m pytest
language: system
pass_filenames: false
always_run: true
args: [
tests,
--doctest-modules
]

0 comments on commit 294ef65

Please sign in to comment.