Skip to content

Commit

Permalink
Build with CircleCI (#5)
Browse files Browse the repository at this point in the history
* Create CircleCI config

* Add workaround to publish coveralls from non-travis CI

Found at eddyxu/cpp-coveralls#143 (comment)

* Install PyYAML for cpp-coveralls

It needs this to parse it's own config

* Rename docker workdir to "app"

* Copy .git into the container

since CircleCI doesn't support mounts
  • Loading branch information
aroxby authored Nov 28, 2021
1 parent cbbb953 commit 41ecb24
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
29 changes: 29 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2.1

jobs:
build:
docker:
- image: cimg/base:stable
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Build Docker Container
command: docker build -t app .
- run:
name: Run Docker Tests
command: |
docker create --rm \
-e TRAVIS_JOB_ID=$CIRCLE_BUILD_NUM \
-e COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN \
--name app \
app make coveralls
# CircleCI doesn't allow mounts/volumes on the docker runner
docker cp .git app:/app/.git
docker start -a app
workflows:
default:
jobs:
- build
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM ubuntu

RUN apt-get update && apt-get -y install build-essential git python3-pip
RUN pip install cpp-coveralls
RUN pip install 'pyyaml<6' cpp-coveralls

COPY . /src
WORKDIR src
COPY . /app
WORKDIR app
CMD make test
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ $(TEST_OUT): $(TEST_OBJS) $(TOBJS)
test: $(TEST_OUT)
$<

coveralls: test
.coveralls.yml:
echo service_name: circleci > .coveralls.yml

coveralls: test .coveralls.yml
coveralls -b . -e external -e tests

test-tidy:
Expand Down

0 comments on commit 41ecb24

Please sign in to comment.