Skip to content

Issue #3524: Adapted unit test accordingly. #3944

Issue #3524: Adapted unit test accordingly.

Issue #3524: Adapted unit test accordingly. #3944

%YAML 1.1
---
name: 'CacheLocalLib'
on:
push:
branches:
- rel-10_1
- rel-11_0
- rel-11_1
jobs:
CacheLocalLib:
runs-on: 'ubuntu-latest'
container:
image: perldocker/perl-tester:5.36-bookworm
env:
PERL5LIB: local/lib/perl5
steps:
# Use caching for not needing to reinstall modules from CPAN for every check.
# Packages are reinstalled when cpanfile.docker.snapshot changes
# or when the cache key is manually changed.
# Set current date for forcing a rebuild. In this case, make sure that
# code_policy.yml, and cache_local_lib.yml are kept in sync.
# The rules where the cache is visible are not obvious. Essentially the cache must be created on an ancestor branch.
# For that there is cache_local_lib.yml.
# See https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
- name: Get SHA of cpanfile.docker.snapshot via the Github REST interface
uses: actions/github-script@v9
id: get-sha
with:
script: |
var cpan_snapshot_content = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: 'cpanfile.docker.snapshot',
ref: context.ref,
});
return cpan_snapshot_content.data.sha;
result-encoding: string
- name: 'Print SHA of cpanfile.docker.snapshot'
run: |
echo '${{steps.get-sha.outputs.result}}'
-
# The cache key contains the checksum of cpanfile.docker.snapshot.
# Therefore the branch does not have to be included in the key.
name: 'check cache for CPAN modules'
uses: actions/cache@v6
id: cache_local_lib
with:
path: local
key: ${{ runner.os }}-${{steps.get-sha.outputs.result}}-local_lib-20260716a
- name: 'check out the relevant OTOBO branch'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
uses: actions/checkout@v6
- name: 'Get SHA of cpanfile.docker for doublechecking'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
id: get-sha-doublecheck
run: |
echo "sha=$(git rev-parse :cpanfile.docker.snapshot)" >> $GITHUB_OUTPUT
echo "ls=$(ls -l cpanfile.docker.snapshot)" >> $GITHUB_OUTPUT
- name: 'Print SHA of cpanfile.docker for doublechecking'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
run: |
echo '${{steps.get-sha-doublecheck.outputs.sha}}'
echo '${{steps.get-sha-doublecheck.outputs.ls}}'
- name: 'install dependencies'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install libxml2-utils libxslt-dev graphviz libqrencode-dev odbcinst1debian2 libodbc1 odbcinst unixodbc-dev unixodbc
- name: 'install App::perlimports from CPAN with App::cpm'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
uses: perl-actions/install-with-cpm@stable
with:
install: |
App::perlimports
global: false
tests: false
sudo: false
- name: 'move cpanfile in place'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
run: |
cp cpanfile.docker cpanfile
- name: 'install Perl modules from CPAN with App::cpm'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
uses: perl-actions/install-with-cpm@stable
with:
args: '--verbose'
global: false
tests: false
sudo: false