Skip to content

Commit

Permalink
CI: Switched from Travis+Appveyor to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
snej committed Jan 13, 2021
1 parent a3bcce4 commit d1d0e8f
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 67 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build and Test

on: [push, pull_request]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}


steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Create Build Environment
# Create a build directory, as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE

- name: Install French Locale On Linux
if: runner.os == 'Linux'
shell: bash
# One of the tests below needs the French locale installed.
run: sudo localedef -v -c -i fr_FR -f UTF-8 fr_FR

- name: Test
if: runner.os != 'Windows'
working-directory: ${{github.workspace}}/build
shell: bash
run: |
set -e
cmake --build . --config Debug --target FleeceTests
cd ..
build/FleeceTests
- name: Test On Windows
if: runner.os == 'Windows'
working-directory: ${{github.workspace}}/build
shell: bash
run: |
set -e
cmake --build . --config Debug --target FleeceTests
mkdir -p /c/tmp
Debug/FleeceTests.exe
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

17 changes: 9 additions & 8 deletions Tests/EncoderTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ class EncoderTests {

{
FILE *out = fopen(kTempDir"fleecetemp.fleece", "wb");
REQUIRE(out != nullptr);
Encoder fenc(out);
fenc.writeValue(root);
fenc.end();
Expand Down Expand Up @@ -953,13 +954,13 @@ class EncoderTests {
float testFloat = 2.71828f;
sprintf(doubleBuf, "%.16g", testDouble);
sprintf(floatBuf, "%.7g", testFloat);
CHECK(strcmp(doubleBuf, "3.141592653589793") == 0);
CHECK(strcmp(floatBuf, "2.71828") == 0);
CHECK(std::string(doubleBuf) == "3.141592653589793");
CHECK(std::string(floatBuf) == "2.71828");

WriteFloat(testDouble, doubleBuf, 32);
WriteFloat(testFloat, floatBuf, 32);
CHECK(strcmp(doubleBuf, "3.141592653589793") == 0);
CHECK(strcmp(floatBuf, "2.71828") == 0);
CHECK(std::string(doubleBuf) == "3.141592653589793");
CHECK(std::string(floatBuf) == "2.71828");

double recovered = ParseDouble(doubleBuf);
float recovered_f = (float)ParseDouble(floatBuf);
Expand All @@ -974,13 +975,13 @@ class EncoderTests {

sprintf(doubleBuf, "%.16g", testDouble);
sprintf(floatBuf, "%.7g", testFloat);
CHECK(strcmp(doubleBuf, "3,141592653589793") == 0);
CHECK(strcmp(floatBuf, "2,71828") == 0);
CHECK(std::string(doubleBuf) == "3,141592653589793");
CHECK(std::string(floatBuf) == "2,71828");

WriteFloat(testDouble, doubleBuf, 32);
WriteFloat(testFloat, floatBuf, 32);
CHECK(strcmp(doubleBuf, "3.141592653589793") == 0);
CHECK(strcmp(floatBuf, "2.71828") == 0);
CHECK(std::string(doubleBuf) == "3.141592653589793");
CHECK(std::string(floatBuf) == "2.71828");

recovered = strtod(doubleBuf, nullptr);
recovered_f = (float)strtod(floatBuf, nullptr);
Expand Down
29 changes: 0 additions & 29 deletions appveyor.yml

This file was deleted.

4 changes: 4 additions & 0 deletions cmake/platform_win.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ function(setup_test_build)
-D_USE_MATH_DEFINES # Define math constants like PI
-DNOMINMAX # Get rid of pesky Windows macros for min and max
)
target_compile_options(
FleeceTests PRIVATE
"/utf-8" # Some source files have UTF-8 literals
)
endfunction()

0 comments on commit d1d0e8f

Please sign in to comment.