Skip to content

Commit

Permalink
Merge pull request #2781 from vibe-d/fix_windows_ci
Browse files Browse the repository at this point in the history
Revive Windows CI
  • Loading branch information
l-kramer authored Feb 15, 2024
2 parents b570414 + c95a802 commit 3daf528
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:
env:
VIBED_DRIVER: vibe-core
PARTS: ${{ matrix.parts }}
OS: ${{ matrix.os }}
shell: bash
run: |
./run-ci.sh
Expand Down Expand Up @@ -103,9 +105,11 @@ jobs:
compiler: ${{ matrix.dc }}
dub: 1.29.0

- name: '[POSIX] Run tests'
- name: '[WINDOWS] Run tests'
env:
VIBED_DRIVER: vibe-core
PARTS: ${{ matrix.parts }}
OS: ${{ matrix.os }}
shell: bash
run: |
./run-ci.sh
2 changes: 1 addition & 1 deletion run-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [[ $PARTS =~ (^|,)builds(,|$) ]]; then
dub clean --all-packages

# test for successful 32-bit build
if [ "$DC" == "dmd" ]; then
if [ "$DC" == "dmd" && "$OS" != "windows-latest" ]; then
dub build --combined --arch=x86
dub clean --all-packages
fi
Expand Down
13 changes: 9 additions & 4 deletions tests/vibe.http.client.1389/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ shared static this()
auto url = "http://"~serverAddr.toString;
logInfo(url);

auto cs = new HTTPClientSettings;
cs.networkInterface = resolveHost("127.0.0.1");
auto res = requestHTTP(url, null, cs).bodyReader.readAllUTF8();
assert(res == "local", "Unexpected reply: "~res);
string res;

version (Windows) {}
else {
auto cs = new HTTPClientSettings;
cs.networkInterface = resolveHost("127.0.0.1");
res = requestHTTP(url, null, cs).bodyReader.readAllUTF8();
assert(res == "local", "Unexpected reply: "~res);
}

auto cs2 = new HTTPClientSettings;
cs2.networkInterface = resolveHost(externalAddr.toAddressString());
Expand Down
7 changes: 5 additions & 2 deletions tests/vibe.http.client.1426/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ extern(C) __gshared string[] rt_options = [ "gcopt=parallel:0" ];
int main ()
{
immutable serverAddr = listenTCP(0, (TCPConnection c) @safe nothrow {
try c.write("HTTP/1.1 200 OK\r\nConnection: Close\r\n\r\nqwerty");
catch (Exception e) assert(0, e.msg);
try {
// skip request
c.readUntil(cast(immutable(ubyte)[])"\r\n\r\n");
c.write("HTTP/1.1 200 OK\r\nConnection: Close\r\n\r\nqwerty");
} catch (Exception e) assert(0, e.msg);
}, "127.0.0.1").bindAddress;

runTask({
Expand Down
6 changes: 4 additions & 2 deletions tests/vibe.http.server.listenHTTP/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import std.socket : AddressFamily;

shared static this()
{
immutable serverAddr = listenHTTP(":0", (scope req, scope res) {
immutable serverPort = listenHTTP(":0", (scope req, scope res) {
res.writeBody("Hello world.");
}).bindAddresses.find!(addr => addr.family == AddressFamily.INET).front;
}).bindAddresses.find!(addr => addr.family == AddressFamily.INET).front.port;
auto serverAddr = resolveHost("127.0.0.1");
serverAddr.port = serverPort;

runTask({
scope (exit) exitEventLoop();
Expand Down

0 comments on commit 3daf528

Please sign in to comment.