summaryrefslogtreecommitdiffstats
path: root/.github/actions/run_tests/action.yaml
blob: d72d70c11ac00575c47cc888e09cd6c90d0a4541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: run jrnl tests
description: Runs all jrnl tests on multiple platforms
inputs:
  cache-string:
    description: 'Cache string secret. Change to bust the cache'
    required: true
runs:
  using: "composite"
  steps:
  - run: git config --global core.autocrlf false
    shell: bash

  - name: Set up Python ${{ matrix.python-version }}
    uses: actions/setup-python@v5
    with:
      python-version: ${{ matrix.python-version }}
      allow-prereleases: true

  - name: Capture full Python version in env
    run: echo "PYTHON_FULL_VERSION=$(python --version)" >> $GITHUB_ENV
    shell: bash

  - name: poetry cache # Change CACHE_STRING secret to bust the cache
    uses: actions/cache@v4
    with:
      path: .venv
      key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ env.PYTHON_FULL_VERSION }}-${{ inputs.cache-string }}

  - name: Install dependencies
    run: |
      echo '::group::poetry'
      pip --disable-pip-version-check install poetry
      poetry config --local virtualenvs.in-project true
      echo '::endgroup::'

      echo '::group::Other dependencies'
      poetry install --remove-untracked
      echo '::endgroup::'

      echo 'DEPS_INSTALLED=true' >> $GITHUB_ENV
    shell: bash

  - name: Linting & Testing
    if: ${{ env.DEPS_INSTALLED == 'true' }}
    run: poetry run poe test
    shell: bash