diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2fff70b0..fa02f514 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,14 +60,26 @@ jobs: continue-on-error: true steps: - uses: actions/checkout@v2 + - run: git fetch --prune --unshallow - uses: actions/setup-python@v2 with: python-version: 3.8.x + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: pip-ubuntu-latest-py3.8-${{ hashFiles('Pipfile.lock') }} + restore-keys: | + pip-ubuntu-latest-py3.8-${{ hashFiles('Pipfile.lock') }} + pip-ubuntu-latest-py3.8- + - uses: actions/cache@v1 + with: + path: ~/.local/share/virtualenvs + key: virtualenvs-ubuntu-latest-py3.8-${{ hashFiles('Pipfile.lock') }} + restore-keys: | + virtualenvs-ubuntu-latest-py3.8-${{ hashFiles('Pipfile.lock') }} + virtualenvs-ubuntu-latest-py3.8- - run: pip install -U -I --pre pipenv pip - - run: pipenv lock --dev --pre --requirements | awk -F= '{ print $1 }' >requirements-unlocked.txt - - run: pipenv run pip install --pre -r requirements-unlocked.txt - - run: pipenv run pip freeze - - run: rm -vf requirements-unlocked.txt + - run: make deps-prerelease - run: make fmt - run: make lint - run: pipenv run python setup.py --version diff --git a/.gitignore b/.gitignore index 281343ab..9f067926 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ /.idea/ /.jupyter/ /.local/ +/.pipenv-requires /build/ /dist/ /node_modules/ diff --git a/Makefile b/Makefile index 6870c392..9a06ee98 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,10 @@ fmt-3.5: .fmt-unsupported @echo ERROR: This python version cannot run the fmting tools @exit 1 +.PHONY: deps-prerelease +deps-prerelease: + pipenv run ./scripts/install-deps-prerelease + deps-%: $(RUNNER) 'pipenv run ./scripts/install-deps' diff --git a/scripts/install-deps b/scripts/install-deps index 02e25fa8..ea6cc145 100755 --- a/scripts/install-deps +++ b/scripts/install-deps @@ -1,18 +1,23 @@ #!/usr/bin/env bash set -o errexit set -o pipefail -set -o xtrace -case "${PYTHON_VERSION}" in -2* | 3.5*) - pipenv install --skip-lock - pipenv run pip install \ - pytest \ - pytest-cov \ - 'coverage[toml]' \ - setuptools_scm - ;; -*) - pipenv install --dev - ;; -esac +main() { + set -o xtrace + + case "${PYTHON_VERSION}" in + 2* | 3.5*) + pipenv install --skip-lock + pipenv run pip install \ + pytest \ + pytest-cov \ + 'coverage[toml]' \ + setuptools_scm + ;; + *) + pipenv install --dev + ;; + esac +} + +main "${@}" diff --git a/scripts/install-deps-prerelease b/scripts/install-deps-prerelease new file mode 100755 index 00000000..b33f5041 --- /dev/null +++ b/scripts/install-deps-prerelease @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -o errexit +set -o pipefail + +main() { + set -o xtrace + + local top + top="$(git rev-parse --show-toplevel)" + + local pipenv_requires="${top}/.pipenv-requires" + + pipenv install --dev + _print_pipfile_packages >"${pipenv_requires}" + pipenv run pip install -U --pre -r "${pipenv_requires}" + rm -f "${pipenv_requires}" +} + +_print_pipfile_packages() { + pipenv run python <=7.0.0 setup_requires = setuptools + setuptools_scm>=3.4 + toml + wheel packages = rsconnect python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* zip_safe = true