Move functions around (#34) #109
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: '1' | |
- name: set PY | |
shell: bash -el {0} | |
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
- name: Install pre-commit | |
shell: bash -el {0} | |
run: pipx install pre-commit | |
- uses: actions/cache/restore@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
id: cache | |
- name: Run pre-commit | |
shell: bash -e {0} | |
run: | | |
echo '```console' > $GITHUB_STEP_SUMMARY | |
# Enable color output for pre-commit and remove it for the summary | |
pre-commit run --all-files --show-diff-on-failure --color=always | \ | |
tee >(sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?[mGK]//g' >> $GITHUB_STEP_SUMMARY) >&1 | |
exit_code=${PIPESTATUS[0]} | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
exit $exit_code | |
- if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
unit_test_suite: | |
name: Unit tests on ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
needs: [pre-commit] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install hatch | |
run: pipx install hatch | |
- name: Testing | |
run: hatch run +py=${{ matrix.python-version }} test:run |