5555 fi
5656 shell : bash
5757
58- test_setup_poetry_caching :
59- name : Test setup-poetry caching
58+ test_setup_poetry_cache_hit :
59+ name : Test setup-poetry (cache hit)
6060 runs-on : ${{ matrix.os }}
6161 needs : test_setup_poetry
6262 strategy :
@@ -73,11 +73,43 @@ jobs:
7373 - name : Set up Poetry
7474 id : setup-poetry
7575 uses : ./setup-poetry
76- - name : Check that Poetry was loaded from the cache
76+ - name : Expect cache hit
7777 if : steps.setup-poetry.outputs.cache-hit != 'true'
78+ run : echo "::error title=Test Failure::Expected cache hit."; exit 1
79+ shell : bash
80+ - name : Create project
81+ run : poetry new test-project
82+ - name : Check that the project was created
7883 run : |
79- echo "::error title=Test Failure::The cache was not hit."
80- exit 1
84+ if [ ! -f test-project/pyproject.toml ]; then
85+ echo "::error title=Test Failure::The project file does not exist."
86+ exit 1
87+ fi
88+ shell : bash
89+
90+ test_setup_poetry_no_cache :
91+ name : Test setup-poetry (no cache)
92+ runs-on : ${{ matrix.os }}
93+ needs : test_setup_poetry
94+ strategy :
95+ matrix :
96+ os : [windows-latest, ubuntu-latest]
97+ python-version : [3.9, '3.10', 3.11, 3.12, 3.13]
98+ steps :
99+ - name : Check out repo
100+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
101+ - name : Set up Python
102+ uses : ./setup-python
103+ with :
104+ python-version : ${{ matrix.python-version }}
105+ - name : Set up Poetry
106+ id : setup-poetry
107+ uses : ./setup-poetry
108+ with :
109+ use-cache : false
110+ - name : Expect cache miss
111+ if : steps.setup-poetry.outputs.cache-hit == 'true'
112+ run : echo "::error title=Test Failure::Expected cache miss."; exit 1
81113 shell : bash
82114 - name : Create project
83115 run : poetry new test-project
@@ -177,7 +209,14 @@ jobs:
177209 test_results :
178210 name : Test Results
179211 runs-on : ubuntu-latest
180- needs : [test_setup_python, test_setup_poetry, test_setup_poetry_caching, test_check_project_version, test_update_project_version]
212+ needs : [
213+ test_setup_python,
214+ test_setup_poetry,
215+ test_setup_poetry_cache_hit,
216+ test_setup_poetry_no_cache,
217+ test_check_project_version,
218+ test_update_project_version
219+ ]
181220 if : ${{ !cancelled() }}
182221 steps :
183222 - run : exit 0
0 commit comments