-
Notifications
You must be signed in to change notification settings - Fork 61
217 lines (203 loc) · 7.77 KB
/
glpi-agent-ci.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: GLPI Agent CI
# Perl lib caches are updated at least once a week
# but you can update last-cache-validation-date to invalidate perl lib caches
# last-cache-validation-date: 2022-09-21
on:
push:
pull_request:
branches:
- develop
jobs:
linux-ubuntu-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install packages
run: |
sudo apt -y install cpanminus libmodule-install-perl libxml-libxml-perl \
libxml-treepp-perl libxml-xpath-perl \
libdatetime-perl libparallel-forkmanager-perl libparse-edid-perl \
libcpanel-json-xs-perl libossp-uuid-perl libfile-copy-recursive-perl \
libtext-template-perl libuniversal-require-perl libnet-ip-perl \
libnet-snmp-perl libipc-run-perl libhttp-proxy-perl libio-capture-perl \
libhttp-server-simple-perl libhttp-server-simple-authen-perl \
libtest-compile-perl libtest-deep-perl libtest-exception-perl \
libtest-mockmodule-perl libtest-mockobject-perl libtest-nowarnings-perl \
libtest-exception-perl libtest-perl-critic-perl libtest-pod-perl \
libextutils-helpers-perl libextutils-installpaths-perl libmodule-build-tiny-perl \
libtest-cpan-meta-perl
- name: Check environment
id: check-version
run: |
perl --version
cpanm --version
- name: Install deps
run: |
cpanm --sudo --installdeps --verbose --notest .
cpanm --sudo --verbose --notest Test::Vars Test::Pod::Spelling::CommonMistakes Test::Whitespaces
- name: Run make
run: |
perl Makefile.PL
make manifest
make
- name: Run tests
run: |
make test
- name: Run Author tests
run: |
make test TEST_AUTHOR=1 TEST_FILES="t/02critic.t t/03var.t t/04pod-syntax.t t/06pod-spelling.t t/07whitespaces.t t/09cpanmeta.t"
windows-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Update environment
run: |
echo 'C:\Strawberry\perl\bin' >> $GITHUB_PATH
echo 'C:\Strawberry\perl\site\bin' >> $GITHUB_PATH
echo 'C:\Strawberry\c\bin' >> $GITHUB_PATH
shell: bash
- name: Check environment
id: check-version
run: |
echo "PATH=%PATH%"
perl --version
perl -V
perl -e "@t = localtime; print 'cache-version='.$^V.'-'.int($t[7]/7)" >>%GITHUB_OUTPUT%
shell: cmd
- name: Restore perl lib cache
uses: actions/cache@v4
id: cache
with:
path: |
C:\Strawberry\perl\site\lib
C:\Strawberry\perl\site\bin
key: windows-test-perl-${{ steps.check-version.outputs.cache-version }}-lib-cache-${{ hashFiles('Makefile.PL', '.github/workflows/glpi-agent-ci.yml') }}
- name: Install Module::Install
if: steps.cache.outputs.cache-hit != 'true'
run: cpan -T Module::Install
shell: cmd
- name: Install deps
if: steps.cache.outputs.cache-hit != 'true'
run: |
cpanm --notest --verbose --installdeps .
shell: cmd
- name: Install other modules
if: steps.cache.outputs.cache-hit != 'true'
run: |
cpanm --notest --verbose Compress::Zlib Parse::EDID Win32::Unicode::File
shell: cmd
- name: Prepare Makefile
run: perl Makefile.PL
shell: cmd
- name: Run gmake
run: gmake
shell: cmd
- name: Run tests
run: gmake test
shell: cmd
windows-test-using-our-built-perl:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Create folders for cached datas
run: |
mkdir C:\Strawberry-perl-for-GLPI-Agent_build\restore
shell: cmd
- name: Restore built perl from packaging cache
uses: actions/cache/restore@v4
id: built-perl-cache
with:
path: |
C:/Strawberry-perl-for-GLPI-Agent_build/restore
key: windows-packaging-perl-cache-x64-${{ hashFiles('contrib\windows\glpi-agent-extlibs-build.pl', 'contrib\windows\glpi-agent-packaging.pl', 'contrib\windows\packaging\*') }}
- name: Log warning on cache miss
if: steps.built-perl-cache.outputs.cache-hit != 'true'
run: |
echo '::warning title=[windows-test-using-our-built-perl] Built Perl not available in cache::You should be able to restart this job after packaging workflow run.'
- name: Restore required perl libraries cache
uses: actions/cache@v4
id: perl-site-cache
if: steps.built-perl-cache.outputs.cache-hit == 'true'
with:
path: |
C:\Strawberry\perl\site\lib
C:\Strawberry\perl\site\bin
key: built-perl-windows-test-perl-site-cache-x64-${{ hashFiles('contrib\windows\glpi-agent-extlibs-build.pl', 'contrib\windows\glpi-agent-packaging.pl', 'contrib\windows\packaging\*') }}
- name: Update environment
if: steps.built-perl-cache.outputs.cache-hit == 'true'
run: |
echo 'C:\Strawberry\perl\bin' >> $GITHUB_PATH
echo 'C:\Strawberry\perl\site\bin' >> $GITHUB_PATH
echo 'C:\Strawberry\c\bin' >> $GITHUB_PATH
shell: bash
- name: Install Module::Install
if: steps.built-perl-cache.outputs.cache-hit == 'true' && steps.perl-site-cache.outputs.cache-hit != 'true'
run: cpan -T Module::Install
shell: cmd
- name: Prepare Makefile
if: steps.built-perl-cache.outputs.cache-hit == 'true'
run: perl Makefile.PL
shell: cmd
- name: Install latest Perl::Dist::Strawberry from github
if: steps.built-perl-cache.outputs.cache-hit == 'true' && steps.perl-site-cache.outputs.cache-hit != 'true'
run: |
cpanm --notest --verbose https://github.com/StrawberryPerl/Perl-Dist-Strawberry.git
shell: cmd
- name: Run tests script
if: steps.built-perl-cache.outputs.cache-hit == 'true'
run: perl contrib/windows/glpi-agent-built-perl-tests.pl
shell: cmd
- name: Upload windows built artifacts
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: Built-Perl-Windows-Test-Debug
path: C:\Strawberry-perl-for-GLPI-Agent_build\output
macos-test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Update environment
run: |
PERL_PREFIX=$(perl -MConfig -e 'print $Config{prefix}')
echo "$PERL_PREFIX/bin" >> $GITHUB_PATH
- name: Check environment
id: check-version
run: |
echo "PATH=$PATH"
perl --version
perl -V
# Compute perl-version for current week to regen perl lib cache at least each week
perl -e '@t = localtime; print "cache-version=".$^V."-".int($t[7]/7)."\n"' >>$GITHUB_OUTPUT
- name: Install libxml2 via brew
run: brew install libxml2
- name: Update environment to find latest libxml2
run: |
echo "$(brew --prefix)/opt/libxml2/bin" >> $GITHUB_PATH
- name: Restore perl lib cache
id: cache
uses: actions/cache@v4
with:
path: |
/usr/local/Cellar/perl/*/lib/perl5/site_perl
/usr/local/Cellar/perl/*/bin
key: macos-test-perl-${{ steps.check-version.outputs.cache-version }}-lib-cache-${{ hashFiles('Makefile.PL', '.github/workflows/glpi-agent-ci.yml') }}
- name: Install Module::Install
if: steps.cache.outputs.cache-hit != 'true'
run: |
cpan -T Module::Install
- name: Install cpanminus
if: steps.cache.outputs.cache-hit != 'true'
run: |
cpan -T App::cpanminus
- name: Install deps
if: steps.cache.outputs.cache-hit != 'true'
run: |
cpanm --sudo --installdeps --verbose --notest .
cpanm --sudo --verbose --notest Parse::EDID
- name: Prepare Makefile
run: perl Makefile.PL
- name: Run make
run: make
- name: Run tests
run: make test