Skip to content

Commit 96e0332

Browse files
committed
CI test prior to release
1 parent b1ec69e commit 96e0332

14 files changed

Lines changed: 382 additions & 181 deletions

File tree

.github/workflows/linux.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Linux
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
tags-ignore:
8+
- '*'
9+
pull_request:
10+
11+
jobs:
12+
raku:
13+
strategy:
14+
matrix:
15+
os:
16+
- ubuntu-latest
17+
raku-version:
18+
- 'latest'
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: Raku/setup-raku@v1
23+
with:
24+
raku-version: ${{ matrix.raku-version }}
25+
- name: Install Dependencies
26+
run: zef install --/test --test-depends --deps-only .
27+
- name: Run Special Tests
28+
run: raku run-tests -i

.github/workflows/macos.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: MacOS
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
tags-ignore:
8+
- '*'
9+
pull_request:
10+
11+
jobs:
12+
raku:
13+
strategy:
14+
matrix:
15+
os:
16+
- macos-latest
17+
raku-version:
18+
- 'latest'
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: Raku/setup-raku@v1
23+
with:
24+
raku-version: ${{ matrix.raku-version }}
25+
- name: Install Dependencies
26+
run: zef install --/test --test-depends --deps-only .
27+
- name: Run Special Tests
28+
run: raku run-tests -i
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test
1+
name: Windows
22

33
on:
44
push:
@@ -13,20 +13,16 @@ jobs:
1313
strategy:
1414
matrix:
1515
os:
16-
- ubuntu-latest
17-
- macos-latest
1816
- windows-latest
1917
raku-version:
2018
- 'latest'
2119
runs-on: ${{ matrix.os }}
2220
steps:
23-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
2422
- uses: Raku/setup-raku@v1
2523
with:
2624
raku-version: ${{ matrix.raku-version }}
2725
- name: Install Dependencies
2826
run: zef install --/test --test-depends --deps-only .
29-
- name: Install App::Prove6
30-
run: zef install --/test App::Prove6
31-
- name: Run Tests
32-
run: prove6 -I. t
27+
- name: Run Special Tests
28+
run: raku run-tests -i

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.precomp/
22
/SCGI-*
3+
*.rakucov

Changes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Revision history for SCGI
22

33
{{$NEXT}}
4+
- Tightened dependencies
5+
- Modernize doc and META6
6+
- Add preliminary coverage testing
7+
- Update copyright year
48

59
2.5 2022-05-15T21:55:43+02:00
610
- First version in the zef ecosystem

