mirror of
https://github.com/terraform-docs/terraform-docs.git
synced 2026-03-27 12:58:35 +07:00
100 lines
2.3 KiB
YAML
100 lines
2.3 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
env:
|
|
GO_VERSION: "1.15"
|
|
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Build binary
|
|
run: make build
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Run tests
|
|
run: make test
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
file: ./coverage.out
|
|
|
|
validate:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Verify dependencies
|
|
run: make verify
|
|
|
|
- name: Check formatting
|
|
run: make goimports checkfmt
|
|
|
|
- name: Run linters
|
|
run: make golangci lint
|
|
|
|
- name: Run Staticcheck
|
|
run: make staticcheck
|
|
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Login to Docker
|
|
uses: docker/login-action@v1
|
|
if: env.REGISTRY_USERNAME != ''
|
|
with:
|
|
registry: quay.io
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build 'dev' Docker image
|
|
if: "!contains(github.ref, 'refs/heads/master')"
|
|
run: make docker
|
|
env:
|
|
DOCKER_TAG: ${{ github.sha }}
|
|
|
|
- name: Build and push 'edge' Docker image
|
|
if: env.REGISTRY_USERNAME != '' && contains(github.ref, 'refs/heads/master')
|
|
run: make docker push
|
|
env:
|
|
DOCKER_TAG: edge
|