Initial commit #10
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 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 example" | |
on: | |
pull_request: | |
push: | |
branches: | |
- "main" | |
- "releases" | |
schedule: | |
- cron: "27 19 * * *" | |
jobs: | |
readme_example: | |
strategy: | |
matrix: | |
run: | |
- os: | |
id: "ubuntu-latest" | |
name: "Linux" | |
- os: | |
id: "macos-latest" | |
name: "macOS" | |
- os: | |
id: "windows-latest" | |
name: "Windows" | |
name: "Test ${{ matrix.run.os.name }}" | |
runs-on: "${{ matrix.run.os.id }}" | |
steps: | |
# START_README_EXAMPLE_BLOCK | |
- uses: "actions/setup-python@v4" | |
with: | |
python-version: | | |
pypy3.10 | |
3.11 | |
- uses: "kurtmckee/detect-pythons@main" | |
- 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=${{ runner.os == 'Windows' && '.venv/Scripts' || '.venv/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 |