Skip to content

Issue #3448: remove the 'Exit with an error' step #1241

Issue #3448: remove the 'Exit with an error' step

Issue #3448: remove the 'Exit with an error' step #1241

%YAML 1.1
---
name: 'CacheLocalLib'
on:
push:
branches:
- rel-10_0
- rel-10_1
- rel-11_0
jobs:
CacheLocalLib:
runs-on: 'ubuntu-latest'
container:
image: perldocker/perl-tester:5.24
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 changes or when
# cache key is manually changed.
# Set current date for forcing a rebuild. In this case, make sure that
# code_policy.yml, syntax_check.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 via the Github REST interface
uses: actions/github-script@v7
id: get-sha
with:
script: |
var cpanfile_docker_content = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: 'cpanfile.docker',
ref: context.ref,
});
return cpanfile_docker_content.data.sha;
result-encoding: string
- name: 'Print SHA of cpanfile.docker'
run: echo '${{steps.get-sha.outputs.result}}'
- name: 'check cache for CPAN modules'
uses: actions/cache@v4
id: cache_local_lib
with:
path: local
key: ${{ runner.os }}-${{steps.get-sha.outputs.result}}-local_lib-20240320a
- name: 'check out OTOBO'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: 'Get SHA of cpanfile.docker for doublechecking'
id: get-sha-doublecheck
if: steps.cache_local_lib.outputs.cache-hit != 'true'
run: |
echo "sha=$(git rev-parse :cpanfile.docker)" >> $GITHUB_OUTPUT
echo "ls=$(ls -l cpanfile.docker)" >> $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 Perl modules from CPAN'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
uses: perl-actions/install-with-cpm@stable
with:
install: |
App::perlimports
cpanfile: cpanfile.docker
global: false
tests: false
sudo: false