- Only trigger on push and PR to master - Do not push images for branches - Add fork only workflow - Add dependabot only workflow - Do not trigger ci workflow from forked/dependabot PRs
41 lines
926 B
YAML
41 lines
926 B
YAML
name: Fork
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- .github/workflows/fork.yml
|
|
- cmd/**
|
|
- internal/**
|
|
- pkg/**
|
|
- .dockerignore
|
|
- .golangci.yml
|
|
- Dockerfile
|
|
- go.mod
|
|
- go.sum
|
|
|
|
jobs:
|
|
verify:
|
|
if: github.event.pull_request.head.repo.full_name != github.repository && github.actor != 'dependabot[bot]'
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DOCKER_BUILDKIT: "1"
|
|
steps:
|
|
- uses: actions/checkout@v2.3.4
|
|
|
|
- name: Linting
|
|
run: docker build --target lint .
|
|
|
|
- name: Build test image
|
|
run: docker build --target test -t test-container .
|
|
|
|
- name: Run tests in test container
|
|
run: |
|
|
touch coverage.txt
|
|
docker run --rm \
|
|
-v "$(pwd)/coverage.txt:/tmp/gobuild/coverage.txt" \
|
|
test-container
|
|
|
|
- name: Build final image
|
|
run: docker build -t final-image .
|