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

Add GitHub Actions CI #1660

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 161 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
release:
types: [published]
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Clone nginx-rtmp-module
uses: actions/[email protected]
with:
path: nginx-rtmp-module
- name: Clone OpenSSL
uses: actions/[email protected]
with:
repository: openssl/openssl
ref: OpenSSL_1_1_1-stable
path: openssl
- name: Prepare build environment
run: |
cd ~
sudo apt-get install gcc make mercurial git wget
hg clone http://hg.nginx.org/nginx
mv $GITHUB_WORKSPACE/openssl ~
wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.zip/download -O pcre.zip
unzip pcre.zip
wget https://www.zlib.net/zlib-1.2.11.tar.gz -O zlib.tgz
tar xzf zlib.tgz
mv $GITHUB_WORKSPACE/nginx-rtmp-module ~
cd nginx
rm conf/nginx.conf
cp ~/nginx-rtmp-module/support/nginx.conf conf/nginx.conf
rm docs/html/index.html
cp ~/nginx-rtmp-module/support/index.html docs/html/index.html
auto/configure --prefix=. --add-module=../nginx-rtmp-module --with-openssl=../openssl --with-zlib=../zlib-1.2.11 --with-pcre=../pcre-8.45
- name: Build nginx
run: |
cd ~/nginx
make -j2
- name: Move build files to directory
run: |
cd ~/nginx
mkdir build
mkdir build/logs
touch build/logs/error.log
touch build/logs/access.log
mkdir build/sbin
cp objs/nginx build/sbin/
cp -r conf build/
cp -r docs/html build/
- name: Create archive
run: |
cd ~/nginx/build
tar -czf nginx-with-rtmp-linux.tar.gz *
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: build-linux
path: /home/runner/nginx/build/nginx-with-rtmp-linux.tar.gz
build-windows:
runs-on: windows-latest
steps:
- uses: actions/[email protected]
name: Clone nginx-rtmp-module
with:
path: nginx-rtmp-module
- uses: actions/[email protected]
name: Clone OpenSSL
with:
repository: openssl/openssl
ref: OpenSSL_1_1_1-stable
path: openssl
- uses: ilammy/msvc-dev-cmd@v1
name: Setup msbuild environment
with:
arch: amd64_x86
- uses: ilammy/[email protected]
name: Install NASM
- uses: shogo82148/actions-setup-perl@v1
name: Install PERL
with:
distribution: strawberry
- name: Prepare build environment
shell: bash
run: |
cd ~
rm /usr/bin/perl.exe /usr/bin/link.exe
chocolatey install wget unzip zip
hg clone http://hg.nginx.org/nginx
mv $GITHUB_WORKSPACE/openssl ~
mv $GITHUB_WORKSPACE/nginx-rtmp-module ~
wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.zip/download -O pcre.zip
unzip pcre.zip
wget https://www.zlib.net/zlib-1.2.11.tar.gz -O zlib.tgz
tar xzf zlib.tgz
cd nginx
rm conf/nginx.conf
cp ~/nginx-rtmp-module/support/nginx.conf conf/nginx.conf
rm docs/html/index.html
cp ~/nginx-rtmp-module/support/index.html docs/html/index.html
sed -i 's/-WX/ /' auto/cc/msvc
auto/configure --prefix=. --add-module=../nginx-rtmp-module --with-openssl=../openssl --with-zlib=../zlib-1.2.11 --with-pcre=../pcre-8.45 --with-cc=cl
- name: Build nginx
shell: bash
run: |
cd ~/nginx
nmake
- name: Move build files to directory
shell: bash
run: |
cd ~/nginx
mkdir build
mkdir build/logs
touch build/logs/error.log
touch build/logs/access.log
mkdir build/sbin
cp objs/nginx.exe build/sbin/
cp -r conf build/
cp -r docs/html build/
- name: Generate zip artifact
shell: bash
run: |
cd ~/nginx/build
zip -r nginx-with-rtmp-win32.zip *
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: build-win32
path: C:\Users\runneradmin\nginx\build\nginx-with-rtmp-win32.zip
create-release:
needs: [build-windows, build-linux]
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
steps:
- name: Download Windows artifact
uses: actions/[email protected]
with:
name: build-win32
path: /home/runner/
- name: Download Linux artifact
uses: actions/[email protected]
with:
name: build-linux
path: /home/runner/
- name: Upload linux release
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["/home/runner/nginx-with-rtmp-linux.tar.gz"]'
- name: Upload windows release
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["/home/runner/nginx-with-rtmp-win32.zip"]'
6 changes: 3 additions & 3 deletions ngx_rtmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "ngx_rtmp_bandwidth.h"


