Cache GNU Stow download in CI to avoid rate limiting #14
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| download-stow: | |
| name: Download GNU Stow | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache GNU Stow | |
| id: cache-stow | |
| uses: actions/cache@v4 | |
| with: | |
| path: tests/gnu_stow_for_testing | |
| key: gnu-stow-2.4.1 | |
| - name: Download and build GNU Stow | |
| if: steps.cache-stow.outputs.cache-hit != 'true' | |
| run: | | |
| cd tests | |
| ./get_gnu_stow_for_testing_identical_behavior.sh | |
| - name: Upload GNU Stow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gnu-stow | |
| path: tests/gnu_stow_for_testing | |
| retention-days: 1 | |
| test: | |
| name: Test Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| needs: download-stow | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.10", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install test dependencies | |
| run: pip install pytest | |
| - name: Download GNU Stow artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: gnu-stow | |
| path: tests/gnu_stow_for_testing | |
| - name: Run tests | |
| run: pytest tests/ -v | |
| test-py36: | |
| name: Test Python 3.6 | |
| runs-on: ubuntu-latest | |
| needs: download-stow | |
| container: python:3.6 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| rm /etc/apt/sources.list.d/* 2>/dev/null || true | |
| echo "deb http://archive.debian.org/debian bullseye main" > /etc/apt/sources.list | |
| apt-get update && apt-get install -y perl make | |
| - name: Install test dependencies | |
| run: pip install pytest | |
| - name: Download GNU Stow artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: gnu-stow | |
| path: tests/gnu_stow_for_testing | |
| - name: Run tests | |
| run: pytest tests/ -v | |
| test-py27: | |
| name: Test Python 2.7 | |
| runs-on: ubuntu-latest | |
| needs: download-stow | |
| container: python:2.7 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| rm /etc/apt/sources.list.d/* 2>/dev/null || true | |
| echo "deb http://archive.debian.org/debian buster main" > /etc/apt/sources.list | |
| apt-get update && apt-get install -y perl make | |
| - name: Install test dependencies | |
| run: pip install pytest | |
| - name: Download GNU Stow artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: gnu-stow | |
| path: tests/gnu_stow_for_testing | |
| - name: Run tests | |
| run: pytest tests/ -v | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install flake8 | |
| run: pip install flake8 | |
| - name: Run flake8 | |
| run: flake8 bin/ tests/ |