Skip to content

Commit d3e1fee

Browse files
authored
Merge pull request metacpan#2245 from metacpan/oalders/workflows
Add GitHub workflows
2 parents 62315cb + 39412ad commit d3e1fee

File tree

21 files changed

+3558
-2303
lines changed

21 files changed

+3558
-2303
lines changed

.github/workflows/test.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
name: test
3+
4+
on:
5+
- push
6+
7+
jobs:
8+
docker:
9+
runs-on: ubuntu-latest
10+
name: Docker
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: docker build
14+
run: docker build . -t mweb
15+
- name: run Perl tests
16+
run: docker run -i mweb carton exec prove -lr t
17+
test:
18+
runs-on: ubuntu-latest
19+
name: Dockerless
20+
strategy:
21+
matrix:
22+
perl-version:
23+
- "5.22"
24+
- "5.28"
25+
- "5.30"
26+
resolver:
27+
- metacpan
28+
#- snapshot
29+
container:
30+
image: perl:${{ matrix.perl-version }}
31+
env:
32+
DEVEL_COVER_OPTIONS: "-ignore,^local/"
33+
steps:
34+
- uses: actions/checkout@v1
35+
- uses: actions/setup-node@v1
36+
with:
37+
node-version: "12"
38+
- run: npm install -g yarn && yarn install
39+
- name: Install Carton
40+
run: >
41+
curl -sL https://git.io/cpm | perl -
42+
install -g Carton
43+
--show-build-log-on-failure
44+
- name: Install deps
45+
run: >
46+
curl -sL https://git.io/cpm | perl -
47+
install
48+
--cpanfile cpanfile
49+
--resolver ${{ matrix.resolver }}
50+
--show-build-log-on-failure
51+
--local-lib-contained=local
52+
if: success()
53+
- name: Maybe update cpanfile.snapshot
54+
run: carton
55+
if: success()
56+
- name: Run Tests
57+
run: carton exec prove -lr --jobs 2 t
58+
if: success()
59+
- uses: actions/upload-artifact@master
60+
with:
61+
name: "${{ matrix.perl-version }}.${{ matrix.resolver }}"
62+
path: cpanfile.snapshot
63+
if: success() && matrix.resolver == 'metacpan'

.tidyallrc

Lines changed: 0 additions & 15 deletions
This file was deleted.

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ FROM metacpan/metacpan-base:latest
33
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash \
44
&& apt-get update \
55
&& apt-get install -y nodejs npm \
6-
&& npm install less -g
6+
&& npm install -g yarn
77

88
ENV PERL_MM_USE_DEFAULT=1 PERL_CARTON_PATH=/carton
99

10-
COPY cpanfile cpanfile.snapshot /metacpan-web/
10+
COPY . /metacpan-web/
1111
WORKDIR /metacpan-web
1212

1313
RUN cpanm --notest App::cpm \
1414
&& cpm install -g Carton \
1515
&& useradd -m metacpan-web -g users \
1616
&& mkdir /carton \
1717
&& cpm install -L /carton \
18-
&& rm -fr /root/.cpanm /root/.perl-cpm /tmp/*
18+
&& rm -fr /root/.cpanm /root/.perl-cpm /tmp/* \
19+
&& yarn install
1920

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

app.psgi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ my $tempdir = "$root_dir/var/tmp";
5454

5555
STDERR->autoflush;
5656

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

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

9091
for my $template (@templates) {
9192

92-
# might faile if we try to load something that isn't actually a
93+
# might fail if we try to load something that isn't actually a
9394
# template, and it can't be parsed. Although that shouldn't happen
9495
# because we are skipping static files.
9596
eval { $alloy->load_template($template) };

bin/purge.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ =head1 DESCRIPTION
4646
elsif ( $opt->list ) {
4747
## no critic (MutatingList)
4848
print grep { !/_cache_key_for_user/ }
49-
map { s/\A.+:\s+\$c->add_surrogate_key\((.+?)\);\Z/$1/; $_ }
49+
map { s/\A.+:\s+\$c->add_surrogate_key\((.+?)\);\Z/$1/; $_ }
5050
qx{git grep add_surrogate_key lib/MetaCPAN/Web/Controller/};
5151
}
5252
else {

cpanfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ requires 'IO::Socket::SSL';
4444
requires 'Importer';
4545
requires 'JavaScript::Minifier::XS';
4646
requires 'List::Util', '1.45';
47-
requires 'Locale::Country','3.28';
47+
requires 'Locale::Country','3.62';
4848
requires 'Log::Dispatch';
4949
requires 'Log::Log4perl::Catalyst';
5050
requires 'Log::Log4perl::Layout::JSON';
@@ -92,14 +92,15 @@ requires 'XML::Feed';
9292
requires 'YAML', '1.15'; # fix dep chain issue
9393

9494
test_requires 'App::Prove';
95-
test_requires 'Code::TidyAll', '>= 0.47';
95+
test_requires 'Code::TidyAll', '>= 0.74';
9696
test_requires 'Code::TidyAll::Plugin::Test::Vars', '0.04';
9797
test_requires 'Path::Iterator::Rule', '1.008';
98-
test_requires 'Perl::Critic', '1.124';
99-
test_requires 'Perl::Tidy' => '20181120';
98+
test_requires 'Perl::Critic', '1.136';
99+
test_requires 'Perl::Tidy' => '20190915';
100100
test_requires 'Test::Code::TidyAll';
101101
test_requires 'Test::MockObject','1.09';
102102
test_requires 'Test::More', '0.96';
103+
test_requires 'Test::Needs';
103104
test_requires 'Test::Perl::Critic';
104105
test_requires 'Test::XPath', '0.15';
105106

0 commit comments

Comments
 (0)