chore: make upgrade #493
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
# Run scriv CI | |
name: "Test Suite" | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
PANDOC_VER: 2.18 | |
jobs: | |
tests: | |
name: "Test on ${{ matrix.os }}" | |
runs-on: "${{ matrix.os }}-latest" | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu | |
- macos | |
- windows | |
steps: | |
- name: "Check out the repo" | |
uses: "actions/checkout@v4" | |
- name: "Set up Python" | |
id: "setup-python" | |
uses: "actions/setup-python@v5" | |
with: | |
# The last listed Python version is the default. | |
python-version: | | |
pypy-3.9 | |
3.8 | |
3.9 | |
3.10 | |
3.11 | |
3.12 | |
- name: "Restore cache" | |
id: "restore-cache" | |
uses: "actions/cache@v4" | |
with: | |
path: | | |
.tox/ | |
.venv/ | |
key: "cache-python-${{ steps.setup-python.outputs.python-version }}-os-${{ runner.os }}-hash-${{ hashFiles('tox.ini', 'requirements/*.txt') }}" | |
- name: "Identify venv path" | |
shell: "bash" | |
run: "echo 'venv-path=${{ runner.os == 'Windows' && '.venv/Scripts' || '.venv/bin' }}' >> $GITHUB_ENV" | |
- name: "Install dependencies" | |
if: "steps.restore-cache.outputs.cache-hit == false" | |
run: | | |
python -m venv .venv | |
${{ env.venv-path }}/python -m pip install -U setuptools | |
${{ env.venv-path }}/python -m pip install -r requirements/tox.txt | |
- name: "Install pandoc on Linux" | |
# sudo apt-get pandoc: will install a version from 2018! | |
if: runner.os == 'Linux' | |
run: | | |
wget -nv -O pandoc.deb https://github.com/jgm/pandoc/releases/download/${PANDOC_VER}/pandoc-${PANDOC_VER}-1-amd64.deb | |
sudo apt install ./pandoc.deb | |
- name: "Install pandoc on Mac" | |
if: runner.os == 'macOS' | |
run: | | |
brew install pandoc | |
- name: "Install pandoc on Windows" | |
if: runner.os == 'Windows' | |
run: | | |
choco install -y -r --no-progress pandoc | |
- name: "Run tox" | |
run: | | |
${{ env.venv-path }}/python -m tox -m ci-tests | |
- name: "Upload coverage data" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: covdata-${{ matrix.os }} | |
path: .coverage.* | |
coverage: | |
name: Coverage | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check out the repo" | |
uses: "actions/checkout@v4" | |
- name: "Set up Python" | |
uses: "actions/setup-python@v5" | |
with: | |
python-version: "3.12" | |
cache: pip | |
cache-dependency-path: 'requirements/*.txt' | |
- name: "Install dependencies" | |
run: | | |
python -m pip install -U setuptools | |
python -m pip install -r requirements/tox.txt | |
- name: "Download coverage data" | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: covdata-* | |
merge-multiple: true | |
- name: "Combine and report" | |
run: | | |
python -m tox -e coverage | |
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | |
echo "total=$TOTAL" >> $GITHUB_ENV | |
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY | |
- name: "Make badge" | |
if: (github.repository == 'nedbat/scriv') && (github.ref == 'refs/heads/main') | |
# https://gist.github.com/nedbat/5a304c1c779d4bcc57be95f847e9327f | |
uses: schneegans/[email protected] | |
with: | |
# GIST_TOKEN is a GitHub personal access token with scope "gist". | |
# https://github.com/settings/tokens/969369418 | |
auth: ${{ secrets.GIST_TOKEN }} | |
gistID: 5a304c1c779d4bcc57be95f847e9327f | |
filename: covbadge.json | |
label: Coverage | |
message: ${{ env.total }}% | |
minColorRange: 50 | |
maxColorRange: 90 | |
valColorRange: ${{ env.total }} | |
docs: | |
name: Docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check out the repo" | |
uses: "actions/checkout@v4" | |
- name: "Set up Python" | |
uses: "actions/setup-python@v5" | |
with: | |
python-version: "3.8" | |
cache: pip | |
cache-dependency-path: 'requirements/*.txt' | |
- name: "Install dependencies" | |
run: | | |
python -m pip install -U setuptools | |
python -m pip install -r requirements/tox.txt | |
- name: "Build docs" | |
run: | | |
python -m tox -e docs | |
quality: | |
name: Linters etc | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check out the repo" | |
uses: "actions/checkout@v4" | |
- name: "Set up Python" | |
uses: "actions/setup-python@v5" | |
with: | |
python-version: "3.8" | |
cache: pip | |
cache-dependency-path: 'requirements/*.txt' | |
- name: "Install dependencies" | |
run: | | |
python -m pip install -U setuptools | |
python -m pip install -r requirements/tox.txt | |
- name: "Linters etc" | |
run: | | |
python -m tox -e quality |