mirror of
https://github.com/umputun/reproxy.git
synced 2024-11-30 08:16:56 +02:00
59 lines
1.8 KiB
YAML
59 lines
1.8 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
tags:
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: set up go 1.16
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.16
|
|
id: go
|
|
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: build and test
|
|
run: |
|
|
go test -v -timeout=100s -covermode=count -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp ./...
|
|
cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "mocks" | grep -v "_mock" > $GITHUB_WORKSPACE/profile.cov
|
|
working-directory: app
|
|
env:
|
|
GOFLAGS: "-mod=vendor"
|
|
TZ: "America/Chicago"
|
|
|
|
- name: install golangci-lint and goveralls
|
|
run: |
|
|
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.29.0
|
|
GO111MODULE=off go get -u github.com/mattn/goveralls
|
|
|
|
- name: run linters
|
|
run: $GITHUB_WORKSPACE/golangci-lint run
|
|
env:
|
|
GOFLAGS: "-mod=vendor"
|
|
TZ: "America/Chicago"
|
|
|
|
- name: submit coverage
|
|
run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
|
|
env:
|
|
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: build and deploy image
|
|
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
|
|
env:
|
|
GITHUB_PACKAGE_TOKEN: ${{ secrets.PKG_TOKEN }}
|
|
USERNAME: ${{ github.actor }}
|
|
run: |
|
|
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
|
|
echo GITHUB_REF - $ref
|
|
echo ${GITHUB_PACKAGE_TOKEN} | docker login ghcr.io -u ${USERNAME} --password-stdin
|
|
docker build --build-arg CI=github -t ghcr.io/${USERNAME}/reproxy:${ref} .
|
|
docker push ghcr.io/${USERNAME}/reproxy:${ref}
|