Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows CI builds #361

Merged
merged 23 commits into from
Jun 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d1cbc57
CI updates
duckontheweb Jun 1, 2021
b0a8647
Skip posix-specific tests on Windows
duckontheweb Jun 1, 2021
97653a3
Use explicit utf-8 encoding
duckontheweb Jun 1, 2021
e6961b5
Use CWD for temp test directories
duckontheweb Jun 1, 2021
0af9df8
Use platform-independent path joins for all URL joins
duckontheweb Jun 1, 2021
f18e90d
Fix path handling for relative/absolute hrefs on Windows
duckontheweb Jun 1, 2021
612a737
Some lint fixes
duckontheweb Jun 1, 2021
6e0eef7
Merge remote-tracking branch 'stac-utils/main' into windows-ci-fixes-…
duckontheweb Jun 1, 2021
8e9455c
Preserve case of drives in Windows paths
duckontheweb Jun 1, 2021
a858c4c
Updates to workflow config
duckontheweb Jun 1, 2021
a5dcc7e
Merge remote-tracking branch 'stac-utils/main' into windows-ci-fixes
duckontheweb Jun 2, 2021
316c27c
Lint setup.py
duckontheweb Jun 3, 2021
cab1f11
Use importlib instead of deprecated imp
duckontheweb Jun 3, 2021
e014738
Merge remote-tracking branch 'stac-utils/main' into windows-ci-fixes
duckontheweb Jun 3, 2021
b6e778a
Put version in setup.cfg
duckontheweb Jun 3, 2021
5685421
Merge remote-tracking branch 'stac-utils/main' into windows-ci-fixes
duckontheweb Jun 4, 2021
a56d3e7
Test preserving trailing slash in relative paths
duckontheweb Jun 4, 2021
c48c15b
Newline in setup.cfg and remove unneeded parentheses
duckontheweb Jun 4, 2021
cff9606
Handle relative paths for dotfiles properly
duckontheweb Jun 4, 2021
b5a0fbd
Only add trailing slash to derived directory path
duckontheweb Jun 4, 2021
3467b4c
Simplify dirname logic for URLs
duckontheweb Jun 4, 2021
1ed631f
Move custom tempdir logic to test utils
duckontheweb Jun 4, 2021
d23be0a
Use function instead of class for temp_dir, fix type issue
duckontheweb Jun 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 76 additions & 9 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@ on:
pull_request:

jobs:
build:
name: build
test:
name: test
runs-on: ${{ matrix.os }}
strategy:
# Allow other matrix jobs to complete if 1 fails
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8"]
os: [ubuntu-latest, windows-latest, macos-latest]
python-version:
- "3.6"
- "3.7"
- "3.8"
os:
- ubuntu-latest
- windows-latest
- macos-latest

steps:
- uses: actions/checkout@v2

Expand All @@ -24,15 +31,38 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Cache dependencies
- name: Cache dependencies (Linux)
if: startsWith(runner.os, 'Linux')
uses: actions/cache@v2
with:
path: ~/.cache/pip
# Cache based on OS, Python version, and dependency hash
key: pip-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('requirements-dev.txt') }}
key: test-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('requirements-test.txt') }}

- name: Cache dependencies (macOS)
if: startsWith(runner.os, 'macOS')
uses: actions/cache@v2
with:
path: ~/Library/Caches/pip
# Cache based on OS, Python version, and dependency hash
key: test-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('requirements-test.txt') }}

- name: Cache dependencies (Windows)
if: startsWith(runner.os, 'Windows')
uses: actions/cache@v2
with:
path: ~\AppData\Local\pip\Cache
# Cache based on OS, Python version, and dependency hash
key: test-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('requirements-test.txt') }}

- name: Install dependencies
run: |
pip install -r requirements-test.txt
pip install -e ".[validation]"

- name: Execute linters and test suites
run: ./scripts/cibuild
- name: Execute test suite
run: ./scripts/test
shell: bash

- name: Upload All coverage to Codecov
uses: codecov/codecov-action@v1
Expand All @@ -42,14 +72,51 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
vanilla:
lint:
runs-on: ubuntu-latest
strategy:
# Allow other matrix jobs to complete if 1 fails
fail-fast: false
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
# Cache based on OS, Python version, and dependency hash
key: lint-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('requirements-test.txt') }}

- name: Install dependencies
run: |
pip install -r requirements-test.txt
pip install -e .

- name: Execute linters & type checkers
run: ./scripts/lint

vanilla:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: "3.8"

- name: Install without orjson
run: pip install '.[validation]'

- name: Run unittests
run: python -m unittest discover tests
11 changes: 1 addition & 10 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
mypy==0.790
flake8==3.8.*
black==21.4b2

codespell==1.17.1
ipython==7.16.1
jsonschema==3.2.0
pylint==1.9.1
Sphinx==3.5.4
sphinx-autobuild==0.7.1
sphinxcontrib-fulltoc==1.2.0
nbsphinx==0.7.1
coverage==5.2.*

# https://github.com/pydata/xarray/issues/5299#issuecomment-840730954
jinja2<3.0

# optional dependencies
orjson==3.5.2
-r ./requirements-test.txt
12 changes: 12 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
mypy==0.812
flake8==3.8.*
black==21.4b2

codespell==1.17.1

jsonschema==3.2.0
pylint==1.9.1
coverage==5.2.*

# optional dependencies
orjson==3.5.2
27 changes: 0 additions & 27 deletions scripts/cibuild

This file was deleted.

36 changes: 36 additions & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

set -e

echo
echo " -- CHECKING TYPES WITH PYRIGHT --"
echo

scripts/pyright pystac tests

echo
echo " -- LINTING WITH FLAKE8 --"
echo

flake8 pystac tests

echo
echo " -- CHECKING FORMAT WITH BLACK --"
echo

black --check pystac
black --check tests

echo
echo " -- CHECKING SPELLING WITH CODESPELL --"
echo

# Code spelling
codespell -I .codespellignore -f \
pystac/*.py pystac/**/*.py \
tests/*.py tests/**/*.py \
docs/*.rst docs/**/*.rst \
docs/*.ipynb docs/**/*.ipynb \
scripts/* \
*.py \
*.md
62 changes: 8 additions & 54 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,14 @@

set -e

if [[ -n "${CI}" ]]; then
set -x
if [[ -z ${CI} ]]; then
source ./scripts/lint
fi

function usage() {
echo -n \
"Usage: $(basename "$0")
Execute project linters and test suites.
"
}
echo
echo " -- RUNNING UNIT TESTS --"
echo

if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
if [ "${1:-}" = "--help" ]; then
usage
else
echo
echo " -- CHECKING TYPES WITH PYRIGHT --"
echo

scripts/pyright pystac tests

echo
echo " -- LINTING WITH FLAKE8 --"
echo

flake8 pystac tests

echo
echo " -- CHECKING FORMAT WITH BLACK --"
echo

black --check pystac
black --check tests

echo
echo " -- CHECKING SPELLING WITH CODESPELL --"
echo

# Code spelling
codespell -I .codespellignore -f \
pystac/*.py pystac/**/*.py \
tests/*.py tests/**/*.py \
docs/*.rst docs/**/*.rst \
docs/*.ipynb docs/**/*.ipynb \
scripts/* \
*.py \
*.md

echo
echo " -- RUNNING UNIT TESTS --"
echo

# Test suite with coverage enabled
coverage run --source=pystac/ -m unittest discover tests/
coverage xml
fi
fi
# Test suite with coverage enabled
coverage run --source=pystac/ -m unittest discover tests/
coverage xml