Skip to content

Commit 1ac344f

Browse files
committed
Make it easier to get started
1 parent b1673f8 commit 1ac344f

File tree

2 files changed

+51
-19
lines changed

2 files changed

+51
-19
lines changed

Makefile

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
test-all:
1+
test.all:
22
for day in $$(ls days); do ./days/$$day/test.sh; done
33

44
test:
@@ -7,38 +7,48 @@ test:
77
test.example:
88
make test DAY=day-00-example
99

10-
11-
dockerbuild: Dockerfile
12-
docker build . --tag jonasjso/adventofcode2020
13-
14-
dockerpush:
15-
docker push jonasjso/adventofcode2020:latest
10+
test.01:
11+
make test DAY=day-01
1612

1713
#
18-
# make dockertest DAY=<day>
14+
# make docker.test DAY=<day>
1915
#
2016
# Run all the tests for a day inside a docker container. Should work out of the box, if you already have docker installed.
2117
#
22-
# Example: make dockertest DAY=day-03
18+
# Example: make docker.test DAY=day-03
2319
#
2420
# Benefit 1: Avoids having to install all languages on the host machine.
2521
# Benefit 2: Reproduceability - Makes sure tests run with the same versions on any machine, regardless of what is installed on the host machine.
2622
#
27-
dockertest:
23+
docker.test:
24+
docker pull jonasjso/adventofcode2020:latest;
2825
docker run -ti --env DAY=$(DAY) -v $(PWD):/test jonasjso/adventofcode2020:latest /bin/bash -c "cd /test && make test && exit"
2926

30-
dockertest.example:
31-
make dockertest DAY=day-00-example
27+
docker.example:
28+
make docker.test DAY=day-00-example
3229

33-
#
34-
# make dockertest-all
35-
#
36-
# Run all tests for all days inside a docker container.
37-
#
38-
dockertest-all:
30+
docker.01:
31+
make docker.test DAY=day-01
32+
33+
docker.all:
3934
docker run -ti -v $(PWD):/test jonasjso/adventofcode2020:latest /bin/bash -c "cd /test && make && exit"
4035

36+
docker.build: Dockerfile
37+
docker build . --tag jonasjso/adventofcode2020
38+
39+
docker.push:
40+
docker push jonasjso/adventofcode2020:latest
41+
4142
versions:
4243
./scripts/print-versions.sh
4344

44-
.PHONY: dockerbuild dockerpush test test-all versions dockertest dockertest-all
45+
.PHONY:
46+
dockerbuild\
47+
dockerpush\
48+
test\
49+
test.all\
50+
docker.test\
51+
docker.all\
52+
docker.build\
53+
docker.push\
54+
versions;\

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,25 @@ Here you can see the status of automatic tests run by Github CI:
3232
![days/day-24](https://github.com/Arxcis/adventofcode2020/workflows/days/day-24/badge.svg)
3333
![days/day-25](https://github.com/Arxcis/adventofcode2020/workflows/days/day-25/badge.svg)
3434
![days/day-00-example](https://github.com/Arxcis/adventofcode2020/workflows/days/day-00-example/badge.svg)
35+
36+
## Getting started if you are running Docker
37+
38+
If you are running docker, you can run tests inside a docker-container by doing:
39+
```
40+
make docker.example // Expect example tests to succeed
41+
make docker.01 // Expect fail because we don't have any day-01 tests
42+
make docker.all // Expect some tests to succeed, some fail
43+
```
44+
45+
## Getting started if you are not running Docker
46+
If you are not running docker, you have to install languages we support on your host system. See the [Dockerfile](./Dockerfile) for how you can do this on debian-based systems. You can run the tests directly on your host system by doing:
47+
```
48+
make test.example // Expect example tests to succeed
49+
make test.01 // Expect fail because we don't have any day-01 tests
50+
make test.all // Expect some tests to succeed, some fail
51+
```
52+
53+
54+
## Demo
55+
56+
[![asciicast](https://asciinema.org/a/82OAZ2P8MLxVvVT568rFEjh0n.svg)](https://asciinema.org/a/82OAZ2P8MLxVvVT568rFEjh0n)

0 commit comments

Comments
 (0)