Skip to content

Commit

Permalink
chore: Use github actions for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
fdintino committed Jun 21, 2023
1 parent 96e6460 commit 9e47cbb
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 2 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI
on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
env:
NGHTTP2_VERSION: 1.45.1
CURL_VERSION: 7.79.1
strategy:
matrix:
nginx: [1.21.3]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install cpanm
run: |
curl -L https://cpanmin.us | perl - --sudo App::cpanminus
- name: Install local::lib
run: |
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
echo $HOME/perl5 >> $GITHUB_PATH
echo PERL5LIB=$HOME/perl5/lib/perl5:$PERL5LIB >> $GITHUB_ENV
echo PERL_MB_OPT="--install_base \"$HOME/perl5\"" >> $GITHUB_ENV
echo PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" >> $GITHUB_ENV
- name: Install Test::Nginx and Test::File
run: |
cpanm --notest --local-lib=~/perl5 Test::Nginx
cpanm --notest --local-lib=~/perl5 Test::File
cpanm --notest --local-lib=~/perl5 HTTP::Daemon
- name: Build nghttp2
run: |
mkdir -p $RUNNER_TEMP/nghttp2
cd $RUNNER_TEMP/nghttp2
curl -L \
https://github.com/nghttp2/nghttp2/releases/download/v$NGHTTP2_VERSION/nghttp2-$NGHTTP2_VERSION.tar.gz \
| tar -zxC $RUNNER_TEMP
cd $RUNNER_TEMP/nghttp2-$NGHTTP2_VERSION
./configure --prefix=/usr --disable-threads
make && sudo make install
- name: Build curl
run: |
export curl_release=$(echo $CURL_VERSION | perl -pne 's/\./_/g')
curl -L \
https://github.com/curl/curl/releases/download/curl-${curl_release}/curl-${CURL_VERSION}.tar.gz \
| tar -zxC $RUNNER_TEMP
cd $RUNNER_TEMP/curl-$CURL_VERSION
./configure --with-nghttp2 --prefix=/usr/local --with-openssl
make
sudo make install
sudo ldconfig
- name: Compile nginx
run: |
curl -L http://nginx.org/download/nginx-${{ matrix.nginx }}.tar.gz | tar -zx
cd nginx-${{ matrix.nginx }}
./configure \
--with-http_v2_module \
--with-http_ssl_module \
--add-module=.. \
--with-cc-opt='-O0 -coverage -fprofile-arcs -ftest-coverage' \
--with-ld-opt='-lgcov -coverage -fprofile-arcs'
make
export OBJDIR=$GITHUB_WORKSPACE/nginx-${{ matrix.nginx }}/objs
echo OBJDIR=$OBJDIR >> $GITHUB_ENV
echo $OBJDIR >> $GITHUB_PATH
- name: Test
run: |
prove --directives --verbose -r t
- name: Run gcov
run: |
find . \
-type f \
-name '*.gcno' \
-path '*ngx_http_upload_module*' \
-exec gcov \
-pb --object-directory ${{ env.OBJDIR }}/addon/nginx-upload-module *.c -s ${{ env.GITHUB_WORKSPACE }} {} +
- name: Upload to codecov
uses: codecov/codecov-action@v2
with:
verbose: true
2 changes: 1 addition & 1 deletion t/http2.t
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ qr/^(??{'x' x 262144})$/
=== Test 4: http2 upload_limit_rate
--- skip_nginx
9: < 1.10.0
9: < 2.10.0
--- http2
--- config
location = /upload/ {
Expand Down
2 changes: 1 addition & 1 deletion t/lib/Test/Nginx/UploadModule/TestServer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sub new {
},
};
$self->{sock} = HTTP::Daemon->new(
LocalAddr => 'localhost',
LocalAddr => '127.0.0.1',
LocalPort => $self->{opts}->{port},
ReuseAddr => 1
) || die("Could not open socket on port $port: $!");
Expand Down

0 comments on commit 9e47cbb

Please sign in to comment.