META6.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"auth": "zef:raku-community-modules",
3+
"authors": [
4+
"Timothy Totten, supernovus",
5+
"Raku community"
6+
],
37
"build-depends": [
48
],
59
"depends": [
6-
"HTTP::Status",
7-
"Netstring",
8-
"PSGI"
10+
"HTTP::Status:ver<0.0.5+>:auth<zef:lizmat>",
11+
"Netstring:ver<0.0.4+>:auth<zef:raku-community-modules>",
12+
"PSGI:ver<1.2.2+>:auth<zef:raku-community-modules>"
913
],
1014
"description": "A SCGI library for Raku",
1115
"license": "Artistic-2.0",
@@ -21,11 +25,11 @@
2125
},
2226
"resources": [
2327
],
24-
"source-url": "git://github.com/raku-community-modules/SCGI.git",
28+
"source-url": "https://github.com/raku-community-modules/SCGI.git",
2529
"tags": [
2630
"SCGI"
2731
],
2832
"test-depends": [
2933
],
30-
"version": "2.5"
34+
"version": "2.6"
3135
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Actions Status](https://github.com/raku-community-modules/SCGI/actions/workflows/test.yml/badge.svg)](https://github.com/raku-community-modules/SCGI/actions)
1+
[![Actions Status](https://github.com/raku-community-modules/SCGI/actions/workflows/linux.yml/badge.svg)](https://github.com/raku-community-modules/SCGI/actions) [![Actions Status](https://github.com/raku-community-modules/SCGI/actions/workflows/macos.yml/badge.svg)](https://github.com/raku-community-modules/SCGI/actions) [![Actions Status](https://github.com/raku-community-modules/SCGI/actions/workflows/windows.yml/badge.svg)](https://github.com/raku-community-modules/SCGI/actions)
22

33
NAME
44
====
@@ -136,7 +136,7 @@ COPYRIGHT AND LICENSE
136136

137137
Copyright 2013 - 2017 Timothy Totten
138138

139-
Copyright 2018 - 2022 Raku Community
139+
Copyright 2018 - 2026 Raku Community
140140

141141
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
142142

dist.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ name = SCGI
22

33
[ReadmeFromPod]
44
; enabled = false
5-
filename = lib/SCGI.rakumod
5+
filename = doc/SCGI.rakudoc
66

77
[UploadToZef]
88

99
[PruneFiles]
1010
; match = ^ 'xt/'
1111

1212
[Badges]
13-
provider = github-actions/test.yml
13+
provider = github-actions/linux.yml
14+
provider = github-actions/macos.yml
15+
provider = github-actions/windows.yml

doc/SCGI.rakudoc

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
=begin pod
2+
3+
=head1 NAME
4+
5+
SCGI - A SCGI library for Raku
6+
7+
=head1 DESCRIPTION
8+
9+
This is a simple SCGI library for Raku.
10+
11+
It's main influences are the Perl SCGI library, and the
12+
Raku HTTP::Daemon library.
13+
14+
It offers a bit of candy coating compared to the Perl version.
15+
16+
By default is uses a PSGI-compliant interface, but can also handle
17+
raw HTTP responses.
18+
19+
You don't need to create your own C<IO::Socket::INET> object.
20+
Just pass an 'addr' and 'port' attribute to the new() declaration and it'll
21+
create the object for you.
22+
23+
=head1 USAGE
24+
25+
The simplest (and recommended) form of usage is to use the handle() method
26+
with PSGI-compliant output. Here's an example:
27+
28+
=begin code :lang<raku>
29+
use SCGI;
30+
31+
my $scgi = SCGI.new( :port(8118) );
32+
33+
sub handler(%env) {
34+
my $name = %env<QUERY_STRING> || 'world';
35+
my $status = '200';
36+
my @headers = 'Content-Type' => 'text/plain';
37+
my @body = "Hello $name\n";
38+
@headers.push: 'Content-Length' => @body.join.encode.bytes;
39+
[ $status, @headers, @body ]
40+
}
41+
42+
$scgi.handle: &handler;
43+
=end code
44+
45+
There are other ways of using SCGI, such as writing your own run loop,
46+
or using a raw HTTP output instead of PSGI. Here's an example doing both:
47+
48+
=begin code :lang<raku>
49+
use SCGI;
50+
51+
my $scgi = SCGI.new( :port(8118), :!PSGI, :!P6SGI );
52+
while my $connection = $scgi.accept() {
53+
my $request = $connection.request;
54+
if $request.success {
55+
my $name = $request.env<QUERY_STRING> || 'world';
56+
my $return = "Hello $name\n";
57+
my $len = $return.encode.bytes;
58+
my $headers = "Content-Type: text/plain\nContent-Length: $len\n";
59+
$connection.send("$headers\n$return");
60+
}
61+
$connection.close;
62+
}
63+
=end code
64+
65+
Test script representing both examples can be found in the 'examples' folder.
66+
67+
If you are serious about using SCGI for web application development, see
68+
the L<Web|https://github.com/raku-community-modules/Web/> library set,
69+
or one of the full blown frameworks built using it.
70+
71+
=head1 CONFIGURATION
72+
73+
=head2 nginx
74+
75+
Make sure you compiled nginx with the SCGI plugin (it is included by default.)
76+
Then, in one of your server blocks, add a location mount:
77+
78+
=begin code :lang<nginx>
79+
location /scgi/ {
80+
scgi_pass 127.0.0.1:8118;
81+
include scgi_params;
82+
# Optionally rewrite document URI path
83+
rewrite ^/scgi/(.*) /$1 break;
84+
# Some applications may need rewritten URI in PATH_INFO
85+
scgi_param PATH_INFO $uri;
86+
}
87+
=end code
88+
89+
=head2 lighttpd
90+
91+
First, make sure the SCGI library is being loaded.
92+
93+
=begin code :lang<lighttpd>
94+
server.modules += ( "mod_scgi" )
95+
=end code
96+
97+
Next, set up an SCGI handler:
98+
99+
=begin code :lang<lighttpd>
100+
scgi.server = (
101+
"/scgi" =>
102+
((
103+
"host" => "127.0.0.1",
104+
"port" => 8118,
105+
"check-local" => "disable"
106+
))
107+
)
108+
=end code
109+
110+
=head2 Apache 2 with mod_scgi:
111+
112+
Add the following line to your site config, changing the details to match your
113+
SCGI script configuration:
114+
115+
=begin code :lang<apache>
116+
SCGIMount /scgi/ 127.0.0.1:8118
117+
=end code
118+
119+
=head2 Apache 2 with mod_proxy_scgi:
120+
121+
Add the following line to your site config, changes the details to match your
122+
SCGI script configuration:
123+
124+
=begin code :lang<apache>
125+
<Proxy *>
126+
Order deny,allow
127+
Allow from all
128+
</Proxy>
129+
ProxyPass /scgi/ scgi://localhost:8118/
130+
=end code
131+
132+
=head1 AUTHOR
133+
134+
Timothy Totten
135+
136+
=head1 COPYRIGHT AND LICENSE
137+
138+
Copyright 2013 - 2017 Timothy Totten
139+
140+
Copyright 2018 - 2026 Raku Community
141+
142+
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
143+
144+
=end pod
145+
146+
# vim: expandtab shiftwidth=4

0 commit comments

Comments
 (0)