docs: Improve README #33
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
on: [push, pull_request] | |
name: CI | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go 1.22 | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.22" | |
check-latest: true | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Test | |
- name: Test | |
run: go test -v -race ./... | |
- name: Calculate coverage | |
run: go test -v -covermode=count -coverprofile=coverage.out | |
- name: Convert coverage.out to coverage.lcov | |
uses: jandelgado/[email protected] | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
path-to-lcov: coverage.lcov | |
- name: Run go vet | |
continue-on-error: true | |
run: go vet ./... | |
# Make sure templ generate was executed before commit | |
- name: Generate templates | |
run: go run github.com/a-h/templ/cmd/templ generate | |
- name: Check file changes after templ generate | |
run: | | |
git diff --exit-code | |
id: diff_files_after_templ_generate | |
continue-on-error: true | |
- name: Fail if changes are detected | |
if: steps.diff_files_after_templ_generate.outcome == 'failure' | |
run: | | |
echo "Detected uncommitted changes after running templ generate." \ | |
"Please regenerate .templ templates and commit changes." && exit 1 | |
# Try compile | |
- name: Compile | |
run: go build -o /dev/null . |