Skip to content

Commit

Permalink
ci: setup unit-test workflow
Browse files Browse the repository at this point in the history
by extracting a composite action from the `test-dataset` workflow
  • Loading branch information
texhnolyze committed Dec 19, 2024
1 parent 22e1781 commit 802963c
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 10 deletions.
23 changes: 23 additions & 0 deletions .github/actions/setup-repo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Setup Repository
description: Checkout code, install poetry, set up python and install dependencies
inputs:
python-version:
description: "Python version to use"
required: true
default: "3.x"
runs:
using: "composite"
steps:
- name: Install poetry
run: pipx install poetry
shell: bash

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: "poetry"

- name: Install dependencies
run: poetry install
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,25 @@ on:
- main

jobs:
test_dataset:
test-dataset:
strategy:
matrix:
include:
- os: ubuntu-22.04
python-version: 3.10.x
- os: ubuntu-24.04
python-version: 3.12.x

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
- name: Setup repository
uses: ./.github/actions/setup-repo
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"

- name: Install dependencies
run: poetry install

- name: Create DB schema
run: poetry run cli db create-schema
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run pytest unit tests

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

jobs:
unit-tests:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-22.04]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup repository
uses: ./.github/actions/setup-repo

- name: Run pytest unit tests
run: poetry run pytest tests

0 comments on commit 802963c

Please sign in to comment.