Skip to content

Commit

Permalink
Improve Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Mar 19, 2024
1 parent 224dc76 commit 7152c14
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 14 deletions.
43 changes: 29 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
.PHONY: lint run test
.PHONY: \
__build_lint_ansible \
__build_lint_sh \
__build_lint_tests \
lint \
lint-fix \
run \
test

DOCKER_RUN := docker run --rm -v $$(pwd):/code --name
DOCKER_BUILD := docker build -q -f

__build_lint_sh:
@$(DOCKER_BUILD) .docker/lint-sh.Dockerfile -t lint-sh .

__build_lint_ansible:
$(DOCKER_BUILD) .docker/lint-ansible.Dockerfile -t lint-ansible .

__build_lint_tests:
@$(DOCKER_BUILD) .docker/tests.Dockerfile -t tests .

lint: __build_lint_ansible __build_lint_sh
$(DOCKER_RUN) dotfiles-lint-ansible lint-ansible
$(DOCKER_RUN) dotfiles-lint-sh lint-sh ./scripts/lint-sh.sh

lint-fix: __build_lint_sh
@$(DOCKER_RUN) dotfiles-lint-sh lint-sh shfmt -l -w .

run:
ansible-playbook \
Expand All @@ -9,16 +35,5 @@ run:
-i inventory.ini \
playbook.yml

lint:
@docker build -q -f .docker/lint-ansible.Dockerfile -t lint-ansible .
@docker build -q -f .docker/lint-sh.Dockerfile -t lint-sh .
@docker run --rm --name dotfiles-lint-ansible -v $$(pwd):/code lint-ansible
@docker run --rm --name dotfiles-lint-sh -v $$(pwd):/code lint-sh ./scripts/lint-sh.sh

lint-fix:
@docker build -q -f .docker/lint-sh.Dockerfile -t lint-sh .
@docker run --rm --name dotfiles-lint-sh -v $$(pwd):/code lint-sh shfmt -l -w .

test:
@docker build -q -f .docker/tests.Dockerfile -t tests .
@docker run --rm --name tests -v $$(pwd):/code tests
test: __build_lint_tests
@$(DOCKER_RUN) dotfiles-tests tests
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ status](https://github.com/deniscostadsc/dotfiles/actions/workflows/ci.yml/badge
- [Docker](#docker)
- [Git](#git)
- [SSH](#ssh)
- [Development](#development)
- [Running the tests](#running-the-tests)
- [Troubleshooting](#troubleshooting)
- [Pop!\_os](#pop_os)
- [Could not import python modules: apt, apt\_pkg. Please install python3-apt package.](#could-not-import-python-modules-apt-apt_pkg-please-install-python3-apt-package)
Expand Down Expand Up @@ -171,6 +173,18 @@ Look at [git role README](roles/git/README.md)

To enable the coexistance of two SSH keys, one for work and one for personal purposes, I set the work SSH key to impact only the domain `work.github.com`. For that reason, after I clone the repositories from work I need to change the remote URL to add the suffix `work.`.

## Development

### Running the tests

There are make tasks to run lint and tests

```
make lint
make lint-fix
make test
```

## Troubleshooting

### Pop!_os
Expand Down

0 comments on commit 7152c14

Please sign in to comment.