Skip to content

Cache services calls #56

Cache services calls

Cache services calls #56

Workflow file for this run

name: Python CI
on: [ push, pull_request ]
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [ 3.7, 3.8, 3.9, '3.10' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Env
run: |
echo "Event name: ${{ github.event_name }}"
echo "Git ref: ${{ github.ref }}"
echo "GH actor: ${{ github.actor }}"
echo "SHA: ${{ github.sha }}"
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v3
id: cache
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/Pipfile') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-pip-
- name: Install dependencies
run: |
pip install pipenv
pipenv install --dev
- name: Run black --check .
run: |
pipenv run black --check .
# TODO check `pipenv run pytest`
- name: Test with pytest
run: |
pipenv run python -m pytest --cov=arc --cov-report=term
# - name: Coverage with pytest-cov
# run: |
# pipenv run python -m pytest --cov=arc --cov-fail-under=51 --cov-report=html:output/coverage --cov-report=term
# - name: Archive code coverage results
# uses: actions/upload-artifact@v2
# with:
# name: code-coverage-report ${{ matrix.os }} ${{ matrix.python-version }}
# path: output/coverage/
# Build python package
# build:
# needs: test
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: 3.8
# - name: Install pypa/build
# run: >-
# python -m
# pip install
# build
# --user
# - name: Build a binary wheel and a source tarball
# run: >-
# python -m
# build
# --sdist
# --wheel
# --outdir dist/
# .
# - name: Publish distribution 📦 to Test PyPI
# uses: pypa/gh-action-pypi-publish@main
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
# - name: Publish distribution 📦 to PyPI
# if: startsWith(github.ref, 'refs/tags')
# uses: pypa/gh-action-pypi-publish@main
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}