-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
109 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# 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 timeout $sleep_seconds pip install . || [[ $attempt_num -eq $max_attempts ]] | ||
do | ||
echo "Attempt $attempt_num of $max_attempts failed! Trying again in $sleep_seconds seconds..." | ||
sleep $sleep_seconds | ||
((attempt_num++)) | ||
done | ||
if [[ $attempt_num -eq $max_attempts ]]; then | ||
echo "All $max_attempts attempts have failed!" | ||
exit 1 | ||
fi | ||
- 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: | ||
fail-fast: false | ||
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: 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 | ||
cp packaging/setup.py . | ||
pip install . | ||
coverage run --rcfile=packaging/coverage.ini -m unittest discover tests | ||
coverage report --rcfile=packaging/coverage.ini | ||
coveralls |
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 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 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