diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index dd813161..48395e44 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -19,21 +19,48 @@ jobs: - name: Check out GitHub repository ${{ github.repository }} uses: actions/checkout@v4 - - name: Install Poetry - run: pip install poetry==1.8.3 - - - name: Set up Python on ${{ runner.os }} - uses: actions/setup-python@v5 - id: setup_python + - name: Cache Poetry dependencies + uses: actions/cache@v4 with: - python-version: '3.10' - cache: 'poetry' + path: | + ~/.cache/pypoetry/cache + ~/.cache/pypoetry/artifacts + key: poetry-${{ runner.os }}-${{ hashFiles('poetry.lock') }} + restore-keys: | + poetry-${{ runner.os }}- + + - name: Create virtual environment + run: python -m venv venv + + - name: Activate virtual environment and install Poetry + run: | + source venv/bin/activate + pip install poetry==1.8.3 --break-system-packages + + - name: Install dependencies with Poetry + run: | + source venv/bin/activate + poetry install --with dev + + - name: Run your tests + run: | + source venv/bin/activate + poetry run your-test-command + + - name: Create virtual environment + run: python -m venv venv - - name: Install dependencies on Python ${{ steps.setup_python.outputs.python-version }} - run: poetry install --with dev + - name: Activate virtual environment and install Poetry + run: | + source venv/bin/activate + pip install poetry==1.8.3 - name: Check and fix with Ruff - run: poetry run ruff check ./tests/*.py ./openseries/*.py --fix --exit-non-zero-on-fix + run: | + source venv/bin/activate + poetry run ruff check ./tests/*.py ./openseries/*.py --fix --exit-non-zero-on-fix - name: Type check with Mypy - run: poetry run mypy . + run: | + source venv/bin/activate + poetry run mypy .