Skip to content
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
69 changes: 69 additions & 0 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: IBM VPC File CSI Driver

on:
push:
branches:
- master
tags:
- "v[1-9]+.[0-9]+.[0-9]+*"
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.23.10"]
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y bc

- name: Install Go dependencies
run: |
make deps

- name: Set up Go workspace
run: |
mkdir -p $(go env GOPATH)/src/github.com/IBM/ibm-vpc-file-csi-driver
rsync -az . $(go env GOPATH)/src/github.com/IBM/ibm-vpc-file-csi-driver
env:
GOPATH: ${{ runner.temp }}/go

- name: Run formatting check
run: make fmt

- name: Run tests
run: |
timeout 300 make test || true
make coverage && touch "Passing" || touch "Failed"

- name: Build driver
run: make driver

- name: Publish coverage
if: success()
env:
GHE_TOKEN: ${{ secrets.GHE_TOKEN }}
run: |
git config credential.helper "store --file=.git/credentials"
echo "https://${GHE_TOKEN}:@github.com" > .git/credentials
./scripts/calculateCoverage.sh
./scripts/publishCoverage.sh

- name: Handle failure
if: failure()
run: ./scripts/handleFailure.sh
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,28 @@ all: deps fmt build test buildimage
driver: deps buildimage

.PHONY: deps
LINT_BIN=$(shell go env GOPATH)/bin/golangci-lint
deps:
echo "Installing dependencies ..."
go mod download
go get github.com/pierrre/gotestcover
go install github.com/pierrre/gotestcover
@if ! which golangci-lint >/dev/null || [[ "$$(golangci-lint --version)" != *${LINT_VERSION}* ]]; then \
@if ! command -v $(LINT_BIN) >/dev/null || [[ "$$($(LINT_BIN) --version)" != *${LINT_VERSION}* ]]; then \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v${LINT_VERSION}; \
fi

.PHONY: fmt
fmt: lint
$(GOPATH)/bin/golangci-lint run --disable-all --enable=gofmt --timeout 600s
@if [ -n "$$($(GOPATH)/bin/golangci-lint run)" ]; then echo 'Please run ${COLOR_YELLOW}make dofmt${COLOR_RESET} on your code.' && exit 1; fi
$(LINT_BIN) run --disable-all --enable=gofmt --timeout 600s
@if [ -n "$$($(LINT_BIN) run)" ]; then echo 'Please run ${COLOR_YELLOW}make dofmt${COLOR_RESET} on your code.' && exit 1; fi

.PHONY: dofmt
dofmt:
$(GOPATH)/bin/golangci-lint run --disable-all --enable=gofmt --fix --timeout 600s
$(LINT_BIN) run --disable-all --enable=gofmt --fix --timeout 600s

.PHONY: lint
lint:
$(GOPATH)/bin/golangci-lint run --timeout 600s
$(LINT_BIN) run --disable-all --enable=gofmt --timeout 600s

# Repository does not contain vendor/modules.txt file so re-build with go mod vendor
.PHONY: build
Expand All @@ -78,7 +79,7 @@ build:
# 'go test -race' requires cgo, set CGO_ENABLED=1
.PHONY: test
test:
CGO_ENABLED=1 $(GOPATH)/bin/gotestcover -v -race -short -coverprofile=cover.out ${GOPACKAGES}
CGO_ENABLED=1 $(shell go env GOPATH)/bin/gotestcover -v -race -short -coverprofile=cover.out ${GOPACKAGES}
go tool cover -html=cover.out -o=cover.html # Uncomment this line when UT in place.

.PHONY: ut-coverage
Expand Down Expand Up @@ -113,4 +114,4 @@ test-sanity: deps fmt
.PHONY: clean
clean:
rm -rf ${EXE_DRIVER_NAME}
rm -rf $(GOPATH)/bin/${EXE_DRIVER_NAME}
rm -rf $(shell go env GOPATH)/bin/${EXE_DRIVER_NAME}