Skip to content

Commit

Permalink
ci: bring configuration up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Jan 28, 2023
1 parent 4514ed1 commit 5e442ae
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
16 changes: 12 additions & 4 deletions .ci/run
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash -eu
#!/bin/bash
set -eu

cd "$(dirname "$0")"
cd ..
cd .. # git root

if ! command -v sudo; then
# CI or Docker sometimes doesn't have it, so useful to have a dummy
Expand All @@ -20,5 +21,12 @@ if [ -n "${CI-}" ]; then
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
20 changes: 12 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest] # TODO windows-latest??
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
# vvv just an example of excluding stuff from matrix
# exclude: [{platform: macos-latest, python-version: '3.6'}]

Expand All @@ -27,22 +27,26 @@ jobs:
steps:
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- if: ${{ matrix.platform == 'macos-latest' && matrix.python-version == '3.11' }}
# hmm somehow only seems necessary for 3.11 on osx??
run: echo "$HOME/Library/Python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0 # nicer to have all git history when debugging/for tests

# uncomment for SSH debugging
# - uses: mxschmitt/action-tmate@v3

- run: .ci/run
# explicit bash command is necessary for Windows CI runner, otherwise it thinks it's cmd...
- run: bash .ci/run

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: .coverage.mypy_${{ matrix.platform }}_${{ matrix.python-version }}
path: .coverage.mypy/
Expand All @@ -56,11 +60,11 @@ jobs:
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: '3.7'
python-version: '3.8'

- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

Expand Down
6 changes: 6 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
minversion = 3.5
# relies on the correct version of Python installed
envlist = tests,pylint,mypy
# 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]
passenv =
CI
CI_*
CIRCLE*
# respect user's cache dirs to prevent tox from crapping into project dir
MYPY_CACHE_DIR
PYTHONPYCACHEPREFIX

[testenv:tests]
commands =
Expand Down

0 comments on commit 5e442ae

Please sign in to comment.