ci: update ci configs
- add windows runner - update actions versions - other minor enhancements
This commit is contained in:
parent
80c5be7293
commit
637982a5ba
5 changed files with 52 additions and 22 deletions
35
.github/workflows/main.yml
vendored
35
.github/workflows/main.yml
vendored
|
@ -7,31 +7,37 @@ on:
|
||||||
tags: 'v[0-9]+.*' # only trigger on 'release' tags for PyPi
|
tags: 'v[0-9]+.*' # only trigger on 'release' tags for PyPi
|
||||||
# Note that people who fork it need to go to "Actions" tab on their fork and click "I understand my workflows, go ahead and enable them".
|
# Note that people who fork it need to go to "Actions" tab on their fork and click "I understand my workflows, go ahead and enable them".
|
||||||
pull_request: # needed to trigger on others' PRs
|
pull_request: # needed to trigger on others' PRs
|
||||||
|
# Note that people who fork it need to go to "Actions" tab on their fork and click "I understand my workflows, go ahead and enable them".
|
||||||
workflow_dispatch: # needed to trigger workflows manually
|
workflow_dispatch: # needed to trigger workflows manually
|
||||||
# todo cron?
|
# todo cron?
|
||||||
|
|
||||||
env:
|
|
||||||
# useful for scripts & sometimes tests to know
|
|
||||||
CI: true
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ubuntu-latest, macos-latest] # TODO windows-latest??
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
python-version: [3.7, 3.8, 3.9]
|
python-version: ['3.7', '3.8', '3.9']
|
||||||
|
exclude: [
|
||||||
|
# windows runners are pretty scarce, so let's only run one of them..
|
||||||
|
{platform: windows-latest, python-version: '3.7'},
|
||||||
|
{platform: windows-latest, python-version: '3.9'},
|
||||||
|
]
|
||||||
|
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
|
|
||||||
|
# TODO let's at least start running windows for now, will fix later
|
||||||
|
continue-on-error: ${{ matrix.platform == 'windows-latest' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
|
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
|
||||||
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
fetch-depth: 0 # nicer to have all git history when debugging/for tests
|
fetch-depth: 0 # nicer to have all git history when debugging/for tests
|
||||||
|
@ -39,13 +45,16 @@ jobs:
|
||||||
# uncomment for SSH debugging
|
# uncomment for SSH debugging
|
||||||
# - uses: mxschmitt/action-tmate@v3
|
# - uses: mxschmitt/action-tmate@v3
|
||||||
|
|
||||||
- run: scripts/ci/run
|
# explicit bash command is necessary for Windows CI runner, otherwise it thinks it's cmd...
|
||||||
|
- run: bash scripts/ci/run
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- if: matrix.platform == 'ubuntu-latest' # no need to compute coverage for other platforms
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: .coverage.mypy-misc_${{ matrix.platform }}_${{ matrix.python-version }}
|
name: .coverage.mypy-misc_${{ matrix.platform }}_${{ matrix.python-version }}
|
||||||
path: .coverage.mypy-misc/
|
path: .coverage.mypy-misc/
|
||||||
- uses: actions/upload-artifact@v2
|
- if: matrix.platform == 'ubuntu-latest' # no need to compute coverage for other platforms
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: .coverage.mypy-core_${{ matrix.platform }}_${{ matrix.python-version }}
|
name: .coverage.mypy-core_${{ matrix.platform }}_${{ matrix.python-version }}
|
||||||
path: .coverage.mypy-core/
|
path: .coverage.mypy-core/
|
||||||
|
@ -58,11 +67,11 @@ jobs:
|
||||||
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
|
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
|
||||||
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: '3.7'
|
python-version: '3.8'
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
|
|
@ -9,3 +9,5 @@ addopts =
|
||||||
# otherwise it won't discover doctests
|
# otherwise it won't discover doctests
|
||||||
# eh? importing too much
|
# eh? importing too much
|
||||||
# --doctest-modules
|
# --doctest-modules
|
||||||
|
# show all test durations (unless they are too short)
|
||||||
|
--durations=0
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#!/bin/bash -eu
|
#!/bin/bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
cd ../..
|
cd .. # git root
|
||||||
|
|
||||||
if ! command -v sudo; then
|
if ! command -v sudo; then
|
||||||
# CI or Docker sometimes doesn't have it, so useful to have a dummy
|
# CI or Docker sometimes doesn't have it, so useful to have a dummy
|
||||||
|
@ -10,16 +11,31 @@ if ! command -v sudo; then
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -z "$CI" ]; then
|
if [ -n "${CI-}" ]; then
|
||||||
# install OS specific stuff here
|
# install OS specific stuff here
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
case "$OSTYPE" in
|
||||||
|
darwin*)
|
||||||
# macos
|
# macos
|
||||||
brew install fd
|
brew install fd
|
||||||
else
|
;;
|
||||||
|
cygwin* | msys* | win*)
|
||||||
|
# windows
|
||||||
|
:
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# must be linux?
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install fd-find
|
sudo apt install fd-find
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pip3 install --user tox
|
|
||||||
tox
|
PY_BIN="python3"
|
||||||
|
# some systems might have python pointing to python3
|
||||||
|
if ! command -v python3 &> /dev/null; then
|
||||||
|
PY_BIN="python"
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$PY_BIN" -m pip install --user tox
|
||||||
|
"$PY_BIN" -m tox
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -12,7 +12,7 @@ INSTALL_REQUIRES = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main() -> None:
|
||||||
pkg = 'my'
|
pkg = 'my'
|
||||||
subpackages = find_namespace_packages('.', include=('my.*',))
|
subpackages = find_namespace_packages('.', include=('my.*',))
|
||||||
setup(
|
setup(
|
||||||
|
|
3
tox.ini
3
tox.ini
|
@ -1,5 +1,8 @@
|
||||||
[tox]
|
[tox]
|
||||||
minversion = 3.5
|
minversion = 3.5
|
||||||
|
# https://github.com/tox-dev/tox/issues/20#issuecomment-247788333
|
||||||
|
# hack to prevent .tox from crapping to the project directory
|
||||||
|
toxworkdir={env:TOXWORKDIR_BASE:}{toxinidir}/.tox
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
passenv = CI CI_*
|
passenv = CI CI_*
|
||||||
|
|
Loading…
Add table
Reference in a new issue