Skip to content

Add linting step to CI #151

Add linting step to CI

Add linting step to CI #151

Workflow file for this run

name: CI Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./.github/actions/lint-terraform-svchost
copywrite:
name: Run Header Copyright
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Install Copywrite
id: install
uses: hashicorp/setup-copywrite@v1.1.2
- name: Output Installed Copywrite Version
run: echo "Installed Copywrite CLI ${{steps.install.outputs.version}}"
- name: Run Copywrite Header Compliance
run: copywrite headers --plan
test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Set up Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version-file: go.mod
cache: true
- name: Get dependences
run: go mod download
- name: Verify go.mod and go.sum are consistent
run: go mod tidy
- name: Ensure nothing changed
run: git diff --exit-code
- name: Check format
run: |
go fmt ./...
if [[ -z "$(git status --porcelain)" ]]; then
echo "Formatting is consistent with 'go fmt'."
else
echo "Run 'go fmt ./...' to automatically apply standard Go style to all packages."
git status --porcelain
exit 1
fi
- name: Run tests
run: go test -v -race ./...