Skip to content

Commit 49c2849

Browse files
authored
Merge pull request #3 from Jamstah/coverage
2 parents 0dff0fc + 2566ed4 commit 49c2849

File tree

6 files changed

+65
-32
lines changed

6 files changed

+65
-32
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.go text eol=lf

.github/workflows/test.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,49 @@
11
name: test
2-
on: [push, pull_request]
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
38

49
permissions:
510
contents: read
611

12+
env:
13+
TESTFLAGS: -v
14+
BUILDFLAGS: -v
15+
716
jobs:
8-
test:
17+
build:
918
strategy:
1019
matrix:
1120
go-version: [1.20.x, 1.21.x]
1221
os: [ubuntu-latest, windows-latest, macos-latest]
1322
runs-on: ${{ matrix.os }}
1423
timeout-minutes: 10
1524
steps:
16-
- uses: actions/setup-go@v4
17-
with:
18-
go-version: ${{ matrix.go-version }}
19-
- uses: actions/checkout@v3
20-
- name: Test
21-
run: go test -v ./...
25+
- uses: actions/checkout@v3
26+
27+
- name: Set up Go
28+
uses: actions/setup-go@v4
29+
with:
30+
go-version: ${{ matrix.go-version }}
31+
32+
- name: Build
33+
run: |
34+
make build
35+
36+
- name: lint
37+
uses: golangci/golangci-lint-action@v3
38+
with:
39+
version: v1.53
40+
args: --print-resources-usage --timeout=10m --verbose
41+
42+
- name: Test
43+
run: |
44+
make coverage
45+
46+
- name: Codecov
47+
uses: codecov/codecov-action@v3
48+
with:
49+
directory: ./

.github/workflows/validate.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Cover profiles
2+
*.out

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Project packages.
2+
PACKAGES=$(shell go list ./...)
3+
4+
# Flags passed to `go test`
5+
BUILDFLAGS ?=
6+
TESTFLAGS ?=
7+
8+
.PHONY: all build test coverage
9+
.DEFAULT: all
10+
11+
all: build
12+
13+
build: ## no binaries to build, so just check compilation suceeds
14+
go build ${BUILDFLAGS} ./...
15+
16+
test: ## run tests
17+
go test ${TESTFLAGS} ./...
18+
19+
coverage: ## generate coverprofiles from the unit tests
20+
rm -f coverage.txt
21+
go test ${TESTFLAGS} -cover -coverprofile=cover.out ./...
22+
23+
.PHONY: help
24+
help:
25+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_\/%-]+:.*?##/ { printf " \033[36m%-27s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Go library to handle references to container images.
77
[![Build Status](https://github.com/distribution/reference/actions/workflows/test.yml/badge.svg?branch=main&event=push)](https://github.com/distribution/reference/actions?query=workflow%3ACI)
88
[![GoDoc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/distribution/reference)
99
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE)
10+
[![codecov](https://codecov.io/gh/distribution/reference/branch/main/graph/badge.svg)](https://codecov.io/gh/distribution/reference)
1011
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Fdistribution%2Freference.svg?type=shield)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fdistribution%2Freference?ref=badge_shield)
1112

1213
This repository contains a library for handling refrences to container images held in container registries. Please see [godoc](https://pkg.go.dev/github.com/distribution/reference) for details.

0 commit comments

Comments
 (0)