Skip to content

Release v1.2.0

Release v1.2.0 #134

---
# This workflow will install Python dependencies, run tests and lint
# On publish event, it will build and publish a package to PyPI
name: Lint, Test & Upload fred-py-api
on:
release:
types: [published]
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
env:
FRED_API_KEY: ${{ secrets.FRED_API_KEY }}
TEST_FRED_API_KEY__API: ${{ secrets.TEST_FRED_API_KEY__API }}
TEST_FRED_API_KEY__CLI: ${{ secrets.TEST_FRED_API_KEY__CLI }}
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 dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -e .[ci]
- name: Lint with black
run: |
# Run black on all Python files
black --check ./
- name: Test with coverage
run: |
coverage run -m unittest
coverage report -m
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
pypi:
needs: build
runs-on: ubuntu-22.04
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip build
- name: Build package
run: python3 -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@v1.9.0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}