Skip to content

Commit

Permalink
Merge pull request #279 from alex-sparus/catch-2-3
Browse files Browse the repository at this point in the history
Use Catch2 v3
  • Loading branch information
arximboldi authored Feb 15, 2024
2 parents fe0b6f8 + 0f24d39 commit 57a8c5e
Show file tree
Hide file tree
Showing 60 changed files with 847 additions and 272 deletions.
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu

# cache /nix
VOLUME /nix

RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux \
--extra-conf "sandbox = false" \
--init none \
--no-confirm
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
"dockerFile": "Dockerfile",
"context": "${localWorkspaceFolder}",
"runArgs": [
"--security-opt",
"label=disable"
],
"mounts": [
"source=nix-ubuntu-container,target=/nix,type=volume"
],
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/base:${templateOption:imageVariant}"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"xaver.clang-format",
"arrterian.nix-env-selector",
"ms-vscode.cpptools",
"kamadorueda.alejandra"
]
}
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// We need root because nix without systemd works only as root.
"remoteUser": "root"
}
27 changes: 12 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,33 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # needed for fetchGit in default.nix
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
- uses: cachix/cachix-action@v14
with:
name: arximboldi
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-build
- run: nix build
- run: nix flake check -L

build-spm:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
- run: swift build

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
- uses: cachix/install-nix-action@v20
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
- uses: cachix/cachix-action@v14
with:
name: arximboldi
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
Expand Down Expand Up @@ -92,11 +89,11 @@ jobs:
opts: ['benchmark']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v20
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
- uses: cachix/cachix-action@v14
with:
name: arximboldi
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ tools/clojure/.lein*

.build
.swiftpm
.vscode
.pre-commit-config.yaml
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ option(immer_BUILD_TESTS "Build tests" ON)
option(immer_BUILD_EXAMPLES "Build examples" ON)
option(immer_BUILD_DOCS "Build docs" ON)
option(immer_BUILD_EXTRAS "Build extras" ON)
option(immer_INSTALL_FUZZERS "Install fuzzers" off)

set(CXX_STANDARD 14 CACHE STRING "c++ standard number")

Expand Down Expand Up @@ -136,16 +137,16 @@ endif()
# Testing
# =======

if (immer_BUILD_TESTS OR immer_BUILD_EXAMPLES OR immer_BUILD_EXTRAS)
add_custom_target(check
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Build and run all the tests and examples.")
endif()

if (immer_BUILD_TESTS)
enable_testing()

find_package(Catch2 REQUIRED)

add_custom_target(check
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Build and run all the tests and examples.")

add_subdirectory(test)
add_subdirectory(benchmark)
endif()
Expand Down
66 changes: 33 additions & 33 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{ pkgs ? import <nixpkgs> {} }:

with pkgs;

let
inherit (import (pkgs.fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore.nix";
rev = "80463148cd97eebacf80ba68cf0043598f0d7438";
sha256 = "1l34rmh4lf4w8a1r8vsvkmg32l1chl0p593fl12r28xx83vn150v";
}) {}) gitignoreSource;
{pkgs ? import <nixpkgs> {}}:
with pkgs; let
inherit
(import (pkgs.fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore.nix";
rev = "80463148cd97eebacf80ba68cf0043598f0d7438";
sha256 = "1l34rmh4lf4w8a1r8vsvkmg32l1chl0p593fl12r28xx83vn150v";
}) {})
gitignoreSource
;

nixFilter = name: type: !(lib.hasSuffix ".nix" name);
srcFilter = src: lib.cleanSourceWith {
filter = nixFilter;
src = gitignoreSource src;
};

srcFilter = src:
lib.cleanSourceWith {
filter = nixFilter;
src = gitignoreSource src;
};
in
stdenv.mkDerivation rec {
name = "immer-git";
version = "git";
src = srcFilter ./.;
nativeBuildInputs = [ cmake ];
dontBuild = true;
dontUseCmakeBuildDir = true;
cmakeFlags = [
"-Dimmer_BUILD_TESTS=OFF"
"-Dimmer_BUILD_EXAMPLES=OFF"
];
meta = {
homepage = "https://github.com/arximboldi/immer";
description = "Postmodern immutable data structures for C++";
license = lib.licenses.boost;
};
}
stdenv.mkDerivation rec {
name = "immer-git";
version = "git";
src = srcFilter ./.;
nativeBuildInputs = [cmake];
dontBuild = true;
dontUseCmakeBuildDir = true;
cmakeFlags = [
"-Dimmer_BUILD_TESTS=OFF"
"-Dimmer_BUILD_EXAMPLES=OFF"
];
meta = {
homepage = "https://github.com/arximboldi/immer";
description = "Postmodern immutable data structures for C++";
license = lib.licenses.boost;
};
}
3 changes: 3 additions & 0 deletions extra/fuzzer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ foreach(_file IN LISTS immer_fuzzers)
if (CHECK_FUZZERS)
add_test("fuzzer/${_output}" ${_output} -max_total_time=1)
endif()
if (immer_INSTALL_FUZZERS)
install(TARGETS ${_target} DESTINATION bin)
endif()
endforeach()
146 changes: 146 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 57a8c5e

Please sign in to comment.