Skip to content

Issue #1197: require JavaScript::Minifier::XS #1219

Issue #1197: require JavaScript::Minifier::XS

Issue #1197: require JavaScript::Minifier::XS #1219

Workflow file for this run

%YAML 1.1
---
name: 'CodePolicy'
on: ['pull_request']
# on: ['push', 'pull_request']
jobs:
CodePolicy:
runs-on: 'ubuntu-latest'
env:
PERL5LIB: local/lib/perl5
steps:
- id: files
uses: jitterbit/get-changed-files@v1
- name: 'install dependencies'
run: sudo apt -y update && sudo apt install -y libxml2-utils libxslt-dev
- name: 'checkout otobo'
uses: actions/checkout@v2
# some diagnostics
- name: diagnostics
run: |
pwd
perl -v
printenv | sort
# 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 of cpanfile.docker'
id: get-sha
run: |
echo "::set-output name=sha::$(git rev-parse :cpanfile.docker)"
- name: 'Print SHA of cpanfile.docker'
run: |
echo '${{steps.get-sha.outputs.sha}}'
- name: 'check cache for CPAN modules'
uses: actions/cache@v2
id: cache_local_lib
with:
path: local
key: ${{ runner.os }}-${{steps.get-sha.outputs.sha}}-local_lib-20210928n
# for debugging when there a problems installing a module
# - name: 'XML::LibXSLT'
# run: |
# sudo apt install -y cpanminus
# cpanm -l local --notest XML::LibXSLT || sh -xc 'cat ~/.cpanm/work/*/build.log'
- name: 'install Perl modules from CPAN'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
uses: perl-actions/install-with-cpm@v1
with:
install: |
Code::TidyAll
Perl::Critic
cpanfile: cpanfile.docker
global: false
tests: false
sudo: false
# the setup is just like otobo.web.dockerfile and .dockerignore
- name: set up config
run: |
cp --no-clobber Kernel/Config.pm.docker.dist Kernel/Config.pm
perl -pi -e 's/^use lib /# disabled by syntax_check.yml: use lib/' Kernel/Config/Defaults.pm
# The actual test steps. Check syntax and the CodePolicy.
# There are situations where there are no added or modidied files. But with an empty
# argument list all files would be checked, which can easily lead to errors with missing dependencies.
# Therefore make sure that at least one argument is passed.
# :: tells prove that whatever follows should be passed to the test script
- name: prove
run: 'prove -I . -I Kernel/cpan-lib -I Custom --verbose scripts/test/Compile.t :: Kernel/Config.pm ${{ steps.files.outputs.added_modified }}'
- name: 'checkout codepolicy'
uses: actions/checkout@v2
with:
repository: RotherOSS/codepolicy
ref: rel-10_0_4
path: codepolicy
- name: 'run CodePolicy'
run: codepolicy/bin/otobo.CodePolicy.pl -l ${{ steps.files.outputs.added_modified }}