Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
fcf9748
chore(tests): #14: rename the 'test' directory to 'tests', since it w…
aasheptunov Mar 24, 2026
f114679
ci(tests): #14: add workflows for karate tests; remove of the build w…
aasheptunov Mar 24, 2026
6e18899
ci(tests): #14: add a push event to the workflow so that the workflow…
aasheptunov Mar 24, 2026
23639db
ci(workflows): #14: add the dockerfile required to run the workflow
aasheptunov Mar 24, 2026
8b9855d
ci(tests): #14: add services for karate testing to docker compose
aasheptunov Mar 25, 2026
08f07ae
Merge branch 'master' into feature/#14-integrate-and-add-e2e-tests-in…
aasheptunov Mar 25, 2026
9f05bca
Merge branch 'master' into feature/#14-integrate-and-add-e2e-tests-in…
aasheptunov Mar 25, 2026
0de63d0
ci(test): #14: return the test execution job within docker compose
aasheptunov Mar 25, 2026
2881d8f
fix(tests): #14: correct the service name in the dependencies of the …
aasheptunov Mar 25, 2026
b052a6d
fix(tests): #14: remove of redundant environment variable definitions…
aasheptunov Mar 25, 2026
ec31200
fix(tests): #14: add a step to create and populate the .env file so t…
aasheptunov Mar 25, 2026
278c16d
fix(tests): #14: commenting out a temporarily redundant file
aasheptunov Mar 25, 2026
accc8b9
feat(controllers): #14: change the logic for adding a new task by ret…
aasheptunov Mar 26, 2026
6e864f1
test(e2e): #14: add a test that verifies the functionality for creati…
aasheptunov Mar 26, 2026
94d3cd6
fix(tests): #14: correct the comments, otherwise the karate parser wo…
aasheptunov Mar 26, 2026
70f6f0c
fix(tests): #14: correct the port value for the root path within the …
aasheptunov Mar 27, 2026
21a4b4f
chore(git): #14: update the .gitignore file so that the .DS_Store Fin…
aasheptunov Mar 29, 2026
0fafa61
chore(makefile): #14: updating the name of the run-tidy target to som…
aasheptunov Mar 29, 2026
210436e
chore(devcontainer): #14: merging duplicate configurations
aasheptunov Mar 29, 2026
5a456d7
chore(devcontainer): #14: add an environment variable containing the …
aasheptunov Mar 29, 2026
574b7c3
chore(makefile): #14: add the targets up-db, ci-apply-migrations, and…
aasheptunov Mar 30, 2026
7b137ca
ci(workflow): #14: replace native commands with Makefile targets so t…
aasheptunov Mar 30, 2026
a8fa243
test(tests): #14: add test cases for the other endpoints
aasheptunov Mar 30, 2026
38d8a2f
feat(tests): #14: add pgAdmin to enable database viewing; add API sta…
aasheptunov Mar 30, 2026
0eba13a
fix(dockerfile): #14: fix an error related to a path that does not in…
aasheptunov Mar 30, 2026
ab9514a
test(tests): #14: change the data type of a field referenced in a tes…
aasheptunov Mar 30, 2026
312c730
ci(tests): #14: correct the repository link in the workflow so that t…
aasheptunov Mar 30, 2026
0d4bef3
test(tests): #14: add the server response output to the test case for…
aasheptunov Mar 30, 2026
dd8d970
ci(tests): #14: update the branch for the to-dos-local-env repository…
aasheptunov Mar 30, 2026
d2b0eb9
chore(makefile): #14: change the condition for including the .env fil…
aasheptunov Mar 30, 2026
c007557
ci(workflows): #14: add a workflow trigger condition to a PR for debu…
aasheptunov Mar 30, 2026
9dd4ae0
chore(dockerfile): #14: experiment with accepting migrations without …
aasheptunov Mar 30, 2026
ee367fe
fix(tests): #14: correct the name of the helmfile
aasheptunov Mar 30, 2026
e85a787
ci(tests): #14: modify the command being called to bypass the use of …
aasheptunov Mar 30, 2026
d4ec4e0
ci(tests): #14: add caching when building digests so that dependencie…
aasheptunov Mar 30, 2026
aea1677
ci(tests): #14: add dependency copying before the installation and bu…
aasheptunov Mar 30, 2026
2e86af4
ci(tests): #14: add a debug message
aasheptunov Mar 30, 2026
5f017eb
ci(tests): #14: add a debug message
aasheptunov Mar 30, 2026
224aacb
ci(tests): #14: add a debug message
aasheptunov Mar 30, 2026
0a473e7
ci(tests): #14: changes required to restart the workflow
aasheptunov Mar 30, 2026
3281c43
ci(workflows): #14: add branch-based cache partitioning based on wher…
aasheptunov Mar 31, 2026
f8efa2e
docs: #14: add clarifying comments to the Dockerfile
aasheptunov Mar 31, 2026
77331b7
ci(tests): #14: update the to-dos-local-env repository branch; update…
aasheptunov Mar 31, 2026
11a8c80
ci(tests): #14: restore the workflow activation conditions on the PR
aasheptunov Mar 31, 2026
ea3c8a1
ci(workflows): #14: remove the debug call for image building from the PR
aasheptunov Mar 31, 2026
606a8ad
fix(tests): #14: correct the parameter name, as the previous one did …
aasheptunov Mar 31, 2026
3098d94
refactor(controllers): #14: remove the health check since it is redun…
aasheptunov Apr 1, 2026
8c9219d
ci(tests): #14: add a makefile target to run karate tests inside dock…
aasheptunov Apr 1, 2026
7369349
ci(workflows): #14: add a condition to trigger the workflow on a push…
aasheptunov Apr 1, 2026
dbb1c42
ci(tests): #14: remove the makefile target for karate tests, as using…
aasheptunov Apr 1, 2026
2cff037
ci(workflows): #14: remove of the condition requiring the latest tag …
aasheptunov Apr 1, 2026
9dda99c
ci(tests): #14: add image caching to the docker compose API to speed …
aasheptunov Apr 1, 2026
0b102f7
ci(tests): #14: adda syntax version parameter to docker compose to al…
aasheptunov Apr 1, 2026
1452dcb
ci(tests): #14: add a step to output the Docker Compose version
aasheptunov Apr 1, 2026
1264aa2
ci(workflows): #14: add the `docker/setup-buildx-action@v3` installat…
aasheptunov Apr 1, 2026
0f10448
ci(workflows): #14: change the caching method to gha for debugging
aasheptunov Apr 1, 2026
6467d3f
fix(tests): #14: fix docker compose validation error
aasheptunov Apr 1, 2026
f7164d8
fix(tests): #14: remove the cache save step so that no error occurs w…
aasheptunov Apr 1, 2026
6c07d7b
Merge branch 'master' into feature/#14-integrate-and-add-e2e-tests-in…
aasheptunov Apr 1, 2026
ee3728b
fix(controllers): #14: correctthe field name in the JSON returned by …
aasheptunov Apr 1, 2026
41745a7
chore(tests): #14: change the location of the test directory; update …
aasheptunov Apr 2, 2026
42ca394
fix(tests): #14: fix the issue with mounting the .conan2 directory du…
aasheptunov Apr 2, 2026
34c24b8
ci(dockerfile): #14: removethe step to install make from the build st…
aasheptunov Apr 2, 2026
c21e384
fix(workflows): #14: change the host address when specifying the .env…
aasheptunov Apr 2, 2026
f2596ff
docs: remove of redundant comments
aasheptunov Apr 2, 2026
b7e6af9
ci(dockerfile): #14: add clarifying comments to the Dockerfile; remov…
aasheptunov Apr 2, 2026
2a4541c
ci(dockerfile): #14: add clarifying comments to the Dockerfile; remov…
aasheptunov Apr 2, 2026
eba3911
ci(dockerignore): #14: add a dockerignore file so that files not requ…
aasheptunov Apr 2, 2026
7b9398f
ci(dockerfile): #14: remove the redundant environment variable defini…
aasheptunov Apr 2, 2026
b725fbb
ci(dockerfile): #14: add additional paths to .dockerignore so that fi…
aasheptunov Apr 2, 2026
7dc1b1c
ci(dockerfile): #14: remove unnecessary environment variable from the…
aasheptunov Apr 2, 2026
61c5c85
ci(tests): #14: add a hash check for values in to-dos-api-cpp within …
aasheptunov Apr 2, 2026
25671f0
ci(workflows): #14: add a command to update the commit sha for the in…
aasheptunov Apr 2, 2026
932c28a
ci(workflows): #14: update the reference hash; add a clarifying comment
aasheptunov Apr 2, 2026
9e0aae4
ci(workflows): #14: merge two stages into one so that all the prep wo…
aasheptunov Apr 2, 2026
6d43ea1
docs: add clarifying comments
aasheptunov Apr 2, 2026
f880318
ci(workflows): #14: comment out the step to retrieve the version from…
aasheptunov Apr 2, 2026
e653493
docs(workflows): #14: add a comment to the GitHub workflow that clari…
aasheptunov Apr 7, 2026
ed9da39
refactor(app-config): #14: remove the default value from app-config t…
aasheptunov Apr 7, 2026
96db180
chore(devcontainer): #14: add the forwardPorts and portsAttributes co…
aasheptunov Apr 7, 2026
bc728ce
docs(readme): #14: add an Allocated Ports & Services section to the R…
aasheptunov Apr 7, 2026
39daf9d
feat(app-config): #14: add error messages for incorrectly defined env…
aasheptunov Apr 7, 2026
6e0feef
fix(tests): #14: correct the name of the Makefile target as it had pr…
aasheptunov Apr 7, 2026
b6a59b6
refactor(tests): #14: remove the link to the branch in the to-dos-loc…
aasheptunov Apr 7, 2026
e0474c1
chore: #14: rename it to match the test
aasheptunov Apr 21, 2026
d2df268
ci: #14: merge the dependency loading layers in a single layer so as …
aasheptunov Apr 21, 2026
e8d96e9
feat: #14: add clarifying logs; add error handling; remove redundant …
aasheptunov Apr 21, 2026
27e3c7d
test: #14: rename it to match the test
aasheptunov Apr 21, 2026
e572bc3
refactor: #14: formatting changes
aasheptunov Jun 8, 2026
6b890d9
fix: #14: update database service credentials for to-dos-api-cpp serv…
aasheptunov Jun 9, 2026
12a03c1
fix: #14: add character required for correct execution to conditions …
aasheptunov Jun 9, 2026
9de6aa1
infra: #14: change to-dos-api-cpp helmfile hash to github repo action…
aasheptunov Jun 11, 2026
fa6e104
infra: #14: change condition for to-dos-api-cpp service in to-dos-api…
aasheptunov Jun 11, 2026
b00e44b
build: #14: remove redundant slash in curl parameter so that prevent …
aasheptunov Jun 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04 AS base
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
build-essential clang lld make gdb cmake ninja-build \
RUN apt-get update && apt-get -y install --no-install-recommends \
build-essential clang lld gdb make cmake ninja-build \
crossbuild-essential-arm64 \
git curl wget unzip sudo \
Comment thread
aasheptunov marked this conversation as resolved.
pip \
Expand All @@ -13,4 +12,6 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

