Skip to content

Commit

Permalink
ci: add support for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme Deuchnord committed Apr 23, 2021
1 parent 3abfbe9 commit aba76b8
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 144 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
66 changes: 0 additions & 66 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Commit lint
name: Commit

on:
push:
Expand All @@ -8,6 +8,7 @@ on:

jobs:
commitlint:
name: Message validation
runs-on: ubuntu-latest

steps:
Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
74 changes: 0 additions & 74 deletions .github/workflows/unit-tests.yml

This file was deleted.

7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
tests += t

if failures == 0:
print("All %d tests successfully passed." % tests)
print("All %d tests successfully passed." % tests)
else:
exit(1)

0 comments on commit aba76b8

Please sign in to comment.