Skip to content

Commit

Permalink
[f] Fix github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
huynguyengl99 committed May 25, 2024
1 parent 68fca3e commit e54a7f9
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e54a7f9

Please sign in to comment.