Skip to content

Commit

Permalink
Setup GitHub Actions to Run Linter + Pytest (#27)
Browse files Browse the repository at this point in the history
* updated project version to next dev version

* added workflow for linting and testing python code

* fix: tests/test.sh -> scripts/test.sh path fix

* explicitly adding _aws_credentials fixture to try and fix error in ci

* fixed ruff violation

* updated moto deps

* setting up fake aws creds in pipeline for testing with moto

* added mkdir command to test script

* fix: removed unnecessary fixture
  • Loading branch information
fullerzz authored Jul 5, 2024
1 parent 0ecc5f0 commit 9f1a7c7
Show file tree
Hide file tree
Showing 5 changed files with 853 additions and 4 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: ci-tests

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

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --all-extras
- name: Code linting
run: |
source .venv/bin/activate
ruff check src/smolvault tests
ruff format --check src/smolvault tests
mypy src/smolvault
- name: Test with pytest
run: |
mkdir ~/.aws && touch ~/.aws/credentials && echo -e "[default]\naws_access_key_id = test\naws_secret_access_key = test" > ~/.aws/credentials
source .venv/bin/activate
bash -c scripts/test.sh
Loading

0 comments on commit 9f1a7c7

Please sign in to comment.