Skip to content

Commit

Permalink
Makefile: fix ut testing for converter package
Browse files Browse the repository at this point in the history
The converter package needs use sudo to access privileged xattr
of file (containerd apply oci whiteout file to overlayfs whiteout).

Signed-off-by: Yan Song <[email protected]>
  • Loading branch information
imeoer committed Apr 7, 2022
1 parent fd96913 commit ae3e04b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ on:
pull_request:
branches: [main]

env:
NYDUS_VERSION: v2.0.0-rc.2

jobs:
build:
name: Build
timeout-minutes: 10
strategy:
matrix:
go-version:
- 1.16
- 1.17
platform:
- ubuntu-latest
runs-on: ${{ matrix.platform }}
Expand All @@ -35,6 +38,13 @@ jobs:
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.43.0
export PATH=$PATH:$(go env GOPATH)/bin
# Download nydus components
wget https://github.com/dragonflyoss/image-service/releases/download/${{ env.NYDUS_VERSION }}/nydus-static-${{ env.NYDUS_VERSION }}-x86_64.tgz
tar xzvf nydus-static-${{ env.NYDUS_VERSION }}-x86_64.tgz
mkdir -p /usr/bin
sudo mv nydus-static/nydus-image nydus-static/nydusd-fusedev nydus-static/nydusify /usr/bin/
make
make test
make check
Expand All @@ -45,7 +55,7 @@ jobs:
strategy:
matrix:
go-version:
- 1.16
- 1.17
platform:
- ubuntu-latest
runs-on: ${{ matrix.platform }}
Expand All @@ -65,7 +75,14 @@ jobs:
restore-keys: |
${{ runner.os }}-go
- name: Run unit tests.
run: make cover
run: |
# Download nydus components
wget https://github.com/dragonflyoss/image-service/releases/download/${{ env.NYDUS_VERSION }}/nydus-static-${{ env.NYDUS_VERSION }}-x86_64.tgz
tar xzvf nydus-static-${{ env.NYDUS_VERSION }}-x86_64.tgz
mkdir -p /usr/bin
sudo mv nydus-static/nydus-image nydus-static/nydusd-fusedev nydus-static/nydusify /usr/bin/
make cover
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
go-version:
- 1.16
- 1.17
runs-on: ubuntu-latest
steps:
- name: Set up Go
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ all: clear build
VERSION=$(shell git rev-parse --verify HEAD --short=7)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
SUDO = $(shell which sudo)
GO_EXECUTABLE_PATH ?= $(shell which go)
GO=$(SUDO) NYDUS_BUILDER=/usr/bin/nydus-image NYDUS_NYDUSD=/usr/bin/nydusd-fusedev ${GO_EXECUTABLE_PATH}
#GOPROXY ?= https://goproxy.io

ifdef GOPROXY
Expand Down Expand Up @@ -39,9 +42,9 @@ check: vet

.PHONY: test
test:
go test -race -v -mod=mod -cover ${PACKAGES}
$(GO) test -race -v -mod=mod -cover ${PACKAGES}

.PHONY: cover
cover:
go test -v -covermode=atomic -coverprofile=coverage.txt ./...
go tool cover -func=coverage.txt
$(GO) test -v -covermode=atomic -coverprofile=coverage.txt ./...
$(GO) tool cover -func=coverage.txt

0 comments on commit ae3e04b

Please sign in to comment.