|
44 | 44 | uses: actions/setup-python@v6 |
45 | 45 | with: |
46 | 46 | python-version: ${{ matrix.python_version }} |
| 47 | + cache: 'pip' |
47 | 48 |
|
48 | 49 | - name: Install Ansible |
49 | 50 | run: | |
|
86 | 87 | uses: actions/setup-python@v6 |
87 | 88 | with: |
88 | 89 | python-version: ${{ matrix.python_version }} |
| 90 | + cache: 'pip' |
89 | 91 |
|
90 | 92 | - name: Install Ansible |
91 | 93 | run: | |
@@ -123,6 +125,7 @@ jobs: |
123 | 125 | uses: actions/setup-python@v6 |
124 | 126 | with: |
125 | 127 | python-version: 3.11 |
| 128 | + cache: 'pip' |
126 | 129 |
|
127 | 130 | - name: Install dependencies |
128 | 131 | run: | |
@@ -172,13 +175,53 @@ jobs: |
172 | 175 | uses: actions/setup-python@v6 |
173 | 176 | with: |
174 | 177 | python-version: "3.11" |
| 178 | + cache: 'pip' |
| 179 | + cache-dependency-path: requirements-test.txt |
175 | 180 |
|
176 | 181 | - name: Install dependencies |
177 | 182 | run: | |
178 | 183 | python3 -m pip install --upgrade pip |
179 | 184 | python3 -m pip install "ansible-core>=2.19,<2.20" |
180 | 185 | python3 -m pip install -r requirements-test.txt |
181 | 186 |
|
| 187 | + - name: Get latest Elasticsearch release |
| 188 | + id: elastic-version |
| 189 | + if: contains(matrix.distro, 'ubuntu') || contains(matrix.distro, 'debian') |
| 190 | + run: | |
| 191 | + curl -fsSL \ |
| 192 | + "https://artifacts.elastic.co/packages/${{ matrix.release }}.x/apt/dists/stable/main/binary-amd64/Packages.gz" \ |
| 193 | + -o /tmp/Packages.gz |
| 194 | + VERSION=$(zcat /tmp/Packages.gz \ |
| 195 | + | awk '$1=="Package:" && $2=="elasticsearch"{p=1} p && $1=="Version:"{print $2; p=0}' \ |
| 196 | + | sort -V \ |
| 197 | + | tail -n 1) |
| 198 | + rm -f /tmp/Packages.gz |
| 199 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 200 | +
|
| 201 | + - name: Debug - latest Elasticsearch version |
| 202 | + if: contains(matrix.distro, 'ubuntu') || contains(matrix.distro, 'debian') |
| 203 | + run: echo "Latest Elasticsearch ${{ matrix.release }}.x = ${{ steps.elastic-version.outputs.version }}" |
| 204 | + |
| 205 | + - name: Restore Elastic apt cache |
| 206 | + if: contains(matrix.distro, 'ubuntu') || contains(matrix.distro, 'debian') |
| 207 | + uses: actions/cache/restore@v5 |
| 208 | + with: |
| 209 | + path: /tmp/elastic-apt-cache |
| 210 | + key: ${{ runner.os }}-apt-elastic-${{ steps.elastic-version.outputs.version }} |
| 211 | + restore-keys: | |
| 212 | + ${{ runner.os }}-apt-elastic-${{ matrix.release }}. |
| 213 | +
|
| 214 | + - name: Debug - apt cache contents |
| 215 | + if: contains(matrix.distro, 'ubuntu') || contains(matrix.distro, 'debian') |
| 216 | + run: | |
| 217 | + echo "=== /tmp/elastic-apt-cache/ ===" |
| 218 | + ls -lh /tmp/elastic-apt-cache/ 2>/dev/null || echo "(empty or does not exist)" |
| 219 | + echo "=== Total size ===" |
| 220 | + du -sh /tmp/elastic-apt-cache/ 2>/dev/null || echo "(n/a)" |
| 221 | +
|
| 222 | + - name: Ensure apt cache directory exists |
| 223 | + run: mkdir -p /tmp/elastic-apt-cache |
| 224 | + |
182 | 225 | - name: Install collection |
183 | 226 | run: | |
184 | 227 | mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE |
@@ -217,6 +260,7 @@ jobs: |
217 | 260 | uses: actions/setup-python@v6 |
218 | 261 | with: |
219 | 262 | python-version: 3.11 |
| 263 | + cache: 'pip' |
220 | 264 |
|
221 | 265 | - name: Install dependencies |
222 | 266 | run: | |
|
0 commit comments