Skip to content

Commit

Permalink
Add CI test and validation
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJoiner committed Feb 21, 2023
1 parent b37532b commit bb091be
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 8 deletions.
55 changes: 47 additions & 8 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,52 @@
---
kind: pipeline
type: docker
name: fossa

steps:
- name: fossa
image: rancher/drone-fossa:latest
settings:
api_key:
from_secret: FOSSA_API_KEY
when:
instance:
- drone-publish.rancher.io
- name: fossa
image: rancher/drone-fossa:latest
settings:
api_key:
from_secret: FOSSA_API_KEY
when:
instance:
- drone-publish.rancher.io

---
kind: pipeline
type: docker
name: amd64

platform:
os: linux
arch: amd64

steps:
- name: test
image: registry.suse.com/bci/golang:1.19
commands:
- zypper -n install tar gzip
- "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.1;"
- ./scripts/ci
volumes:
- name: docker
path: /var/run/docker.sock

---
kind: pipeline
type: docker
name: arm64

platform:
os: linux
arch: arm64

steps:
- name: test
image: registry.suse.com/bci/golang:1.19
commands:
- ./scripts/ci
volumes:
- name: docker
path: /var/run/docker.sock
30 changes: 30 additions & 0 deletions scripts/ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! /bin/bash
set -e

cd $(dirname $0)/..
PATH=${PATH}:./bin
echo "Validating"

if ! command -v golangci-lint; then
echo Skipping validation: no golangci-lint available
else
echo Running: golangci-lint
golangci-lint run
fi

echo Running: go generate
go generate ./...

echo Tidying up modules
go mod tidy

echo Verifying modules
go mod verify

if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
echo "Encountered dirty repo!"
exit 1
fi

echo "Running Test"
go test ./...

0 comments on commit bb091be

Please sign in to comment.