RUN pip install conan alembic psycopg2-binary sqlalchemy-utils

COPY to-dos-conan-profile.conf /root/.conan2/profiles/default
# If this profile is not copied, the profile must be specified via an argument
# when calling `conan`.
COPY ./to-dos-conan-profile.conf /root/.conan2/profiles/default
32 changes: 27 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,35 @@
"dockerfile": "Dockerfile"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
"forwardPorts": [
4501,
7501,
9501
],
// More information about 'portsAttributes' here: https://containers.dev/implementors/json_reference/#port-attributes
"portsAttributes": {
"4501": {
"label": "VSCode Dev Container API Running Port",
"requireLocalPort": true
},
"7501": {
"label": "VSCode Dev Container DB Running Port",
"requireLocalPort": true
},
"9501": {
"label": "VSCode Dev Container PgAdmin Running Port",
"requireLocalPort": true
}
},
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "conan remote add local-recipes ./deps --type=local-recipes-index", // Add a local recipes store for odb libraries
"postCreateCommand": "conan remote add local-recipes ./deps --type=local-recipes-index --force", // Add a local recipes store for odb libraries. Need force flag for redefine while second time container is up
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root",
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
"runArgs": [
// This is necessary to avoid having to manually export environment variables from
// the .env file in every terminal session.
Expand All @@ -24,10 +46,10 @@
"mounts": [
// This mounts increase future building on devcontainer in case any reseting of container volumes
// Mount caching of build folder
"source=dev-build-cache,target=${containerWorkspaceFolder}/build,type=volume",
"source=dev-build-cache,target=${containerWorkspaceFolder}/build,type=volume",
// Mount caching of conan dependencies builds
"source=dev-conan-cache,target=~/.conan2,type=volume"
],
"source=dev-conan-cache,target=/root/.conan2,type=volume"
],
"customizations": {
"vscode": {
"extensions": [
Expand Down
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.github/
.vscode/
build/
ci/
scripts/
e2e/
docs/
.clang-format
.clang-tidy
.env
.env.example
.gitattributes
.gitignore
CMakeUserPresets.json
docker-compose.yml
Dockerfile
LICENSE
pgAdmin.json
README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ name: Publish Docker image
# if you build => deploy => run e2e against prod it will build the image 3 times!
on:
# to allow to wait for a docker image to be published to proceed in another workflow
# workflow_call:
# PR-based activation has been added, as there are no workflows that trigger this.
# After adding a workflow with tests, you must revert the change and leave only the `workflow_call`.
pull_request:
types: [opened, synchronize]
workflow_call:
# This event has been added for debugging purposes; there is currently no workflow
# that triggers when changes are made to the master branch.
push:
branches:
- master

jobs:
build-amd64:
runs-on: ubuntu-24.04
steps:
- name: Check out the repo
- name: Checkout the repo
uses: actions/checkout@v4

# this is needed to address this issue according to the comment https://github.com/devcontainers/ci/issues/271#issuecomment-2301764487
Expand All @@ -26,10 +27,14 @@ jobs:
run: |
echo "REGISTRY_IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

# we need to remove the / characters from the branch name,
# as they will cause an error when saving the cache
- name: Prepare
run: |
platform=linux/amd64
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
BRANCH_NAME="${GITHUB_REF_NAME//[^a-zA-Z0-9._-]/-}"
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV

- name: Docker meta
id: meta
Expand Down Expand Up @@ -59,6 +64,15 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ env.REGISTRY_IMAGE }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
# The `cache-from` and `cache-to` instructions allow you to load and unload the image cache on ghcr.io,
# respectively. The `mode=max` option allows each instruction in the Dockerfile to be cached separately,
# regardless of the build stage (in the case of a multi-stage build), which speeds up image builds
# significantly if there have been no changes to the instruction.
# More info:
# - https://github.com/docker/build-push-action/
# - https://docs.docker.com/build/cache/backends/#cache-mode
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:cache-amd64-${{ env.BRANCH_NAME }}
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:cache-amd64-${{ env.BRANCH_NAME }},mode=max

- name: Export digest
run: |
Expand Down Expand Up @@ -86,10 +100,14 @@ jobs:
run: |
echo "REGISTRY_IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

# we need to remove the / characters from the branch name,
# as they will cause an error when saving the cache
- name: Prepare
run: |
platform=linux/arm64
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
BRANCH_NAME="${GITHUB_REF_NAME//[^a-zA-Z0-9._-]/-}"
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV

- name: Docker meta
id: meta
Expand Down Expand Up @@ -119,6 +137,8 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ env.REGISTRY_IMAGE }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:cache-arm64-${{ env.BRANCH_NAME }}
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:cache-arm64-${{ env.BRANCH_NAME }},mode=max

- name: Export digest
run: |
Expand Down Expand Up @@ -165,9 +185,10 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

- name: Add SEMVER_VERSION Env Var with Value from __version File
run: |
echo "SEMVER_VERSION=$(cat __version)" >>${GITHUB_ENV}
# TODO: This needs to be reverted once the semantic versioning workflow is added
# - name: Add SEMVER_VERSION Env Var with Value from __version File
# run: |
# echo "SEMVER_VERSION=$(cat __version)" >>${GITHUB_ENV}

- name: Extract metadata (tags, labels) for Docker
id: meta
Expand All @@ -180,7 +201,8 @@ jobs:
# full length sha
type=sha,format=long
# SemVer human readable version
type=raw,value=${{ env.SEMVER_VERSION }}
# TODO: This needs to be reverted once the semantic versioning workflow is added
# type=raw,value=${{ env.SEMVER_VERSION }}
# set latest tag for default branch
# https://github.com/docker/metadata-action/issues/171 explains how to tag latest only on default branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/e2e-tests-on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: E2E Tests in PR

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
# this is needed to wait for the new docker image to be build and published to the registry
# so that we can use the image to run the service of the needed commit related version as part of local-env
# the idea is taken from here https://stackoverflow.com/a/71489231
docker-build-and-push:
uses: ./.github/workflows/.reusable-docker-build-and-push.yml

e2e-test-against-local-env:
runs-on: ubuntu-24.04
needs: [docker-build-and-push]
steps:
- name: Checkout local-env
uses: actions/checkout@v4
with:
repository: TourmalineCore/to-dos-local-env

# we need to make sure that the values-to-dos-api-cpp.yaml.gotmpl file hasn't been modified
# in the `to-dos-local-env` repository, to ensure that the test runs as expected.
- name: Verify values file checksum
run: |
# the awk command is required to extract the target hash from the output of the sha256sum command
VALUES_HASH=$(sha256sum deploy/values-to-dos-api-cpp.yaml.gotmpl | awk '{ print $1 }')
if [ "$VALUES_HASH" != ${{ vars.TO_DOS_API_CPP_LOCAL_ENV_HELMFILE_HASH }} ]; then
echo "ERROR: checksum mismatch"
echo "Expected: 88d14f527d1c39d9af93ddbe2f41462f01b523bdc340b4c62cb72c31a4c46d1f"
echo "Actual: $VALUES_HASH"
exit 1
fi

- name: Deploy Local Env to Kind k8s
uses: devcontainers/ci@v0.3
with:
runCmd: |
# we need to override "latest" image tag of ui inside local-env to run e2e against the current commit api version and not against latest from master
# We tried to use yq to change the image tag, but in the values files for helmfile we have non-yaml code that yq can`t parse or ignore
# so for that reason we use Stream EDitor which can find needed string using regular expressions and change it to a new value
# The -i flag is needed to write new image tag directly to values file
sed -i "0,/tag:.*/s//tag: \"sha-${{ github.event.pull_request.head.sha }}\"/" deploy/values-to-dos-api-cpp.yaml.gotmpl
Comment thread
aasheptunov marked this conversation as resolved.

# we also need to update the commit sha in the initContainer so that the latest image is used inside it
sed -i "0,/image:.*/s//image: \"ghcr.io/tourmalinecore/to-dos-api-cpp:sha-${{ github.event.pull_request.head.sha }}\"/" deploy/values-to-dos-api-cpp.yaml.gotmpl

# we need to override "latest" ref of service chart inside local-env to run tests against the current commit service chart version and not against latest from master
sed -i "0,/git+https:\/\/github.com\/TourmalineCore\/${{ github.event.repository.name }}.git?ref=.*/s//git+https:\/\/github.com\/TourmalineCore\/${{ github.event.repository.name }}.git?ref=${{ github.event.pull_request.head.sha }}/" deploy/helmfile.yaml.gotmpl

sed -i "0,/git::https:\/\/github.com\/TourmalineCore\/${{ github.event.repository.name }}.git@\/ci\/values.yaml?ref=.*/s//git::https:\/\/github.com\/TourmalineCore\/${{ github.event.repository.name }}.git@\/ci\/values.yaml?ref=${{ github.event.pull_request.head.sha }}/" deploy/helmfile.yaml.gotmpl

kind create cluster --name to-dos --config kind-local-config.yaml --kubeconfig ./.to-dos-cluster-kubeconfig
# we need to properly expose KUBECONFIG as an absolute path, pwd prints current working directory path
export KUBECONFIG=$(pwd)/.to-dos-cluster-kubeconfig

# When called, Makefile targets execute a sequence of commands.
# The targets are defined in the Makefile located in the root of the to-dos-local-env repository.
make deploy-with-cpp-api
push: never

- name: Check out the repo
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Download Karate JAR
run: |
curl -L https://github.com/karatelabs/karate/releases/download/v1.5.1/karate-1.5.1.jar -o karate.jar

- name: Run E2E Tests Against Local Env
run: |
java -jar karate.jar .
env:
"API_ROOT_URL": "http://localhost:30080/api/to-dos-api"

e2e-karate-tests-in-docker-compose:
runs-on: ubuntu-24.04
steps:
- name: Checkout to repo
uses: actions/checkout@v4

# If you don't create a .env file, the services in Docker Compose
# won't be able to start because they use this file.
- name: Create .env file
run: |
echo "API_HOST=0.0.0.0" >> .env
echo "API_PORT=80" >> .env
echo "API_LOG_LEVEL=INFO" >> .env
echo "API_NUMBER_OF_THREADS=1" >> .env
echo "POSTGRES_HOST=0.0.0.0" >> .env
echo "POSTGRES_PORT=5432" >> .env
echo "POSTGRES_DB=to-dos-api-cpp-db" >> .env
echo "POSTGRES_USER=postgres" >> .env
echo "POSTGRES_PASSWORD=password" >> .env

- name: Run service via docker-compose and run Karate-tests
run: docker compose --profile MockForPullRequest up --exit-code-from to-dos-api-cpp-karate-tests
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
*.out
*.app

# debug information files
# Debug information files
*.dwo

# Build files

/build
__pycache__
.env

# Service files
.DS_Store
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ target_link_libraries(${PROJECT_NAME}
)

# Tests
if (ENV{EXCLUDE_UNIT_TESTS_FROM_BUILD} STREQUAL "true")
if ("$ENV{EXCLUDE_UNIT_TESTS_FROM_BUILD}" STREQUAL "true")
# Disable test here needed for uncompatible builds, bc `enable_testing` is run executable tests file for collecting tests.
# E.g. if executable tests are builded for another OS or CPU arch.
message(STATUS "UNIT TEST DISABLED")
else()
message(STATUS "UNIT TEST ENABLED")
enable_testing()
add_subdirectory(test)
add_subdirectory(unit)
endif()
22 changes: 17 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ WORKDIR /app
EXPOSE 80

# pip is installed here because it needs to be available in both the build and final stages
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends pip
RUN apt-get update && apt-get -y install --no-install-recommends pip

FROM base AS build

WORKDIR /src
COPY . .

RUN apt-get -y install --no-install-recommends \
build-essential clang lld make cmake ninja-build gdb \
Expand All @@ -23,12 +21,26 @@ RUN apt-get -y install --no-install-recommends \

RUN pip install conan

# this is necessary so that Conan can install the dependencies
COPY conanfile.py /src/
COPY .devcontainer/to-dos-conan-profile.conf /src/.devcontainer/
COPY deps/ /src/deps/

# this is necessary so that Conan can see the local dependency recipes
RUN conan remote add local-recipes ./deps --type=local-recipes-index

RUN conan install . --build=missing \
--profile:all=.devcontainer/to-dos-conan-profile.conf \
# this is necessary because, by default, the `build_type` property in the profile is set to `Debug`
--settings:host="build_type=Release"

# We cannot copy all the content before running `conan install`, because
# otherwise the image layers cannot be cached in the pipeline
COPY . .

RUN conan build . --build=missing \
--profile:all=.devcontainer/to-dos-conan-profile.conf \
# This is necessary because, by default, the `build_type` property in the profile is set to `Debug`
# this is necessary because, by default, the `build_type` property in the profile is set to `Debug`
--settings:host="build_type=Release"

FROM base AS final
Expand All @@ -39,7 +51,7 @@ RUN pip install alembic psycopg2-binary sqlalchemy-utils
WORKDIR /app

# alembic needs this to apply the migrations correctly
COPY --from=build /src/alembic/* ./alembic/
COPY --from=build /src/alembic/ ./alembic/

COPY --from=build /src/build/Release/to-dos-api .

Expand Down
Loading
Loading