nhs-england-tools / repository-template

🛠️ 📚💡 This is a detailed and carefully made template for your GitHub projects. It's based on the wide knowledge and practical experience of the engineering community within NHS England. The template includes helpful suggestions, standards and practices - it's something you should consider using for all your repositories.
MIT License
31 stars 12 forks source link

`.PHONY` clobbering breaks file dependency management #149

Open regularfry opened 9 months ago

regularfry commented 9 months ago

We apply a .PHONY: * rule here. The scope of the .PHONY target seems to be global, so by doing this the user can't use file-based dependency logic in the top-level Makefile. That's problematic, because it makes it less likely that the user will want to use make for local work, and we want the CI pipeline to be as close as possible to the local experience.

regularfry commented 9 months ago

As an example, I'm working on a django application. I want make test-unit to be able to install the test dependencies if they're missing, so I get a oneliner that works the same in the github action as it does locally. But I don't want to execute pip install -r... every time I run the tests locally, because that's just noise. So I touch .venv/deps-installed and add it as a prerequisite of the dependency install task. But that's a real file, and I'm depending on make paying attention to the mtime. With .PHONY: * the framework is saying that I can't do that.