forked from openfoodfacts/openfoodfacts-server
-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (155 loc) · 5.17 KB
/
pull_request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Pull Request
on:
pull_request:
branches:
- main
jobs:
gulp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/[email protected]
with:
node-version: '12.x'
- run: npm install
- run: npm run build
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/[email protected]
with:
node-version: '12.x'
- run: npm install
- run: npm run lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- uses: actions/[email protected]
with:
node-version: '12.x'
- run: npm install
- name: find changed perl files
uses: futuratrepadeira/[email protected]
id: changed-perl
with:
repo-token: ${{ github.token }}
pattern: '^(cgi|scripts)/.*\.pl$|^lib/ProductOpener/.*\.pm$'
result-encoding: 'string'
- name: prepare, build, and test
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends cpanminus tesseract-ocr
# apt packages from cpanfile
sudo apt-get install -y --no-install-recommends graphviz \
libtie-ixhash-perl \
libwww-perl \
libimage-magick-perl \
libxml-encoding-perl \
libtext-unaccent-perl \
libmime-lite-perl \
libcache-memcached-fast-perl \
libjson-pp-perl \
libclone-perl \
libcrypt-passwdmd5-perl \
libencode-detect-perl \
libgraphics-color-perl \
libbarcode-zbar-perl \
libxml-feedpp-perl \
liburi-find-perl \
libxml-simple-perl \
libexperimental-perl \
libapache2-request-perl \
libdigest-md5-perl \
libtime-local-perl \
libpq-dev \
libdbd-pg-perl \
libtemplate-perl \
liburi-escape-xs-perl \
libfile-copy-recursive-perl \
libemail-stuffer-perl \
liblist-moreutils-perl \
libexcel-writer-xlsx-perl \
libpod-simple-perl \
liblog-any-perl \
liblog-log4perl-perl \
liblog-any-adapter-log4perl-perl \
libemail-valid-perl \
libmath-fibonacci-perl \
libprobe-perl-perl \
libmath-round-perl \
libsoftware-license-perl \
libtest-differences-perl \
libtest-exception-perl \
libclass-accessor-lite-perl \
libclass-singleton-perl \
libfile-sharedir-install-perl \
libnet-idn-encode-perl \
libtest-nowarnings-perl \
libfile-chmod-perl \
libdata-dumper-concise-perl \
libdata-printer-perl \
libdata-validate-ip-perl \
libio-compress-perl \
libjson-maybexs-perl \
liblist-allutils-perl \
liblist-someutils-perl \
libdata-section-simple-perl \
libfile-which-perl \
libipc-run3-perl \
liblog-handler-perl \
libtest-deep-perl \
libwant-perl \
libfile-find-rule-perl \
liblinux-usermod-perl \
liblocale-maketext-lexicon-perl \
liblog-any-adapter-tap-perl \
libcrypt-random-source-perl \
libmath-random-isaac-perl \
libtest-sharedfork-perl \
libtest-warn-perl \
libsql-abstract-perl \
libauthen-sasl-saslprep-perl \
libauthen-scram-perl \
libbson-perl \
libclass-xsaccessor-perl \
libconfig-autoconf-perl \
libdigest-hmac-perl \
libpath-tiny-perl \
libsafe-isa-perl \
libspreadsheet-parseexcel-perl \
libtest-number-delta-perl
#
# Not available in Ubuntu 18.04 LTS
# libmath-random-secure-perl
# libgeoip2-perl
# libmodule-build-pluggable-perl
#
# setup local::lib
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
# install perl dependencies
cpanm --quiet --installdeps --notest --skip-satisfied .
# Prepare config
export BUILD_DIR=`pwd`
ln -s $BUILD_DIR/lib/ProductOpener/Config_off.pm $BUILD_DIR/lib/ProductOpener/Config.pm
cp $BUILD_DIR/lib/ProductOpener/Config2_sample.pm $BUILD_DIR/lib/ProductOpener/Config2.pm
ln -s $BUILD_DIR/lib/ProductOpener/SiteLang_off.pm $BUILD_DIR/lib/ProductOpener/SiteLang.pm
sed -i -e 's|\$server_domain = "openfoodfacts.org";|\$server_domain = "off.travis-ci.org";|g' $BUILD_DIR/lib/ProductOpener/Config2.pm
sed -i -e 's|\/home\/off|'$BUILD_DIR'|g' $BUILD_DIR/lib/ProductOpener/Config2.pm
# Ensure everything compiles
perl -c -CS -Ilib lib/startup_apache2.pl
# node scripts/check_perl.js cgi/*.pl
# node scripts/check_perl.js scripts/*.pl
node scripts/check_perl.js ${{ steps.changed-perl.outputs.files_created }} ${{ steps.changed-perl.outputs.files_updated }}
# Rebuild taxonomies
perl -CS -I$BUILD_DIR/lib $BUILD_DIR/scripts/build_lang.pl
node scripts/refresh_taxonomies.js
# Run unit tests
prove -l --jobs 2