Skip to content

Feature: Command shortcuts #113

Feature: Command shortcuts

Feature: Command shortcuts #113

# 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-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
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@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -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@v2
pypi:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}