Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc small nits to CI and build #2573

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
script: make cross


test_task:

Check warning on line 75 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L75

task "Test" depends on task "validate", but their only_if conditions are different

Check warning on line 75 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L75

task "Test w/ opengpg" depends on task "validate", but their only_if conditions are different

Check warning on line 75 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L75

task "Test" depends on task "validate", but their only_if conditions are different

Check warning on line 75 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L75

task "Test w/ opengpg" depends on task "validate", but their only_if conditions are different
alias: test
depends_on:
- validate
Expand All @@ -81,10 +81,10 @@
matrix:
- name: "Test"
env:
BUILDTAGS: 'btrfs_noversion libdm_no_deferred_remove'
BUILDTAGS: 'btrfs_noversion'
- name: "Test w/ opengpg"
env:
BUILDTAGS: &withopengpg 'btrfs_noversion libdm_no_deferred_remove containers_image_openpgp'
BUILDTAGS: &withopengpg 'btrfs_noversion containers_image_openpgp'
script: ${GOSRC}/${SCRIPT_BASE}/runner.sh image_tests


Expand All @@ -93,7 +93,7 @@
##### repository's `.cirrus.yml`. Changes made here should be fully merged
##### prior to being manually duplicated and maintained in containers/skopeo.
#####
test_skopeo_task:

Check warning on line 96 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L96

task "Skopeo Test" depends on task "validate", but their only_if conditions are different

Check warning on line 96 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L96

task "Skopeo Test w/ opengpg" depends on task "validate", but their only_if conditions are different

Check warning on line 96 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L96

task "Skopeo Test" depends on task "validate", but their only_if conditions are different

Check warning on line 96 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L96

task "Skopeo Test w/ opengpg" depends on task "validate", but their only_if conditions are different
alias: test_skopeo
only_if: *not_docs
depends_on:
Expand All @@ -110,7 +110,7 @@
matrix:
- name: "Skopeo Test"
env:
BUILDTAGS: 'btrfs_noversion libdm_no_deferred_remove'
BUILDTAGS: 'btrfs_noversion'
- name: "Skopeo Test w/ opengpg"
env:
BUILDTAGS: *withopengpg
Expand Down Expand Up @@ -155,7 +155,7 @@
# Status aggregator for all tests. This task simply ensures a defined
# set of tasks all passed, and allows confirming that based on the status
# of this task.
success_task:

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "validate", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "cross", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "Test", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "Test w/ opengpg", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "Skopeo Test", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "Skopeo Test w/ opengpg", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "validate", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "cross", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "Test", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "Test w/ opengpg", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "Skopeo Test", but their only_if conditions are different

Check warning on line 158 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L158

task "Total Success" depends on task "Skopeo Test w/ opengpg", but their only_if conditions are different
name: "Total Success"
alias: success
# N/B: ALL tasks must be listed here, minus their '_task' suffix.
Expand Down
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See https://github.com/codespell-project/codespell#using-a-config-file
[codespell]
skip = ./vendor,./.git,./go.sum,*.gpg
skip = ./vendor,./.git,./go.sum,./signature/fixtures,./signature/simplesigning/testdata

# NOTE words added to the list below need to be lowercased.
ignore-words-list = te,bu
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.PHONY: all tools test validate lint .gitvalidation fmt

export GOPROXY=https://proxy.golang.org


Expand All @@ -12,7 +10,7 @@ endif
BUILD_TAGS_WINDOWS_CROSS = containers_image_openpgp
BUILD_TAGS_DARWIN_CROSS = containers_image_openpgp

BUILDTAGS = btrfs_noversion libdm_no_deferred_remove
BUILDTAGS = btrfs_noversion
BUILDFLAGS := -tags "$(BUILDTAGS)"

PACKAGES := $(shell go list $(BUILDFLAGS) ./...)
Expand All @@ -38,66 +36,83 @@ GOLANGCI_LINT_VERSION := 1.61.0

export PATH := $(PATH):${GOBIN}

.PHONY: all
all: tools test validate .gitvalidation

.PHONY: build
build:
go build $(BUILDFLAGS) ./...

$(MANPAGES): %: %.md
$(GOMD2MAN) -in $< -out $@

.PHONY: docs
docs: $(MANPAGES)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is not actually phony AFAICS: it’s a set of file dependencies with correct file dependencies on the sources.


.PHONY: install-docs
install-docs: docs
install -d -m 755 ${MANINSTALLDIR}/man5
install -m 644 docs/*.5 ${MANINSTALLDIR}/man5/

.PHONY: install
install: install-docs
install -d -m 755 ${DESTDIR}${CONTAINERSCONFDIR}
install -m 644 default-policy.json ${DESTDIR}${CONTAINERSCONFDIR}/policy.json
install -d -m 755 ${DESTDIR}${REGISTRIESDDIR}
install -m 644 default.yaml ${DESTDIR}${REGISTRIESDDIR}/default.yaml

.PHONY: cross
cross:
GOOS=windows $(MAKE) build BUILDTAGS="$(BUILDTAGS) $(BUILD_TAGS_WINDOWS_CROSS)"
GOOS=darwin $(MAKE) build BUILDTAGS="$(BUILDTAGS) $(BUILD_TAGS_DARWIN_CROSS)"

.PHONY: tools
tools: .install.gitvalidation .install.golangci-lint

.PHONY: .install.gitvalidation
.install.gitvalidation:
if [ ! -x "$(GOBIN)/git-validation" ]; then \
go install github.com/vbatts/git-validation@latest; \
fi

.PHONY: .install.golangci-lint
.install.golangci-lint:
if [ ! -x "$(GOBIN)/golangci-lint" ]; then \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOBIN) v$(GOLANGCI_LINT_VERSION) ; \
fi

.PHONY: clean
clean:
rm -rf $(MANPAGES)

.PHONY: test
test:
@go test $(BUILDFLAGS) -cover ./...

.PHONY: fmt
fmt:
@gofmt -l -s -w $(SOURCE_DIRS)

.PHONY: validate
validate: lint
@BUILDTAGS="$(BUILDTAGS)" hack/validate.sh

.PHONY: lint
lint:
$(GOBIN)/golangci-lint run --build-tags "$(BUILDTAGS)"

# When this is running in CI, it will only check the CI commit range
.PHONY: .gitvalidation
.gitvalidation:
@which $(GOBIN)/git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make clean && make tools'" && false)
git fetch -q "https://github.com/containers/image.git" "refs/heads/main"
upstream="$$(git rev-parse --verify FETCH_HEAD)" ; \
$(GOBIN)/git-validation -q -run DCO,short-subject,dangling-whitespace -range $$upstream..HEAD

.PHONY: vendor-in-container
vendor-in-container:
podman run --privileged --rm --env HOME=/root -v `pwd`:/src -w /src golang go mod tidy

.PHONY: codespell
codespell:
codespell -w