Merge pull request #40 from kurtmckee/rm-isolated-build #433
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-2024 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: "Verify (${{ matrix.os.name }})" | |
strategy: | |
matrix: | |
os: | |
- name: "Linux" | |
runner: "ubuntu-latest" | |
- name: "macOS" | |
runner: "macos-latest" | |
# Temporarily disable Windows here because GraalPy doesn't support it yet. | |
# Windows can be reintegrated here when GraalPy supports Windows. | |
# - name: "Windows" | |
# runner: "windows-latest" | |
fail-fast: false | |
runs-on: "${{ matrix.os.runner }}" | |
steps: | |
# START_README_EXAMPLE_BLOCK | |
- uses: "actions/setup-python@v5" | |
with: | |
python-version: | | |
graalpy-24 | |
pypy-3.10 | |
3.12 | |
- uses: "kurtmckee/detect-pythons@v1" | |
- uses: "actions/cache@v4" | |
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 | |
duplicate-for-windows-without-graalpy: | |
# This duplicate exists solely to avoid testing GraalPy on Windows. | |
# It is anticipated that GraalPy will be available for Windows April 2024. | |
name: "Verify (Windows)" | |
runs-on: "windows-latest" | |
steps: | |
- uses: "actions/setup-python@v5" | |
with: | |
python-version: | | |
pypy-3.10 | |
3.12 | |
- uses: "kurtmckee/detect-pythons@v1" | |
- uses: "actions/cache@v4" | |
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" |