Skip to content

Commit

Permalink
Add conformance test commands to Makefile
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Soyland <codysoyland@github.com>
  • Loading branch information
codysoyland committed Jan 28, 2025
1 parent accc80a commit 09cbf1f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ cosignImagerefs
bundle
signature
certificate
sigstore-conformance
conformance

**verify-experimental*
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ make test

**Make sure all tests pass** without any failures or errors.

#### Conformance tests

To run the conformance tests, first install the conformance test runner:

```shell
make conformance-runner
```

Then build `cosign` and `conformance` (the executable that adapts conformance tests to the cosign command), and run the tests:

```shell
make cosign conformance
make conformance-tests
```

### Running Lint

To run the linting checks, use the following command:
Expand Down
31 changes: 28 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ lint: golangci-lint ## Run golangci-lint linter
test:
$(GOEXE) test $(shell $(GOEXE) list ./... | grep -v third_party/)

conformance:
$(GOEXE) build -trimpath -ldflags "$(LDFLAGS)" -o $@ ./cmd/conformance

clean:
rm -rf cosign
rm -rf dist/
Expand All @@ -133,6 +130,34 @@ define create_kocache_path
mkdir -p $(KOCACHE_PATH)
endef

###################
# conformance tests
###################

conformance:
$(GOEXE) build -trimpath -ldflags "$(LDFLAGS)" -o $@ ./cmd/conformance

CONFORMANCE_RUNNER_PATH = sigstore-conformance
$(CONFORMANCE_RUNNER_PATH):
git clone https://github.com/sigstore/sigstore-conformance $@

.PHONY: conformance-runner
conformance-runner:
$(MAKE) $(CONFORMANCE_RUNNER_PATH) conformance-runner-pull conformance-runner-build

.PHONY: conformance-runner-pull
conformance-runner-pull:
cd $(CONFORMANCE_RUNNER_PATH) && git pull

.PHONY: conformance-runner-build
conformance-runner-build:
cd $(CONFORMANCE_RUNNER_PATH) && $(MAKE) dev

CONFORMANCE_BIN = $(shell pwd)/conformance
.PHONY: conformance-tests
conformance-tests:
cd $(CONFORMANCE_RUNNER_PATH) && env/bin/pytest test --entrypoint=$(CONFORMANCE_BIN)

##########
# ko build
##########
Expand Down

0 comments on commit 09cbf1f

Please sign in to comment.