#if (NGX_WIN32)
#if (NGX_WIN32) && !defined(__int8)
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
#endif
Expand Down Expand Up @@ -182,7 +182,7 @@ typedef struct {

/* disable zero-sized array warning by msvc */

#if (NGX_WIN32)
#if (NGX_WIN32) && (_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4200)
#endif
Expand Down Expand Up @@ -271,7 +271,7 @@ typedef struct {
} ngx_rtmp_session_t;


#if (NGX_WIN32)
#if (NGX_WIN32) && (_MSC_VER)
#pragma warning(pop)
#endif

Expand Down
3 changes: 2 additions & 1 deletion ngx_rtmp_auto_push_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
#include "ngx_rtmp_relay_module.h"


#if !(NGX_WIN32)
static ngx_rtmp_publish_pt next_publish;
static ngx_rtmp_delete_stream_pt next_delete_stream;

#endif

static ngx_int_t ngx_rtmp_auto_push_init_process(ngx_cycle_t *cycle);
static void ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle);
Expand Down
1 change: 1 addition & 0 deletions ngx_rtmp_eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ ngx_rtmp_eval(void *ctx, ngx_str_t *in, ngx_rtmp_eval_t **e, ngx_str_t *out,
state = ESCAPE;
continue;
}
/* fall through */

/* fall through */

Expand Down
2 changes: 2 additions & 0 deletions ngx_rtmp_exec_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ ngx_module_t ngx_rtmp_exec_module = {
};


#if !(NGX_WIN32)
static void
ngx_rtmp_exec_eval_ctx_cstr(void *sctx, ngx_rtmp_eval_t *e, ngx_str_t *ret)
{
Expand Down Expand Up @@ -406,6 +407,7 @@ static ngx_rtmp_eval_t * ngx_rtmp_exec_event_eval[] = {
ngx_rtmp_exec_event_specific_eval,
NULL
};
#endif


static void *
Expand Down
4 changes: 2 additions & 2 deletions ngx_rtmp_mp4_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static ngx_int_t ngx_rtmp_mp4_reset(ngx_rtmp_session_t *s);

/* disable zero-sized array warning by msvc */

#if (NGX_WIN32)
#if (NGX_WIN32) && (_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4200)
#endif
Expand Down Expand Up @@ -115,7 +115,7 @@ typedef struct {
} ngx_rtmp_mp4_offsets64_t;


#if (NGX_WIN32)
#if (NGX_WIN32) && (_MSC_VER)
#pragma warning(pop)
#endif

Expand Down
8 changes: 4 additions & 4 deletions ngx_rtmp_record_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,12 +510,12 @@ ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
#if (NGX_WIN32)
{
LONG lo, hi;

DWORD ret;
lo = 0;
hi = 0;
lo = SetFilePointer(rctx->file.fd, lo, &hi, FILE_END);
file_size = (lo == INVALID_SET_FILE_POINTER ?
(off_t) -1 : (off_t) hi << 32 | (off_t) lo);
ret = SetFilePointer(rctx->file.fd, lo, &hi, FILE_END);
file_size = (ret == INVALID_SET_FILE_POINTER ?
(off_t) -1 : (off_t) hi << 32 | (off_t) ret);
}
#else
file_size = lseek(rctx->file.fd, 0, SEEK_END);
Expand Down
24 changes: 24 additions & 0 deletions support/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p>The RTMP module is also installed. For usage information you can check the <a href="https://github.com/arut/nginx-rtmp-module/wiki" target="blank">wiki</a>, which contains both a <a href="https://github.com/arut/nginx-rtmp-module/wiki/Tutorial" target="blank">basic tutorial</a> and a <a href="https://github.com/arut/nginx-rtmp-module/wiki/Directives" target="blank">comprehensive guide</a> to all the available directives.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
Loading