Skip to content

Commit 2267b83

Browse files
committed
GitHub Actions CI workflow.
Ok, *THIS* one is lot more effort than other Workflows, as we have to recompile mod_perl to ensure that it matches the version of Perl that we are building/testnig with. Worse yet, that _also_ requires that we build our own copy of Apache, as the stock Ubuntu version has threads enabled (and all of our Perls are non-threaded). But wait, there's more! Perls prior to 5.20 were not compiled as shrplib out of the box, so we can't use those for testing here (unless we want to recompile Perl as well). Even more frustrating... Apache will refuse to start as `root`, so we have to create our own `github` User to run the tests as, and have to remember to `sudo --user github` when we want to do that.
1 parent 3fe5744 commit 2267b83

File tree

1 file changed

+164
-0
lines changed

1 file changed

+164
-0
lines changed

.github/workflows/perl-ci.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
---
2+
name: CI
3+
4+
on: [push]
5+
6+
env:
7+
APACHE_RELEASE: http://archive.apache.org/dist/httpd/httpd-2.4.46.tar.gz
8+
MODPERL_RELEASE: http://www.cpan.org/authors/id/S/SH/SHAY/mod_perl-2.0.11.tar.gz
9+
10+
jobs:
11+
build:
12+
name: "Build a distribution tarball"
13+
runs-on: ubuntu-latest
14+
15+
container:
16+
image: perldocker/perl-tester:latest
17+
18+
steps:
19+
- name: Setup GitHub user
20+
run: |
21+
apt-get update
22+
apt-get install -y sudo
23+
adduser --uid 1001 github
24+
25+
- name: Build Apache
26+
run: |
27+
apt-get install -y libapr1 libapr1-dev libaprutil1 libaprutil1-dev
28+
wget --no-verbose $APACHE_RELEASE
29+
tar -xzf httpd-*.tar.gz
30+
cd httpd*/
31+
./configure --bindir=/usr/local/bin/ --with-mpm=prefork
32+
make -j 4
33+
make install
34+
cd ../
35+
rm -rf httpd-*
36+
37+
- name: Build mod_perl
38+
run: |
39+
wget --no-verbose $MODPERL_RELEASE
40+
tar -xzf mod_perl-*.tar.gz
41+
cd mod_perl*/
42+
perl Makefile.PL MP_NO_THREADS=1
43+
make -j 4
44+
make install
45+
cd ../
46+
rm -rf mod_perl*
47+
48+
- name: Checkout
49+
uses: actions/checkout@v2
50+
51+
- name: Install CPM + Dist::Zilla Author Bundle
52+
uses: perl-actions/install-with-cpm@stable
53+
with:
54+
sudo: false
55+
install: |
56+
Dist::Zilla::PluginBundle::Author::GTERMARS
57+
Dist::Zilla::PluginBundle::ApacheTest
58+
59+
- name: Install dependencies
60+
run: cpm install -g --no-test --show-build-log-on-failure $(dzil listdeps --author --missing)
61+
62+
- name: Test
63+
run: |
64+
chown -R github .
65+
sudo --user github dzil test --all --test-verbose
66+
67+
- name: Build tarball
68+
run: dzil build
69+
70+
- name: Upload tarball artifact
71+
uses: actions/upload-artifact@v2
72+
with:
73+
name: tarball
74+
path: "*.gz"
75+
76+
- name: Archive CPM logs
77+
if: ${{ failure() }}
78+
uses: actions/upload-artifact@v2
79+
with:
80+
name: build.log
81+
path: ~/.perl-cpm/build.log*
82+
83+
test:
84+
name: "Perl v${{ matrix.perl-version }}"
85+
needs: build
86+
runs-on: ubuntu-latest
87+
88+
strategy:
89+
matrix:
90+
perl-version:
91+
- "latest"
92+
- "5.30"
93+
- "5.28"
94+
- "5.26"
95+
- "5.24"
96+
- "5.22"
97+
- "5.20"
98+
99+
container:
100+
image: perl:${{ matrix.perl-version }}
101+
102+
steps:
103+
- name: Setup GitHub user
104+
run: |
105+
apt-get update
106+
apt-get install -y sudo
107+
adduser --uid 1001 github
108+
109+
- name: Build Apache
110+
run: |
111+
apt-get install -y libapr1 libapr1-dev libaprutil1 libaprutil1-dev
112+
wget --no-verbose $APACHE_RELEASE
113+
tar -xzf httpd-*.tar.gz
114+
cd httpd*/
115+
./configure --bindir=/usr/local/bin/ --with-mpm=prefork
116+
make -j 4
117+
make install
118+
cd ../
119+
rm -rf httpd-*
120+
121+
- name: Build mod_perl
122+
run: |
123+
wget --no-verbose $MODPERL_RELEASE
124+
tar -xzf mod_perl-*.tar.gz
125+
cd mod_perl*/
126+
perl Makefile.PL MP_NO_THREADS=1
127+
make -j 4
128+
make install
129+
cd ../
130+
rm -rf mod_perl*
131+
132+
- name: Download tarball artifact
133+
uses: actions/download-artifact@v2
134+
with:
135+
name: tarball
136+
137+
- name: Unpack tarball
138+
run: tar -xz --strip-components 1 -f *.gz
139+
140+
- name: Perl version
141+
run: perl -V
142+
143+
- name: Install dependencies
144+
uses: perl-actions/install-with-cpanm@v1
145+
with:
146+
sudo: false
147+
args: "--installdeps . --with-recommends"
148+
149+
- name: Build
150+
run: |
151+
perl Makefile.PL
152+
make
153+
154+
- name: Test
155+
run: |
156+
chown -R github .
157+
sudo --user github make test TEST_VERBOSE=1
158+
159+
- name: Archive CPANM logs
160+
if: ${{ failure() }}
161+
uses: actions/upload-artifact@v2
162+
with:
163+
name: build.log
164+
path: ~/.cpanm/work/*/build.log

0 commit comments

Comments
 (0)