fix python version and attempt to eliminate setup-python warning #323
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
name: Default | |
on: push | |
jobs: | |
pre-commit: | |
name: pre-commit | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.12] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: Gr1N/setup-poetry@v9 | |
- uses: actions/[email protected] | |
id: cache | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Ensure Cache Is Healthy | |
if: runner.os != 'Windows' && steps.cache.outputs.cache-hit == 'true' | |
run: poetry run pip --version > /dev/null 2>&1 || rm -rf .venv | |
- run: poetry install -vv --remove-untracked | |
- uses: pre-commit/[email protected] | |
test-local-action-miss: | |
name: Test Local Action With Cache Miss | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.9, '3.10', 3.11, 3.12] | |
steps: | |
- uses: actions/checkout@v4 | |
- id: local-action | |
uses: ./ | |
with: | |
cache-key-suffix: ${{ github.run_number }} | |
python-version: ${{ matrix.python-version }} | |
- name: check outputs.python-version | |
env: | |
MATRIX_PYTHON_VERSION: ${{ matrix.python-version }} | |
OUTPUTS_PYTHON_VERSION: ${{ steps.local-action.outputs.python-version }} | |
if: '!startsWith(steps.local-action.outputs.python-version, matrix.python-version)' | |
run: | | |
echo "outputs.python-version=${OUTPUTS_PYTHON_VERSION}" | |
echo "matrix.python-version=${MATRIX_PYTHON_VERSION}" | |
exit 1 | |
- name: check outputs.cache-hit (miss) | |
env: | |
CACHE_HIT_VALUE: ${{ steps.local-action.outputs.cache-hit }} | |
if: steps.local-action.outputs.cache-hit == 'true' | |
run: | | |
echo "outputs.cache-hit=${CACHE_HIT_VALUE}" | |
exit 1 | |
- name: check poetry | |
run: poetry --version | |
- name: ensure pre-commit is installed | |
run: poetry run pre-commit sample-config | |
test-local-action-hit: | |
# This has to be run after the miss as the cache is not uploaded until the | |
# the job is finished. | |
name: Test Local Action With Cache Hit | |
needs: test-local-action-miss | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.9, '3.10', 3.11, 3.12] | |
steps: | |
- uses: actions/checkout@v4 | |
- id: local-action | |
uses: ./ | |
with: | |
cache-key-suffix: ${{ github.run_number }} | |
poetry-install: false | |
python-version: ${{ matrix.python-version }} | |
- name: check outputs.cache-hit (hit) | |
env: | |
CACHE_HIT_VALUE: ${{ steps.local-action.outputs.cache-hit }} | |
if: steps.local-action.outputs.cache-hit != 'true' | |
run: | | |
echo "outputs.cache-hit=${CACHE_HIT_VALUE}" | |
exit 1 | |
- name: ensure pre-commit is installed | |
run: poetry run pre-commit sample-config | |
test-local-action-python-version-file: | |
name: Test Local Action Using Version From File | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- id: local-action | |
uses: ./ | |
with: | |
cache-key-suffix: ${{ github.run_number }}-from-file | |
poetry-install: false | |
- name: ensure python version | |
run: python -c "import sys; assert sys.version_info >= (3, 12);" |