@@ -9,6 +9,9 @@ insert_final_newline = true | |||
max_line_length = 120 | |||
trim_trailing_whitespace = true | |||
[*.{yml,yaml}] | |||
indent_size = 2 | |||
[*.md] | |||
trim_trailing_whitespace = false | |||
@@ -1,66 +0,0 @@ | |||
# For most projects, this workflow file will not need changing; you simply need | |||
# to commit it to your repository. | |||
# | |||
# You may wish to alter this file to override the set of languages analyzed, | |||
# or to provide custom queries or build logic. | |||
name: "CodeQL" | |||
on: | |||
push: | |||
branches: [main, features] | |||
pull_request: | |||
branches: [main, features] | |||
schedule: | |||
- cron: '0 8 * * 0' | |||
jobs: | |||
analyze: | |||
name: Analyze | |||
runs-on: ubuntu-latest | |||
strategy: | |||
fail-fast: false | |||
matrix: | |||
language: ['python'] | |||
steps: | |||
- name: Checkout repository | |||
uses: actions/checkout@v2 | |||
with: | |||
# We must fetch at least the immediate parents so that if this is | |||
# a pull request then we can checkout the head. | |||
fetch-depth: 2 | |||
# If this run was triggered by a pull request event, then checkout | |||
# the head of the pull request instead of the merge commit. | |||
- run: git checkout HEAD^2 | |||
if: ${{ github.event_name == 'pull_request' }} | |||
# Initializes the CodeQL tools for scanning. | |||
- name: Initialize CodeQL | |||
uses: github/codeql-action/init@v1 | |||
with: | |||
languages: ${{ matrix.language }} | |||
# If you wish to specify custom queries, you can do so here or in a config file. | |||
# By default, queries listed here will override any specified in a config file. | |||
# Prefix the list here with "+" to use these queries and those in the config file. | |||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | |||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | |||
# If this step fails, then you should remove it and run the build manually (see below) | |||
- name: Autobuild | |||
uses: github/codeql-action/autobuild@v1 | |||
# ℹ️ Command-line programs to run using the OS shell. | |||
# 📚 https://git.io/JvXDl | |||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | |||
# and modify them (or add more) to build your code if your project | |||
# uses a compiled language | |||
#- run: | | |||
# make bootstrap | |||
# make release | |||
- name: Perform CodeQL Analysis | |||
uses: github/codeql-action/analyze@v1 |
@@ -1,4 +1,4 @@ | |||
name: Commit lint | |||
name: Commit | |||
on: | |||
push: | |||
@@ -8,6 +8,7 @@ on: | |||
jobs: | |||
commitlint: | |||
name: Message validation | |||
runs-on: ubuntu-latest | |||
steps: | |||
@@ -0,0 +1,110 @@ | |||
name: Tests | |||
on: | |||
push: | |||
branches: [main, features] | |||
pull_request: | |||
branches: [main, features] | |||
jobs: | |||
legacy-tests: | |||
runs-on: ${{ matrix.os }} | |||
strategy: | |||
fail-fast: false | |||
matrix: | |||
os: | |||
- ubuntu-18.04 | |||
- ubuntu-20.04 | |||
- macos-10.15 | |||
- macos-11.0 | |||
- windows-2019 | |||
python_version: | |||
- '3.7' | |||
- '3.8' | |||
- '3.9' | |||
name: Legacy tests (Python ${{ matrix.python_version }} on ${{ matrix.os }}) | |||
steps: | |||
- uses: actions/checkout@v1 | |||
- name: Set up Python | |||
uses: actions/setup-python@v1 | |||
with: | |||
python-version: ${{ matrix.python_version }} | |||
- name: Prepare environment | |||
run: | | |||
pip install --upgrade pip pipenv | |||
- name: Install dependencies (all systems) | |||
run: | | |||
pipenv lock --pre | |||
pipenv sync --dev | |||
pipenv install --dev | |||
- name: Install dependencies (Windows-specific) | |||
if: ${{ matrix.os == 'windows-2019' }} | |||
run: | | |||
pipenv lock --dev -r > requirements.txt | |||
pip install -r requirements.txt | |||
- name: Run legacy tests | |||
run: | | |||
make legacy-tests | |||
doc-tests: | |||
runs-on: ${{ matrix.os }} | |||
strategy: | |||
fail-fast: false | |||
matrix: | |||
os: | |||
- ubuntu-18.04 | |||
- ubuntu-20.04 | |||
- macos-10.15 | |||
- macos-11.0 | |||
- windows-2019 | |||
python_version: | |||
- '3.7' | |||
- '3.8' | |||
- '3.9' | |||
name: Doc tests (Python ${{ matrix.python_version }} on ${{ matrix.os }}) | |||
steps: | |||
- uses: actions/checkout@v1 | |||
- name: Set up Python | |||
uses: actions/setup-python@v1 | |||
with: | |||
python-version: ${{ matrix.python_version }} | |||
- name: Prepare environment | |||
run: | | |||
pip install --upgrade pip pipenv | |||
- name: Install dependencies (all systems) | |||
run: | | |||
pipenv lock --pre | |||
pipenv sync --dev | |||
pipenv install --dev | |||
- name: Install dependencies (Windows-specific) | |||
if: ${{ matrix.os == 'windows-2019' }} | |||
run: | | |||
pipenv lock -r > requirements.txt | |||
pip install -r requirements.txt | |||
- name: Run doc tests (with coverage) | |||
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.python_version == '3.9' }} | |||
run: | | |||
make coverage-doctests | |||
- name: Run doc tests | |||
if: ${{ matrix.os != 'ubuntu-20.04' && matrix.python_version != '3.9' }} | |||
run: | | |||
make doctests | |||
- name: Push code coverage | |||
env: | |||
COVERALLS_PRO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} | |||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |||
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.python_version == '3.9' }} | |||
run: | | |||
pipenv run coveralls --service=github |
@@ -1,74 +0,0 @@ | |||
name: Unit tests | |||
on: | |||
push: | |||
branches: [main, features] | |||
pull_request: | |||
branches: [main, features] | |||
jobs: | |||
legacy-unit-tests: | |||
runs-on: ${{ matrix.os }} | |||
strategy: | |||
fail-fast: false | |||
matrix: | |||
os: | |||
- ubuntu-18.04 | |||
- ubuntu-20.04 | |||
- macos-10.15 | |||
- macos-11.0 | |||
python-version: | |||
- '3.7' | |||
- '3.8' | |||
- '3.9' | |||
name: Legacy unit tests (Python ${{ matrix.python-version }} on ${{ matrix.os }}) | |||
steps: | |||
- uses: actions/checkout@v1 | |||
- name: Set up Python | |||
uses: actions/setup-python@v1 | |||
with: | |||
python-version: ${{ matrix.python-version }} | |||
- name: Install dependencies | |||
run: | | |||
pip install --upgrade pip pipenv | |||
pipenv lock --pre | |||
pipenv sync --dev | |||
- name: Unit tests | |||
run: | | |||
make legacy-tests | |||
unit-tests: | |||
runs-on: ${{ matrix.os }} | |||
strategy: | |||
fail-fast: false | |||
matrix: | |||
os: | |||
- ubuntu-18.04 | |||
- ubuntu-20.04 | |||
- macos-10.15 | |||
- macos-11.0 | |||
python-version: | |||
- '3.7' | |||
- '3.8' | |||
- '3.9' | |||
name: Unit tests (Python ${{ matrix.python-version }} on ${{ matrix.os }}) | |||
steps: | |||
- uses: actions/checkout@v1 | |||
- name: Set up Python | |||
uses: actions/setup-python@v1 | |||
with: | |||
python-version: ${{ matrix.python-version }} | |||
- name: Install dependencies | |||
run: | | |||
pip install --upgrade pip pipenv | |||
pipenv lock --pre | |||
pipenv sync --dev | |||
- name: Unit tests | |||
env: | |||
COVERALLS_PRO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} | |||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |||
run: | | |||
make doctests | |||
pipenv run coveralls --service=github |
@@ -4,14 +4,17 @@ black: | |||
.PHONY: tests | |||
tests: legacy-tests doctests | |||
doctests: | |||
coverage-doctests: | |||
pipenv run python3 -m coverage run tests.py | |||
doctests: | |||
pipenv run python3 tests.py | |||
legacy-tests: | |||
unset KOSMORRO_LATITUDE; \ | |||
unset KOSMORRO_LONGITUDE; \ | |||
unset KOSMORRO_TIMEZONE; \ | |||
pipenv run python3 -m coverage run -m unittest tests | |||
pipenv run python3 -m unittest tests | |||
.PHONY: build | |||
build: | |||
@@ -15,6 +15,6 @@ if __name__ == "__main__": | |||
tests += t | |||
if failures == 0: | |||
print("✔ All %d tests successfully passed." % tests) | |||
print("All %d tests successfully passed." % tests) | |||
else: | |||
exit(1) |