updates from other projects #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: build | |
on: | |
push: | |
branches: [ "master", "dev" ] | |
tags: | |
- '[0-9]+' | |
jobs: | |
test: | |
if: github.ref != 'refs/heads/dev' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }}- | |
${{ runner.os }}-pip- | |
- name: Install Dependencies with Retry | |
run: | | |
cp packaging/setup.py . | |
max_attempts=5 | |
sleep_seconds=10 | |
attempt_num=1 | |
until pip install .; do | |
echo "Attempt $attempt_num of $max_attempts failed! Trying again in $sleep_seconds seconds..." | |
sleep $sleep_seconds | |
((attempt_num++)) | |
if [[ $attempt_num -eq $max_attempts ]]; then | |
echo "All $max_attempts attempts have failed!" | |
exit 1 | |
fi | |
done | |
- name: Install Test Dependencies | |
run: | | |
python tests/smoke_test.py | |
python -m pip install --upgrade pip | |
pip install --no-deps -r tests/requirements.lock | |
pip install . | |
- name: Run Tests | |
env: | |
CI: true | |
run: | | |
python -m unittest discover tests -v | |
coverage: | |
if: github.ref == 'refs/heads/dev' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }}- | |
${{ runner.os }}-pip- | |
- name: Install Dependencies with Retry | |
run: | | |
cp packaging/setup.py . | |
max_attempts=5 | |
sleep_seconds=10 | |
attempt_num=1 | |
until pip install .; do | |
echo "Attempt $attempt_num of $max_attempts failed! Trying again in $sleep_seconds seconds..." | |
sleep $sleep_seconds | |
((attempt_num++)) | |
if [[ $attempt_num -eq $max_attempts ]]; then | |
echo "All $max_attempts attempts have failed!" | |
exit 1 | |
fi | |
done | |
- name: Coverage | |
env: | |
COVERAGE: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
python -m pip install --upgrade pip | |
pip install --no-deps -r tests/requirements.lock | |
pip install coverage coveralls | |
pip install . | |
coverage run --rcfile=packaging/coverage.ini -m unittest discover tests | |
coverage report --rcfile=packaging/coverage.ini | |
coveralls |