--- kind: pipeline name: check workspace: base: /go path: src/gitea.hackmi.ch/Phil/goshorly steps: - name: check-format image: golang commands: - go fmt $(go list ./... | grep -v /vendor/) - go vet $(go list ./... | grep -v /vendor/) - go test -race $(go list ./... | grep -v /vendor/) - name: check-sec image: golang commands: - go install github.com/securego/gosec/v2/cmd/gosec@latest - go get -v -d . - gosec ./... --- kind: pipeline name: build steps: - name: Build Binary for Testing (linux/amd64) image: golang commands: - go get -v -d ./... - go build -a -installsuffix cgo -ldflags="-X $I_PACKAGE.CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o linux-amd64 . steps: - name: Build-latest-tag-docker image: docker:dind volumes: - name: dockersock path: /var/run environment: DOCKER_PASSWORD: from_secret: DOCKER_PASSWORD commands: - sleep 30 - docker ps -a - docker context create build - docker buildx create build --use - echo $DOCKER_PASSWORD | docker login --username Phil --password-stdin gitea.hackmi.ch - docker buildx build --platform linux/amd64 --no-cache --build-arg CI_COMMIT_BRANCH=$DRONE_COMMIT_BRANCH --build-arg CI_COMMIT_SHORT_SHA=$DRONE_COMMIT_SHA --push --tag gitea.hackmi.ch/phil/goshorly:latest . services: - name: docker image: docker:dind privileged: true volumes: - name: dockersock path: /var/run volumes: - name: dockersock temp: {} depends_on: - check