Add GH action cache

This commit is contained in:
avdata99 2023-03-09 13:30:22 -03:00
parent bae9290395
commit 4caf2c3ebf
1 changed files with 25 additions and 1 deletions

View File

@ -69,11 +69,31 @@ jobs:
libxml2-dev \
libxslt-dev
- name: Enable pip cache
run: |
echo "PIP version: $(pip --version)"
mkdir -p ~/.cache/pip
pip install -U pip --cache-dir ~/.cache/pip
chown -R $(whoami) ~/.cache/pip
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cache/pip
.
/usr/lib/python*/site-packages
key: ${{ runner.os }}-spatial-ckan-${{ matrix.ckan-version }}-${{ hashFiles('*requirements*.txt') }}
restore-keys: |
${{ runner.os }}-spatial-ckan-${{ matrix.ckan-version }}-${{ hashFiles('*requirements*.txt') }}
- name: Install dependencies from ${{ matrix.requirements-file }}
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install -r ${{ matrix.requirements-file }}
- name: Install harvester
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "Installing harvester"
git clone --depth 1 https://github.com/ckan/ckanext-harvest
@ -88,10 +108,14 @@ jobs:
pip install -e .
- name: Install requirements
if: steps.cache.outputs.cache-hit != 'true'
run: pip install -e .
- name: Replace default path to CKAN
run: |
pip install -e .
# Replace default path to CKAN core config file with the one on the container
sed -i -e 's/use = config:.*/use = config:\/srv\/app\/src\/ckan\/test-core.ini/' test.ini
- name: Run tests
run: pytest --ckan-ini=test.ini --cov=ckanext.spatial --cov-report=xml --cov-append --disable-warnings ckanext/spatial/tests