Add tests #23
Workflow file for this run
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
# This file is a part of the detect-pythons project. | |
# https://github.com/kurtmckee/detect-pythons | |
# Copyright 2023 Kurt McKee <[email protected]> | |
# SPDX-License-Identifier: MIT | |
# This workflow exists for several purposes: | |
# | |
# * Ensure that the example in the README is functional. | |
# * Ensure that the desired YAML formatting is enforced. | |
# * Ensure that the example action versions are maintained. | |
# | |
# Update PRs submitted by Dependabot should trigger pre-commit.ci, | |
# which will synchronize changes to this file into the README. | |
# | |
name: "📘 README" | |
on: | |
pull_request: | |
push: | |
branches: | |
- "main" | |
- "releases" | |
schedule: | |
- cron: "27 19 * * *" | |
jobs: | |
readme_example: | |
name: "Test README code (${{ matrix.os.name }})" | |
strategy: | |
matrix: | |
os: | |
- name: "Linux" | |
runner: "ubuntu-latest" | |
- name: "macOS" | |
runner: "macos-latest" | |
- name: "Windows" | |
runner: "windows-latest" | |
fail-fast: false | |
runs-on: "${{ matrix.os.runner }}" | |
steps: | |
# START_README_EXAMPLE_BLOCK | |
- uses: "actions/setup-python@v4" | |
with: | |
python-version: | | |
pypy3.10 | |
3.11 | |
- uses: "kurtmckee/detect-pythons@v1" | |
- uses: "actions/cache@v3" | |
id: "restore-cache" | |
with: | |
# You may need to augment the list of files to hash. | |
# For example, you might add 'requirements/*.txt' or 'pyproject.toml'. | |
key: "${{ hashFiles('.python-identifiers') }}" | |
path: | | |
.tox/ | |
.venv/ | |
- name: "Identify .venv path" | |
shell: "bash" | |
run: "echo 'venv-path=.venv/${{ runner.os == 'Windows' && 'Scripts' || 'bin' }}' >> $GITHUB_ENV" | |
- name: "Create a virtual environment" | |
if: "steps.restore-cache.outputs.cache-hit == false" | |
run: | | |
python -m venv .venv | |
${{ env.venv-path }}/python -m pip install --upgrade pip setuptools wheel | |
# You may need to customize what gets installed next. | |
# However, tox is able to run test suites against multiple Pythons, | |
# so it's a helpful tool for efficient testing. | |
${{ env.venv-path }}/pip install tox | |
- name: "Run the test suite against all installed Pythons" | |
run: "${{ env.venv-path }}/tox" | |
# END_README_EXAMPLE_BLOCK |