Enable GO111MODULE when retrieving addlicense #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
GO_VERSION: "1.22.1" | |
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@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
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@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run tests | |
run: make test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
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@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
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 | |
- name: Check License headers | |
run: | | |
GO111MODULE=on go install github.com/google/addlicense | |
addlicense -check $(find . -type f -name "*.go") | |
addlicense -check $(find . -type f -name "*.sh") | |
addlicense -check $(find . -type f -name "Dockerfile") | |
- name: Check docs | |
if: "!contains(github.ref, 'refs/heads/master')" | |
run: make docs && test -z "$(git status --porcelain)" || exit 1 | |
docker: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[ci skip]')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to Docker | |
uses: docker/login-action@v3 | |
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 | |
publish: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[ci skip]')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare docs | |
if: contains(github.ref, 'refs/heads/master') | |
run: ./scripts/docs/prepare-site.sh | |
- name: Publish to website | |
uses: drud/action-cross-commit@master | |
if: contains(github.ref, 'refs/heads/master') | |
with: | |
source-folder: site/content | |
destination-repository: https://${{ secrets.COMMITTER_USERNAME }}:${{ secrets.COMMITTER_TOKEN }}@github.com/terraform-docs/website | |
destination-folder: content | |
destination-branch: main | |
git-user: terraform-docs-bot | |
git-user-email: bot@terraform-docs.io | |
git-commit-message: |- | |
Update website content | |
from: https://github.com/terraform-docs/terraform-docs/commit/${{ github.sha }} |