Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit e4cecaf

Browse files
prepare 1.2.0 release (#14)
1 parent e965223 commit e4cecaf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+5038
-1345
lines changed

.circleci/config.yml

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,67 @@
1-
version: 2
1+
version: 2.1
2+
3+
orbs:
4+
win: circleci/windows@1.0.0
5+
6+
workflows:
7+
version: 2
8+
build_and_test_all:
9+
jobs:
10+
- build-test-linux
11+
- build-test-osx
12+
- build-test-windows
13+
214
jobs:
315
build-test-linux:
416
docker:
5-
- image: circleci/golang:1.9.6
17+
- image: ldcircleci/ld-c-sdk-ubuntu # defined in sdks-ci-docker project
18+
- image: redis
619
steps:
720
- checkout
821
- run:
9-
name: Install deps
10-
command: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev cmake libpcre3-dev
11-
- run: mkdir build && cd build && cmake ..
12-
- run: cd build && make
13-
- run: cd build && CTEST_OUTPUT_ON_FAILURE=1 make test
14-
- run:
15-
name: Copy Artifacts
22+
name: Build
1623
command: |
17-
mkdir -p /tmp/artifacts
18-
cp build/libldserverapi.a /tmp/artifacts/linux-gcc-64bit-libldserverapi.a
19-
cp build/libldserverapidynamic.so /tmp/artifacts/linux-gcc-64bit-libldserverapi.so
20-
- store_artifacts:
21-
path: /tmp/artifacts
24+
mkdir build && cd build
25+
cmake -D REDIS_STORE=ON ..
26+
cmake --build .
27+
- run:
28+
name: Test
29+
command: ./.ldrelease/test.sh
2230

2331
build-test-osx:
2432
macos:
2533
xcode: "9.0"
2634
steps:
2735
- checkout
2836
- run:
29-
name: Install deps
30-
command: brew install cmake pcre
31-
- run: mkdir build && cd build && cmake ..
32-
- run: cd build && make
33-
- run: cd build && CTEST_OUTPUT_ON_FAILURE=1 make test
37+
name: Install redis
38+
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install redis
39+
- run:
40+
name: Start Redis
41+
command: redis-server
42+
background: true
3443
- run:
35-
name: Copy Artifacts
44+
name: Install prerequisites
45+
command: ./.ldrelease/mac-prepare.sh
46+
- run:
47+
name: Build
3648
command: |
37-
mkdir -p /tmp/artifacts
38-
cp build/libldserverapi.a /tmp/artifacts/osx-clang-64bit-libldserverapi.a
39-
cp build/libldserverapidynamic.dylib /tmp/artifacts/osx-clang-64bit-libldapi.dylib
40-
- store_artifacts:
41-
path: /tmp/artifacts
49+
mkdir build && cd build
50+
cmake -D REDIS_STORE=ON ..
51+
cmake --build .
52+
- run:
53+
name: Test
54+
command: ./.ldrelease/test.sh
4255

43-
workflows:
44-
version: 2
45-
build_and_test_all:
46-
jobs:
47-
- build-test-linux
48-
- build-test-osx
56+
build-test-windows:
57+
executor:
58+
name: win/vs2019
59+
shell: powershell.exe
60+
steps:
61+
- checkout
62+
- run:
63+
name: Build
64+
command: ./.ldrelease/build.ps1
65+
- run:
66+
name: Test
67+
command: ./.ldrelease/test.ps1

.ldrelease/build.ps1

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
# Windows build script for PowerShell
3+
4+
$ErrorActionPreference = "Stop"
5+
6+
Import-Module ".\.ldrelease\helpers.psm1" -Force
7+
8+
SetupVSToolsEnv -architecture amd64
9+
10+
DownloadAndUnzip -url "https://curl.haxx.se/download/curl-7.59.0.zip" -filename "curl.zip"
11+
DownloadAndUnzip -url "https://ftp.pcre.org/pub/pcre/pcre-8.43.zip" -filename "pcre.zip"
12+
13+
Write-Host
14+
Write-Host Building curl
15+
Push-Location
16+
cd curl-7.59.0/winbuild
17+
ExecuteOrFail { nmake /f Makefile.vc mode=static }
18+
Pop-Location
19+
20+
Write-Host
21+
Write-Host Building PCRE
22+
Push-Location
23+
cd pcre-8.43
24+
New-Item -ItemType Directory -Force -Path .\build
25+
cd build
26+
ExecuteOrFail { cmake -G "Visual Studio 16 2019" -A x64 .. }
27+
ExecuteOrFail { cmake --build . }
28+
Pop-Location
29+
30+
Write-Host
31+
Write-Host Building SDK
32+
Push-Location
33+
New-Item -ItemType Directory -Force -Path .\build
34+
cd build
35+
ExecuteOrFail { cmake -G "Visual Studio 16 2019" -A x64 .. }
36+
ExecuteOrFail { cmake --build . }
37+
Pop-Location

.ldrelease/build.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Releaser runs this script for both the Linux build and the Mac build. If we ever need them
6+
# to be different, we can instead provide linux-build.sh and mac-build.sh
7+
8+
mkdir build
9+
cd build
10+
cmake -D REDIS_STORE=ON -D SKIP_DATABASE_TESTS=ON ..
11+
12+
make

.ldrelease/helpers.psm1

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
# PowerShell helper functions for Windows build. These can't be built into Releaser because we also
3+
# need to use them for our regular CI job.
4+
5+
$ProgressPreference = "SilentlyContinue" # prevents console errors from CircleCI host
6+
7+
$vcBaseDir = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC"
8+
$env:Path += ";$vcBaseDir\Common7\Tools"
9+
10+
# This helper function is based on https://github.com/psake/psake - it allows us to terminate the
11+
# script if any external command (like "aws" or "dotnet", rather than a PowerShell cmdlet) returns
12+
# an error code, which PowerShell won't otherwise do.
13+
function ExecuteOrFail {
14+
[CmdletBinding()]
15+
param(
16+
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
17+
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ("Error executing command {0}" -f $cmd)
18+
)
19+
& $cmd
20+
if ($lastexitcode -ne 0) {
21+
throw ($errorMessage)
22+
}
23+
}
24+
25+
function DownloadAndUnzip {
26+
param(
27+
[Parameter(Mandatory)][string]$url,
28+
[Parameter(Mandatory)][string]$filename
29+
)
30+
Write-Host Downloading and expanding $url
31+
ExecuteOrFail { iwr -outf $filename $url }
32+
ExecuteOrFail { unzip $filename | Out-Null }
33+
}
34+
35+
# Using vcvarsall.bat from PowerShell is not straightforward - see
36+
# https://stackoverflow.com/questions/41399692/running-a-build-script-after-calling-vcvarsall-bat-from-powershell
37+
# Invokes a Cmd.exe shell script and updates the environment.
38+
function Invoke-CmdScript {
39+
param(
40+
[String] $scriptName
41+
)
42+
$cmdLine = """$scriptName"" $args & set"
43+
& $Env:SystemRoot\system32\cmd.exe /c $cmdLine |
44+
select-string '^([^=]*)=(.*)$' | foreach-object {
45+
$varName = $_.Matches[0].Groups[1].Value
46+
$varValue = $_.Matches[0].Groups[2].Value
47+
set-item Env:$varName $varValue
48+
}
49+
}
50+
51+
function SetupVSToolsEnv {
52+
param(
53+
[Parameter(Mandatory)][string]$architecture
54+
)
55+
Write-Host "Setting environment for $architecture"
56+
Invoke-CmdScript "$vcBaseDir\Auxiliary\Build\vcvarsall.bat" $architecture
57+
}

.ldrelease/linux-build-docs.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# This only runs in the Linux build, since the docs are the same for all platforms.
6+
7+
PROJECT_DIR=$(pwd)
8+
9+
doxygen
10+
11+
mkdir -p $PROJECT_DIR/artifacts
12+
cd $PROJECT_DIR/docs/build/html
13+
zip -r $PROJECT_DIR/artifacts/docs.zip *

.ldrelease/linux-publish.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mkdir -p artifacts
2+
3+
cp build/libldserverapi.a artifacts/${LD_LIBRARY_FILE_PREFIX}-libldserverapi.a
4+
cp build/libldserverapidynamic.so artifacts/${LD_LIBRARY_FILE_PREFIX}-libldserverapi.so
5+
cp build/stores/redis/libldserverapi-redis.a artifacts/${LD_LIBRARY_FILE_PREFIX}-libldserverapi-redis.a

.ldrelease/mac-prepare.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Adds extra packages prior to build on Mac
6+
7+
HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pcre hiredis

.ldrelease/mac-publish.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mkdir -p artifacts
2+
3+
cp build/libldserverapi.a artifacts/${LD_LIBRARY_FILE_PREFIX}-libldserverapi.a
4+
cp build/libldserverapidynamic.dylib artifacts/${LD_LIBRARY_FILE_PREFIX}-libldserverapi.dylib
5+
cp build/stores/redis/libldserverapi-redis.a artifacts/${LD_LIBRARY_FILE_PREFIX}-libldserverapi-redis.a

.ldrelease/publish.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
# Windows test script for PowerShell (just puts artifacts in output directory)
3+
4+
$prefix = $env:LD_LIBRARY_FILE_PREFIX # set in .ldrelease/config.yml
5+
New-Item -ItemType Directory -Force -Path .\artifacts
6+
7+
cp ".\build\Debug\ldserverapidynamic.dll" ".\artifacts\$prefix-ldserverapi-dynamic.dll"
8+
cp ".\build\Debug\ldserverapidynamic.lib" ".\artifacts\$prefix-ldserverapi-dynamic.lib"
9+
cp ".\build\Debug\ldserverapi.lib" ".\artifacts\$prefix-ldserverapi-static.lib"

.ldrelease/test.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
# Windows test script for PowerShell
3+
4+
$ErrorActionPreference = "Stop"
5+
6+
Import-Module ".\.ldrelease\helpers.psm1" -Force
7+
8+
SetupVSToolsEnv -architecture amd64
9+
10+
cd build
11+
ExecuteOrFail { cmake --build . --target RUN_TESTS }

0 commit comments

Comments
 (0)