github.com/openshift/source-to-image@v1.4.1-0.20240516041539-bf52fc02204e/Makefile (about)

     1  # Old-skool build tools.
     2  #
     3  # Targets (see each target for more information):
     4  #   all: Build code.
     5  #   build: Build code.
     6  #   check: Run build, verify and tests.
     7  #   test: Run tests.
     8  #   clean: Clean up.
     9  #   release: Build release.
    10  
    11  OUT_DIR = _output
    12  
    13  export GOFLAGS
    14  
    15  VERSION = latest
    16  CONTAINER_ENGINE = podman
    17  
    18  # Build code.
    19  #
    20  # Args:
    21  #   GOFLAGS: Extra flags to pass to 'go' when building.
    22  #
    23  # Example:
    24  #   make
    25  #   make all
    26  all build:
    27  	hack/build-go.sh
    28  .PHONY: all build
    29  
    30  build-container:
    31  	${CONTAINER_ENGINE} build -t localhost/source-to-image/s2i:${VERSION} .
    32  
    33  # Verify if code is properly organized.
    34  #
    35  # Example:
    36  #   make verify
    37  verify: build
    38  	hack/verify-gofmt.sh
    39  	hack/verify-deps.sh
    40  	hack/verify-bash-completion.sh
    41  	hack/verify-imports.sh
    42  .PHONY: verify
    43  
    44  imports: ## Organize imports in go files using goio. Example: make imports
    45  	go run ./vendor/github.com/go-imports-organizer/goio
    46  .PHONY: imports
    47  
    48  verify-imports: ## Run import verifications. Example: make verify-imports
    49  	hack/verify-imports.sh
    50  .PHONY: verify-imports
    51  
    52  # Build and run unit tests
    53  #
    54  # Args:
    55  #   WHAT: Directory names to test.  All *_test.go files under these
    56  #     directories will be run.  If not specified, "everything" will be tested.
    57  #   TESTS: Same as WHAT.
    58  #   GOFLAGS: Extra flags to pass to 'go' when building.
    59  #   TESTFLAGS: Extra flags that should only be passed to hack/test-go.sh
    60  #
    61  # Example:
    62  #   make check
    63  #   make test
    64  #   make check WHAT=pkg/docker TESTFLAGS=-v
    65  check: verify test	
    66  .PHONY: check
    67  
    68  # Run unit tests
    69  # Example:
    70  #   make test
    71  #   make test-unit
    72  #   make test WHAT=pkg/docker TESTFLAGS=-v 
    73  test test-unit: 
    74  	hack/test-go.sh $(WHAT) $(TESTS) $(TESTFLAGS)
    75  .PHONY: test test-unit
    76  
    77  # Run dockerfile integration tests
    78  # Example:
    79  #   make test-dockerfile
    80  #   make test-dockerfile TESTFLAGS="-run TestDockerfileIncremental"
    81  test-dockerfile:
    82  	hack/test-dockerfile.sh $(TESTFLAGS)
    83  .PHONY: test-dockerfile
    84  
    85  # Run docker integration tests - may require sudo permissions
    86  # Exmaple:
    87  #   make test-docker
    88  #   make test-docker TESTFLAGS="-run TestCleanBuild"
    89  test-docker:
    90  	hack/test-docker.sh $(TESTFLAGS)
    91  .PHONY: test-docker
    92  
    93  # Remove all build artifacts.
    94  #
    95  # Example:
    96  #   make clean
    97  clean:
    98  	rm -rf $(OUT_DIR)
    99  .PHONY: clean
   100  
   101  # Build the release.
   102  #
   103  # Example:
   104  #   make release
   105  release: clean
   106  	S2I_BUILD_CMD="${CONTAINER_ENGINE}" hack/build-release.sh
   107  	hack/extract-release.sh
   108  .PHONY: release