Skip to content

armgit / fli

Public Imported from GitHub
0

Google Flights MCP, CLI and Python Library

Add lint and test workflows

Punit Arania27247dc03d6
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 0000000..b5514b0
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,33 @@
+name: Lint
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+ workflow_dispatch:
+ workflow_call:
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.12"
+ cache: 'pip'
+ cache-dependency-path: |
+ requirements*.txt
+ pyproject.toml
+
+ - name: Install Ruff
+ run: pip install ruff
+
+ - name: Check formatting
+ run: ruff format . --check
+
+ - name: Check style
+ run: ruff check .
\ No newline at end of file
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index adb22b4..a90b400 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -9,7 +9,11 @@ permissions:
contents: read
jobs:
+ test:
+ uses: ./.github/workflows/test.yml
+
release-build:
+ needs: [ test ]
runs-on: ubuntu-latest
steps:
@@ -18,11 +22,23 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
+ cache: 'pip'
+ cache-dependency-path: |
+ poetry.lock
+ pyproject.toml
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
+ - name: Cache Poetry virtualenv
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pypoetry
+ key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-poetry-
+
- name: Build release distributions
run: |
poetry build
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..c994676
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,52 @@
+name: Run Tests
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+ workflow_dispatch:
+ workflow_call:
+
+jobs:
+ lint:
+ uses: ./.github/workflows/lint.yml
+
+ test:
+ needs: [ lint ]
+ runs-on: ubuntu-latest
+ strategy:
+ 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 }}
+ cache: 'pip'
+ cache-dependency-path: |
+ poetry.lock
+ pyproject.toml
+
+ - name: Install Poetry
+ run: |
+ curl -sSL https://install.python-poetry.org | python3 -
+
+ - name: Cache Poetry virtualenv
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pypoetry
+ key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-poetry-
+
+ - name: Install dependencies
+ run: |
+ poetry install --with dev
+
+ - name: Run tests
+ run: |
+ poetry run pytest tests/ --all -v