version: "3" vars: NIX_CMD_BASE: nix develop . -c ARCH_LIST: x86_64-linux tasks: ci: cmds: - task: clean - task: lint - task: docker-build-all - task: test-all ci-publish: cmds: - task: clean - task: lint - task: test-all - task: docker-publish-all clean: cmds: - rm -rf result-* docker-build: requires: vars: - ARCH status: - test -f result-{{.ARCH}} cmds: - nix build .#docker --option system {{.ARCH}} - mv result result-{{.ARCH}} docker-build-all: cmds: - for: var: ARCH_LIST split: "," task: docker-build vars: ARCH: "{{.ITEM}}" docker-publish-all: cmds: - for: var: ARCH_LIST split: "," task: docker-publish vars: ARCH: "{{.ITEM}}" docker-local-import: requires: vars: - ARCH cmds: - task: docker-build vars: ARCH: "{{.ARCH}}" - | {{.NIX_CMD_BASE}} \ skopeo \ --insecure-policy \ copy \ docker-archive:$(readlink -f result-{{.ARCH}}) \ docker-daemon:caddy-log-exporter:NOTUSE - | {{.NIX_CMD_BASE}} \ skopeo \ inspect \ docker-daemon:caddy-log-exporter:NOTUSE docker-publish: requires: vars: - ARCH - GITHUB_USERNAME - GITHUB_PASSWORD - GIT_TAG cmds: - task: docker-build vars: ARCH: "{{.ARCH}}" - | {{.NIX_CMD_BASE}} \ skopeo \ --insecure-policy \ copy \ --dest-username {{.GITHUB_USERNAME}} --dest-password {{.GITHUB_PASSWORD}} \ docker-archive:$(readlink -f result-{{.ARCH}}) \ docker://ghcr.io/xsteadfastx/caddy-log-exporter-{{.ARCH}}:{{.GIT_TAG}} docker-inspect: cmds: - | {{.NIX_CMD_BASE}} \ skopeo \ inspect \ docker-archive:$(readlink -f result) lint: cmds: - | {{.NIX_CMD_BASE}} \ golangci-lint run --enable-all test: cmds: - | {{.NIX_CMD_BASE}} \ go test -v -race -count=1 ./internal/... test-integration: cmds: - task: docker-local-import vars: ARCH: x86_64-linux - | {{.NIX_CMD_BASE}} \ go test -v -race -count=1 ./test/integration/... test-all: cmds: - task: test - task: test-integration tidy: cmds: - go mod tidy - go mod vendor