Skip to content

Commit

Permalink
ci: test out CI pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixNgFender committed Jan 6, 2024
1 parent 7a075ca commit 4bf54fa
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Python application

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install poetry
run: |
python -m pip install poetry
- name: Configure poetry
run: |
poetry config virtualenvs.in-project true
- name: Cache the virtualenv
uses: actions/cache@v2
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
poetry install
- name: Lint with ruff
run: |
poetry run ruff .
- name: Run tests
run: |
poetry run pytest
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/python-poetry/poetry
rev: '1.7.1'
hooks:
- id: poetry-check
- repo: local
hooks:
- id: black
name: black
entry: poetry run black
language: system
types: [python]
- id: ruff
name: ruff
entry: poetry run ruff . --fix
language: system
types: [python]
6 changes: 6 additions & 0 deletions tests/test_hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from unittest import TestCase


class TestHelloWorld(TestCase):
def test_upper(self):
self.assertEqual("hello world!".upper(), "HELLO WORLD!")

0 comments on commit 4bf54fa

Please sign in to comment.