Exploration to the build interfaces of the current day.
Can we leverage some modern solutions to have easy, repeatable, platform-agnostic and maintainable build environments? Can we perhaps even test them?
The usual "old skool" ones:
- Script
- Makefile
The commonly referenced modern options:
- Justfile
- Magefile
- Earthfile
- Dagger
- Test:
./scripts/test.sh
- Build:
./scripts/build-linux.sh
- Remove build artifacts:
./scripts/clean.sh
- Test and build:
make
or:
- Test:
make test
- Build:
make build
- Remove build artifacts:
make clean
- Build and run:
make docker[-dev]
or:
- Build:
make docker-build
- Run:
make docker-run[-dev]
E.g x86_64 binary:
wget https://github.com/casey/just/releases/download/1.31.0/just-1.31.0-x86_64-unknown-linux-musl.tar.gz
tar xvf just-1.31.0-x86_64-unknown-linux-musl.tar.gz --directory=/usr/local/bin just
- Test and build:
just
or:
- Test:
just test
- Build:
just build
- Remove build artifacts:
just clean
- Build and run:
just docker[-dev]
or:
- Build:
just docker-build
- Run:
just docker-run[-dev]
E.g x86_64 binary:
wget https://github.com/go-task/task/releases/download/v3.38.0/task_linux_amd64.tar.gz
tar xvf task_linux_amd64.tar.gz --directory=/usr/local/bin task
- Test and build:
task
or:
- Test:
task test
- Build:
task build
- Remove build artifacts:
task clean
- Build and run:
task docker[-dev]
or:
- Build:
task docker-build
- Run:
task docker-run[-dev]
E.g as using Go modules:
git clone https://github.com/magefile/mage
cd mage
go run bootstrap.go
- Test and build:
mage
or:
- Test:
mage test
- Build:
mage build
- Remove build artifacts:
mage clean
- Build and run:
mage docker[Dev]
or:
- Build:
mage dockerBuild
- Run:
mage dockerRun[Dev]
- Install earthly
- Disable analytics by adding the following in
~/.earthly/config.yml
(create it if it does not exist):
global:
disable_analytics: true
- Test and build:
earthly +all
or:
- Test:
earthly +test
- Build:
earthly +build
- Remove build artifacts:
earthly +clean
- Build and run:
earthly +docker[-dev]
or:
- Build:
earthly +docker-build
orearthly +dockerfile
- Run:
earthly +docker-run[-dev]