diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6113d2d..3b448fe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,20 +19,27 @@ jobs: run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v4 + id: setup-python + uses: actions/setup-python@v5 with: python-version: "3.11" + - name: Auto activate venv + run: echo "source .venv/bin/activate" >> "$GITHUB_ENV" + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + installation-arguments: --git https://github.com/radoering/poetry.git@pep621-support + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true - uses: actions/cache@v3 id: cache with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-django-headless-cms-${{ hashFiles('pyproject.toml', 'requirements-init.txt') }}-lint - - name: Install Initial Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-init.txt + path: .venv + key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-django-headless-cms-${{ hashFiles('**/poetry.lock') }}-lint - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' - run: poetry install --only lint + run: poetry install --no-interaction --only lint - name: Lint run: bash scripts/lint.sh @@ -70,19 +77,29 @@ jobs: - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 + id: setup-python with: python-version: ${{ matrix.python-version }} + - name: Auto activate venv + run: echo "source .venv/bin/activate" >> "$GITHUB_ENV" + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + installation-arguments: --git https://github.com/radoering/poetry.git@pep621-support + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true - uses: actions/cache@v3 id: cache with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-django-headless-cms-${{ hashFiles('pyproject.toml', 'requirements-init.txt') }}-test + path: .venv + key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-django-headless-cms-${{ hashFiles('**/poetry.lock') }}-test - name: Install Initial Dependencies if: steps.cache.outputs.cache-hit != 'true' run: pip install -r requirements-init.txt - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' - run: poetry install --only test --only main + run: poetry install --no-interaction --only test --only main - run: mkdir coverage - name: Test run: coverage run -m pytest tests