Skip to content
63 changes: 63 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: test

on:
- push

jobs:
docker:
runs-on: ubuntu-latest
name: Docker
steps:
- uses: actions/checkout@v1
- name: docker build
run: docker build . -t mweb
- name: run Perl tests
run: docker run -i mweb carton exec prove -lr t
test:
runs-on: ubuntu-latest
name: Dockerless
strategy:
matrix:
perl-version:
- "5.22"
- "5.28"
- "5.30"
resolver:
- metacpan
#- snapshot
container:
image: perl:${{ matrix.perl-version }}
env:
DEVEL_COVER_OPTIONS: "-ignore,^local/"
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: "12"
- run: npm install -g yarn && yarn install
- name: Install Carton
run: >
curl -sL https://git.io/cpm | perl -
install -g Carton
--show-build-log-on-failure
- name: Install deps
run: >
curl -sL https://git.io/cpm | perl -
install
--cpanfile cpanfile
--resolver ${{ matrix.resolver }}
--show-build-log-on-failure
--local-lib-contained=local
if: success()
- name: Maybe update cpanfile.snapshot
run: carton
if: success()
- name: Run Tests
run: carton exec prove -lr --jobs 2 t
if: success()
- uses: actions/upload-artifact@master
with:
name: "${{ matrix.perl-version }}.${{ matrix.resolver }}"
path: cpanfile.snapshot
if: success() && matrix.resolver == 'metacpan'
15 changes: 0 additions & 15 deletions .tidyallrc

This file was deleted.

7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ FROM metacpan/metacpan-base:latest
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash \
&& apt-get update \
&& apt-get install -y nodejs npm \
&& npm install less -g
&& npm install -g yarn

ENV PERL_MM_USE_DEFAULT=1 PERL_CARTON_PATH=/carton

COPY cpanfile cpanfile.snapshot /metacpan-web/
COPY . /metacpan-web/
WORKDIR /metacpan-web

RUN cpanm --notest App::cpm \
&& cpm install -g Carton \
&& useradd -m metacpan-web -g users \
&& mkdir /carton \
&& cpm install -L /carton \
&& rm -fr /root/.cpanm /root/.perl-cpm /tmp/*
&& rm -fr /root/.cpanm /root/.perl-cpm /tmp/* \
&& yarn install

RUN chown -R metacpan-web:users /metacpan-web /carton

Expand Down
5 changes: 3 additions & 2 deletions app.psgi
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ my $tempdir = "$root_dir/var/tmp";

STDERR->autoflush;

if ( !$dev_mode ) {
# rmtree causes warnings when tests are running
if ( !$dev_mode && !$ENV{HARNESS_ACTIVE} ) {
my $view = MetaCPAN::Web->view('HTML');

if ( my $tmpl_cache = $view->config->{COMPILE_DIR} ) {
Expand Down Expand Up @@ -89,7 +90,7 @@ if ( !$dev_mode ) {

for my $template (@templates) {

# might faile if we try to load something that isn't actually a
# might fail if we try to load something that isn't actually a
# template, and it can't be parsed. Although that shouldn't happen
# because we are skipping static files.
eval { $alloy->load_template($template) };
Expand Down
2 changes: 1 addition & 1 deletion bin/purge.pl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ =head1 DESCRIPTION
elsif ( $opt->list ) {
## no critic (MutatingList)
print grep { !/_cache_key_for_user/ }
map { s/\A.+:\s+\$c->add_surrogate_key\((.+?)\);\Z/$1/; $_ }
map { s/\A.+:\s+\$c->add_surrogate_key\((.+?)\);\Z/$1/; $_ }
qx{git grep add_surrogate_key lib/MetaCPAN/Web/Controller/};
}
else {
Expand Down
9 changes: 5 additions & 4 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ requires 'IO::Socket::SSL';
requires 'Importer';
requires 'JavaScript::Minifier::XS';
requires 'List::Util', '1.45';
requires 'Locale::Country','3.28';
requires 'Locale::Country','3.62';
requires 'Log::Dispatch';
requires 'Log::Log4perl::Catalyst';
requires 'Log::Log4perl::Layout::JSON';
Expand Down Expand Up @@ -92,14 +92,15 @@ requires 'XML::Feed';
requires 'YAML', '1.15'; # fix dep chain issue

test_requires 'App::Prove';
test_requires 'Code::TidyAll', '>= 0.47';
test_requires 'Code::TidyAll', '>= 0.74';
test_requires 'Code::TidyAll::Plugin::Test::Vars', '0.04';
test_requires 'Path::Iterator::Rule', '1.008';
test_requires 'Perl::Critic', '1.124';
test_requires 'Perl::Tidy' => '20181120';
test_requires 'Perl::Critic', '1.136';
test_requires 'Perl::Tidy' => '20190915';
test_requires 'Test::Code::TidyAll';
test_requires 'Test::MockObject','1.09';
test_requires 'Test::More', '0.96';
test_requires 'Test::Needs';
test_requires 'Test::Perl::Critic';
test_requires 'Test::XPath', '0.15';

Loading