Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #58 from hellofresh/patch/gh-actions-testing-flow
Browse files Browse the repository at this point in the history
EES-3753 Testing flow is running in GH Actions
  • Loading branch information
vgarvardt authored Aug 12, 2020
2 parents 417028f + ad9fe81 commit 5db90fd
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 92 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Testing

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v1
with:
version: v1.30

test:
name: Test
runs-on: ubuntu-latest
needs: [lint]

steps:
- name: Set up Go
uses: actions/setup-go@v2
- name: Check out code
uses: actions/checkout@v2
- name: Run tests
if: success()
run: make test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: success()
with:
file: ./coverage.txt
fail_ci_if_error: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
_build/out/*
dist/*
vendor/
coverage.txt
15 changes: 15 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# See https://golangci-lint.run/usage/configuration/#config-file for more information
run:
timeout: 5m
linters:
disable-all: true
enable:
- gofmt
- golint
- goimports
fast: false
linters-settings:
gofmt:
simplify: false
issues:
exclude-use-default: false
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

23 changes: 5 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,20 @@ OK_COLOR=\033[32;01m
ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m

# Space separated patterns of packages to skip in list, test, format.
IGNORED_PACKAGES := /vendor/

.PHONY: all clean deps build

all: clean build
.PHONY: clean build

build:
@echo "$(OK_COLOR)==> Building... $(NO_COLOR)"
/bin/sh -c "VERSION=${VERSION} ./build/build.sh"

test:
@/bin/sh -c "./build/test.sh $(allpackages)"
@echo "$(OK_COLOR)==> Running tests$(NO_COLOR)"
@go test -cover -coverprofile=coverage.txt -covermode=atomic ./...

lint:
@echo "$(OK_COLOR)==> Linting... $(NO_COLOR)"
@golint $(allpackages)
@echo "$(OK_COLOR)==> Linting with golangci-lint running in docker container$(NO_COLOR)"
@docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.30.0 golangci-lint run -v

clean:
@echo "$(OK_COLOR)==> Cleaning project$(NO_COLOR)"
@go clean
@rm -rf bin $GOPATH/bin

# cd into the GOPATH to workaround ./... not following symlinks
_allpackages = $(shell ( go list ./... 2>&1 1>&3 | \
grep -v -e "^$$" $(addprefix -e ,$(IGNORED_PACKAGES)) 1>&2 ) 3>&1 | \
grep -v -e "^$$" $(addprefix -e ,$(IGNORED_PACKAGES)))

# memoize allpackages, so that it's executed only once and only if used
allpackages = $(if $(__allpackages),,$(eval __allpackages := $$(_allpackages)))$(__allpackages)
59 changes: 0 additions & 59 deletions build/test.sh

This file was deleted.

0 comments on commit 5db90fd

Please sign in to comment.