Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github ci workflow for linux #290

Closed
wants to merge 14 commits into from
94 changes: 94 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright 2025 Stefan Eissing (https://dev-icing.de)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Linux

'on':
push:
branches:
- master
- '*/ci'
paths-ignore:
- '**/*.md'
pull_request:
branches:
- master
paths-ignore:
- '**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

permissions: {}

env:
MARGS: "-j5"
CFLAGS: "-g"

jobs:
linux:
name: ${{ matrix.build.name }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
build:
- name: mpm_event
install_packages:
install_steps: pytest pebble
mpm: event

- name: mpm_worker
install_packages:
install_steps: pytest pebble
mpm: worker

steps:
- name: 'install prereqs'
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-suggests --no-install-recommends \
libtool autoconf automake pkgconf apache2 apache2-dev openssl \
curl nghttp2-client libssl-dev libnghttp2-dev libcurl4-openssl-dev \
${{ matrix.build.install_packages }}
python3 -m venv $HOME/venv

- uses: actions/checkout@v4

- name: 'install test prereqs'
run: |
[ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
python3 -m pip install -r test/requirements.txt

- name: 'configure'
run: |
export PATH=$PATH:$HOME/go/bin
autoreconf -fi
./configure --enable-werror

- name: 'build'
run: make V=1

- name: pytest
if: contains(matrix.build.install_steps, 'pytest')
env:
MPM: ${{ matrix.build.mpm }}
PYTEST_ADDOPTS: "--color=yes"
run: |
export PATH=$PATH:$HOME/go/bin
[ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
pytest -v
2 changes: 1 addition & 1 deletion test/modules/http2/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .env import H2TestEnv


def pytest_report_header(config, startdir):
def pytest_report_header(config):
env = H2TestEnv()
return f"mod_h2 [apache: {env.get_httpd_version()}, mpm: {env.mpm_module}, {env.prefix}]"

Expand Down
4 changes: 3 additions & 1 deletion test/modules/http2/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class H2TestSetup(HttpdTestSetup):
def __init__(self, env: 'HttpdTestEnv'):
super().__init__(env=env)
self.add_source_dir(os.path.dirname(inspect.getfile(H2TestSetup)))
self.add_modules(["http2", "proxy_http2", "cgid", "autoindex", "ssl", "include"])
self.add_modules(["cgid", "autoindex", "ssl", "include"])
self.add_local_module("http2", "mod_http2/.libs/mod_http2.so")
self.add_local_module("proxy_http2", "mod_http2/.libs/mod_proxy_http2.so")

def make(self):
super().make()
Expand Down
4 changes: 3 additions & 1 deletion test/modules/http2/test_003_get.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import logging
import re
import pytest

from .env import H2Conf, H2TestEnv

log = logging.getLogger(__name__)

@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here")
class TestGet:
Expand All @@ -20,7 +22,7 @@ def _class_scope(self, env):
def test_h2_003_01(self, env):
url = env.mkurl("https", "cgi", "/hello.py")
r = env.curl_get(url, 5, options=["--tlsv1.2"])
assert r.response["status"] == 200
assert r.response["status"] == 200, f'{r}, {env.httpd_error_log.dump(log)}'
assert r.response["json"]["protocol"] == "HTTP/2.0"
assert r.response["json"]["https"] == "on"
tls_version = r.response["json"]["ssl_protocol"]
Expand Down
7 changes: 5 additions & 2 deletions test/modules/http2/test_200_header_invalid.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import logging
import re
import pytest

from .env import H2Conf, H2TestEnv

log = logging.getLogger(__name__)


@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here")
class TestInvalidHeaders:
Expand Down Expand Up @@ -251,7 +254,7 @@ def test_h2_200_17(self, env):
r = env.curl_get(url, options=opt)
assert r.response
assert r.response["status"] == 431
assert env.httpd_error_log.scan_recent(re_emitted)
assert env.httpd_error_log.scan_recent(re_emitted), f'{env.httpd_error_log.dump(log)}'

# test too many failed headers, should give RST
def test_h2_200_18(self, env):
Expand All @@ -270,7 +273,7 @@ def test_h2_200_18(self, env):
opt += ["-H", f"x{i}: 012345678901234567890123456789"]
r = env.curl_get(url, options=opt)
assert r.response is None
assert env.httpd_error_log.scan_recent(re_emitted)
assert env.httpd_error_log.scan_recent(re_emitted), f'{env.httpd_error_log.dump(log)}'

# test header 10 invalid headers, should trigger stream RST
def test_h2_200_19(self, env):
Expand Down
1 change: 1 addition & 0 deletions test/pyhttpd/conf/httpd.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ServerRoot "${server_dir}"
# not in 2.4.x
#DefaultRuntimeDir logs
PidFile "${server_dir}/logs/httpd.pid"
ScriptSock "${server_dir}/logs/cgid.sock"

Include "conf/modules.conf"

Expand Down
1 change: 1 addition & 0 deletions test/pyhttpd/conf/stop.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ServerRoot "${server_dir}"
# not in 2.4.x
#DefaultRuntimeDir logs
PidFile "${server_dir}/logs/httpd.pid"
ScriptSock "${server_dir}/logs/cgid.sock"

Include "conf/modules.conf"

Expand Down
23 changes: 23 additions & 0 deletions test/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Stefan Eissing (https://dev-icing.de)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
pytest
cryptography
filelock
python-multipart
psutil
requests
tqdm
websockets
Loading